language stringclasses 1
value | owner stringlengths 2 15 | repo stringlengths 2 21 | sha stringlengths 45 45 | message stringlengths 7 36.3k | path stringlengths 1 199 | patch stringlengths 15 102k | is_multipart bool 2
classes |
|---|---|---|---|---|---|---|---|
Other | emberjs | ember.js | a1aded50cdaa46fdd46df010320e1a5ee0457f83.json | Fix inconsistent version number | CHANGELOG | @@ -1,4 +1,5 @@
-*Ember 1.0.0-rc4 (May 27, 2013)*
+*Ember 1.0.0-rc.4 (May 27, 2013)*
+
* Loader: improve missing module error message
* Fix click test helper selector context
* fixes #2737: 'In the Router, if ApplicationController is an ObjectController, currentPath is proxied to the content.' | true |
Other | emberjs | ember.js | a1aded50cdaa46fdd46df010320e1a5ee0457f83.json | Fix inconsistent version number | VERSION | @@ -1 +1 @@
-1.0.0-rc4
+1.0.0-rc.4 | true |
Other | emberjs | ember.js | a1aded50cdaa46fdd46df010320e1a5ee0457f83.json | Fix inconsistent version number | ember.json | @@ -2,7 +2,7 @@
"name": "ember",
"bpm": "1.0.0",
"dependencies": {
- "ember": "1.0.0-rc4"
+ "ember": "1.0.0-rc.4"
},
"dependencies:development": {
"spade-qunit": "~> 1.0.0" | true |
Other | emberjs | ember.js | a1aded50cdaa46fdd46df010320e1a5ee0457f83.json | Fix inconsistent version number | packages/ember-application/package.json | @@ -4,11 +4,11 @@
"description": "Namespacing, event delegation, and structure for applications.",
"homepage": "http://emberjs.com",
"author": "Yehuda Katz",
- "version": "1.0.0-rc4",
+ "version": "1.0.0-rc.4",
"dependencies": {
- "ember-views": "1.0.0-rc4",
- "ember-states": "1.0.0-rc4",
- "ember-routing": "1.0.0-rc4"
+ "ember-views": "1.0.0-rc.4",
+ "ember-states": "1.0.0-rc.4",
+ "ember-routing": "1.0.0-rc.4"
},
"directories": { | true |
Other | emberjs | ember.js | a1aded50cdaa46fdd46df010320e1a5ee0457f83.json | Fix inconsistent version number | packages/ember-debug/package.json | @@ -4,7 +4,7 @@
"description": "Debugging helpers for Ember",
"homepage": "http://www.emberjs.com",
"author": "Peter Wagenet",
- "version": "1.0.0-rc4",
+ "version": "1.0.0-rc.4",
"directories": {
"lib": "lib" | true |
Other | emberjs | ember.js | a1aded50cdaa46fdd46df010320e1a5ee0457f83.json | Fix inconsistent version number | packages/ember-handlebars-compiler/package.json | @@ -4,7 +4,7 @@
"description": "A programmatic compiler for Handlebars with the few syntax extensions supported by Ember with minimal dependencies",
"homepage": "http://emberjs.com",
"author": "Yehuda Katz",
- "version": "1.0.0-rc4",
+ "version": "1.0.0-rc.4",
"dependencies": {
"spade": "~> 1.0.0",
"handlebars": "~> 1.0.0.beta.6" | true |
Other | emberjs | ember.js | a1aded50cdaa46fdd46df010320e1a5ee0457f83.json | Fix inconsistent version number | packages/ember-handlebars/package.json | @@ -4,11 +4,11 @@
"description": "Extensions to the Handlebars templating engine for use with Ember. These extensions make Handlebars aware of property observing, which allows it to automatically update the DOM when the referenced properties change. It also provides Handlebars helpers for creating Ember views and working with collections.",
"homepage": "http://emberjs.com",
"author": "Yehuda Katz",
- "version": "1.0.0-rc4",
+ "version": "1.0.0-rc.4",
"dependencies": {
"spade": "~> 1.0.0",
- "ember-handlebars-compiler": "1.0.0-rc4",
- "ember-views": "1.0.0-rc4",
+ "ember-handlebars-compiler": "1.0.0-rc.4",
+ "ember-views": "1.0.0-rc.4",
"metamorph": "~> 1.0.0"
},
| true |
Other | emberjs | ember.js | a1aded50cdaa46fdd46df010320e1a5ee0457f83.json | Fix inconsistent version number | packages/ember-metal/lib/core.js | @@ -22,7 +22,7 @@
@class Ember
@static
- @version 1.0.0-rc4
+ @version 1.0.0-rc.4
*/
if ('undefined' === typeof Ember) {
@@ -49,10 +49,10 @@ Ember.toString = function() { return "Ember"; };
/**
@property VERSION
@type String
- @default '1.0.0-rc4'
+ @default '1.0.0-rc.4'
@final
*/
-Ember.VERSION = '1.0.0-rc4';
+Ember.VERSION = '1.0.0-rc.4';
/**
Standard environmental variables. You can define these in a global `ENV` | true |
Other | emberjs | ember.js | a1aded50cdaa46fdd46df010320e1a5ee0457f83.json | Fix inconsistent version number | packages/ember-metal/package.json | @@ -4,7 +4,7 @@
"summary": "JavaScript on Steroids",
"homepage": "http://github.com/emberjs/ember.js",
"author": "Charles Jolley",
- "version": "1.0.0-rc4",
+ "version": "1.0.0-rc.4",
"dependencies": {
"spade": "~> 1.0.0" | true |
Other | emberjs | ember.js | a1aded50cdaa46fdd46df010320e1a5ee0457f83.json | Fix inconsistent version number | packages/ember-old-router/package.json | @@ -4,16 +4,16 @@
"description": "The Ember routing system",
"homepage": "http://emberjs.com",
"author": "Yehuda Katz",
- "version": "1.0.0-rc4",
+ "version": "1.0.0-rc.4",
"directories": {
"lib": "lib"
},
"dependencies": {
"spade": "~> 1.0",
- "ember-views": "1.0.0-rc4",
- "ember-states": "1.0.0-rc4"
+ "ember-views": "1.0.0-rc.4",
+ "ember-states": "1.0.0-rc.4"
},
"dependencies:development": { | true |
Other | emberjs | ember.js | a1aded50cdaa46fdd46df010320e1a5ee0457f83.json | Fix inconsistent version number | packages/ember-routing/package.json | @@ -4,15 +4,15 @@
"description": "The Ember routing system",
"homepage": "http://emberjs.com",
"author": "Yehuda Katz",
- "version": "1.0.0-rc4",
+ "version": "1.0.0-rc.4",
"directories": {
"lib": "lib"
},
"dependencies": {
"spade": "~> 1.0",
- "ember-views": "1.0.0-rc4"
+ "ember-views": "1.0.0-rc.4"
},
"dependencies:development": { | true |
Other | emberjs | ember.js | a1aded50cdaa46fdd46df010320e1a5ee0457f83.json | Fix inconsistent version number | packages/ember-runtime/package.json | @@ -5,15 +5,15 @@
"homepage": "http://emberjs.com",
"author": "Charles Jolley",
- "version": "1.0.0-rc4",
+ "version": "1.0.0-rc.4",
"directories": {
"lib": "lib"
},
"dependencies": {
"spade": "~> 1.0",
- "ember-metal": "1.0.0-rc4",
+ "ember-metal": "1.0.0-rc.4",
"container": "1.0.0-pre.2"
},
| true |
Other | emberjs | ember.js | a1aded50cdaa46fdd46df010320e1a5ee0457f83.json | Fix inconsistent version number | packages/ember-states/package.json | @@ -4,15 +4,15 @@
"description": "The Ember state management system",
"homepage": "http://emberjs.com",
"author": "Yehuda Katz",
- "version": "1.0.0-rc4",
+ "version": "1.0.0-rc.4",
"directories": {
"lib": "lib"
},
"dependencies": {
"spade": "~> 1.0",
- "ember-runtime": "1.0.0-rc4"
+ "ember-runtime": "1.0.0-rc.4"
},
"dependencies:development": { | true |
Other | emberjs | ember.js | a1aded50cdaa46fdd46df010320e1a5ee0457f83.json | Fix inconsistent version number | packages/ember-testing/package.json | @@ -4,7 +4,7 @@
"description": "A lightweight library that provides tools for testing Ember applications",
"homepage": "https://github.com/emberjs/ember.js",
"authors": ["Erik Bryn"],
- "version": "1.0.0-rc4",
+ "version": "1.0.0-rc.4",
"dependencies": {
"spade": "~> 1.0.0" | true |
Other | emberjs | ember.js | a1aded50cdaa46fdd46df010320e1a5ee0457f83.json | Fix inconsistent version number | packages/ember-views/package.json | @@ -4,7 +4,7 @@
"description": "The Ember view system",
"homepage": "http://emberjs.com",
"author": "Yehuda Katz",
- "version": "1.0.0-rc4",
+ "version": "1.0.0-rc.4",
"directories": {
"lib": "lib"
@@ -13,7 +13,7 @@
"dependencies": {
"spade": "~> 1.0",
"jquery": "~> 1.7",
- "ember-runtime": "1.0.0-rc4",
+ "ember-runtime": "1.0.0-rc.4",
"container": "1.0.0-pre.2"
},
| true |
Other | emberjs | ember.js | a1aded50cdaa46fdd46df010320e1a5ee0457f83.json | Fix inconsistent version number | packages/ember/package.json | @@ -4,15 +4,15 @@
"summary": "Ember - JavaScript Application Framework",
"homepage": "http://github.com/emberjs/ember.js",
"author": "Charles Jolley",
- "version": "1.0.0-rc4",
+ "version": "1.0.0-rc.4",
"dependencies": {
"spade": "~> 1.0.0",
- "ember-runtime": "1.0.0-rc4",
- "ember-views": "1.0.0-rc4",
- "ember-states": "1.0.0-rc4",
- "ember-routing": "1.0.0-rc4",
- "ember-handlebars": "1.0.0-rc4"
+ "ember-runtime": "1.0.0-rc.4",
+ "ember-views": "1.0.0-rc.4",
+ "ember-states": "1.0.0-rc.4",
+ "ember-routing": "1.0.0-rc.4",
+ "ember-handlebars": "1.0.0-rc.4"
},
"directories": { | true |
Other | emberjs | ember.js | 83141df210fa420d5bf0470d46acdecd5b777ff8.json | remove non-latest builds | CONTRIBUTING.md | @@ -25,7 +25,6 @@ this bug already.
demo should be fully operational with the exception of the bug you want to
demonstrate. The more pared down, the better.
Preconfigured starting points for the latest Ember: [JSFiddle](http://jsfiddle.net/DCrHG/) | [JSBin](http://jsbin.com/ucanam/54/edit) (may not work with older IE versions due to MIME type isses).
-Preconfigured starting points for 1.0.0-rc.3: [JSFiddle](http://jsfiddle.net/3bGN4/244/) | [JSBin](http://jsbin.com/icejog/1/edit).
Issues with fiddles are prioritized.
4. Your issue will be verified. The provided fiddle will be tested for | false |
Other | emberjs | ember.js | ce2e5b3469560d0b1eccab9ce28ef6c6c57ada12.json | Fix typo in code comment
`OuterView` is defined as example not `OutsideView`. | packages/ember-views/lib/views/view.js | @@ -725,7 +725,7 @@ class:
eventManager: Ember.Object.create({
mouseEnter: function(event, view){
// view might be instance of either
- // OutsideView or InnerView depending on
+ // OuterView or InnerView depending on
// where on the page the user interaction occured
}
}) | false |
Other | emberjs | ember.js | beb4267bdabab179f3a360541c3b614012261bc9.json | add Ember.shallowSet which avoids unknownProperty
thus it doesn't proxy | packages/ember-metal/lib/shallow_set.js | @@ -0,0 +1,39 @@
+require('ember-metal/property_set');
+require('ember-metal/properties');
+
+var set = Ember.set,
+ defineProperty = Ember.defineProperty;
+
+/**
+ Sets the value of a property on an object avoiding the `unknownProperty` hook,
+ instead, if the value is an unknown property, the property is defined on the
+ object before setting the property, respecting computed properties and notifying
+ observers and other listeners of the change.
+
+ ```javascript
+ var controller = Ember.ObjectController.create({
+ content: {}
+ })
+
+ Ember.shallowSet(controller, 'hello', 'world')
+
+ controller.get('hello')// == 'world'
+
+ // but this set was not proxied to the content
+ controller.get('content.hello')// == undefined
+ ```
+
+ @method shallowSet
+ @for Ember
+ @param {Object} obj The object to modify.
+ @param {String} keyName The property key to set
+ @param {Object} value The value to set
+ @return {Object} the passed value.
+*/
+Ember.shallowSet = function shallowSet(obj, keyName, value) {
+ if (!(keyName in obj)) {
+ defineProperty(obj, keyName);
+ }
+
+ return set(obj, keyName, value);
+}; | true |
Other | emberjs | ember.js | beb4267bdabab179f3a360541c3b614012261bc9.json | add Ember.shallowSet which avoids unknownProperty
thus it doesn't proxy | packages/ember-metal/tests/shallow_set_test.js | @@ -0,0 +1,45 @@
+require('ember-metal/shallow_set');
+require('ember-metal/computed');
+require('ember-metal/observer');
+
+module('Ember.shallowSet');
+
+test('shallowSet avoids unknownProperty', function() {
+ var target = {};
+ var proxy = {
+ target: target,
+ unknownProperty: function (key) {
+ return target[key];
+ },
+ setUnknownProperty: function (key, value) {
+ return target[key] = value;
+ }
+ };
+ Ember.set(proxy, 'baz', 'boo');
+ equal(Ember.get(proxy, 'baz'), 'boo', 'is set on proxy');
+ equal(Ember.get(target, 'baz'), 'boo', 'is set on target');
+
+ Ember.shallowSet(proxy, 'foo', 'bar');
+
+ equal(Ember.get(proxy, 'foo'), 'bar', 'is set on proxy');
+ equal(Ember.get(target, 'foo'), undefined, 'is not set on target');
+
+ Ember.defineProperty(proxy, 'cp', Ember.computed(function(key, value) {
+ return 'computed ' + value;
+ }));
+
+ Ember.shallowSet(proxy, 'cp', 'foo');
+
+ equal(Ember.get(proxy, 'cp'), 'computed foo', 'does not clobber computed property if property is known');
+
+ var changed;
+ Ember.addObserver(proxy, 'watched', function () {
+ changed = Ember.get(proxy, 'watched');
+ });
+
+ equal('watched' in proxy, false, 'precond property is unknown');
+
+ Ember.shallowSet(proxy, 'watched', 'boo');
+
+ equal(changed, 'boo', 'when shallowSet defines the property, it is observable');
+}); | true |
Other | emberjs | ember.js | 9c83112d9698823e4b9f540891a1f083d17d9503.json | use Ember.run.join internally for App#reset | packages/ember-application/lib/system/application.js | @@ -521,6 +521,8 @@ var Application = Ember.Application = Ember.Namespace.extend(Ember.DeferredMixin
@method reset
**/
reset: function() {
+ this._readinessDeferrals = 1;
+
function handleReset() {
var router = this.__container__.lookup('router:main');
router.reset();
@@ -529,19 +531,13 @@ var Application = Ember.Application = Ember.Namespace.extend(Ember.DeferredMixin
this.buildContainer();
- this._readinessDeferrals = 1;
-
Ember.run.schedule('actions', this, function(){
this._initialize();
this.startRouting();
});
}
- if (Ember.run.currentRunLoop) {
- handleReset.call(this);
- } else {
- Ember.run(this, handleReset);
- }
+ Ember.run.join(this, handleReset);
},
/** | false |
Other | emberjs | ember.js | 4a48656fbf11b985ae8943ce75c631413cb23485.json | Fix failing test in older IE
In older IE, `for` enumerate internal properties. | packages/ember-runtime/tests/system/object/destroy_test.js | @@ -122,9 +122,9 @@ test("destroyed objects should not see each others changes during teardown but a
var longLivedObject = new LongLivedObject();
Ember.run(function () {
- for (var key in objs) {
- if (!objs.hasOwnProperty(key)) continue;
- objs[key].destroy();
+ var keys = Ember.keys(objs);
+ for (var i = 0, l = keys.length; i < l; i++) {
+ objs[keys[i]].destroy();
}
});
| false |
Other | emberjs | ember.js | 39e9ef7923a549a617854268d7286173e2d0c8e4.json | fix misleading docs [fixes
https://github.com/emberjs/website/issues/485] | packages/ember-application/lib/system/application.js | @@ -152,17 +152,6 @@ DeprecatedContainer.prototype = {
If there is any setup required before routing begins, you can implement a
`ready()` method on your app that will be invoked immediately before routing
begins.
-
- To begin routing, you must have at a minimum a top-level controller and view.
- You define these as `App.ApplicationController` and `App.ApplicationView`,
- respectively. Your application will not work if you do not define these two
- mandatory classes. For example:
-
- ```javascript
- App.ApplicationView = Ember.View.extend({
- templateName: 'application'
- });
- App.ApplicationController = Ember.Controller.extend();
```
@class Application | false |
Other | emberjs | ember.js | a6ad8eace3e2211bce100f153082397baf023c6f.json | Remove unused variable | packages/ember-handlebars/tests/handlebars_test.js | @@ -56,7 +56,6 @@ var appendView = function() {
Ember.run(function() { view.appendTo('#qunit-fixture'); });
};
-var additionalTeardown;
var originalLookup = Ember.lookup, lookup;
var TemplateTests, container;
| false |
Other | emberjs | ember.js | ef9db4b6a81fbc289ada8783f6ee9155db2bd9ce.json | Use helper function to remove duplication | packages/ember-handlebars/tests/handlebars_test.js | @@ -151,7 +151,7 @@ test("should escape HTML in normal mustaches", function() {
output: "you need to be more <b>bold</b>"
});
- Ember.run(function() { view.appendTo('#qunit-fixture'); });
+ appendView();
equal(view.$('b').length, 0, "does not create an element");
equal(view.$().text(), 'you need to be more <b>bold</b>', "inserts entities, not elements");
@@ -166,9 +166,7 @@ test("should not escape HTML in triple mustaches", function() {
output: "you need to be more <b>bold</b>"
});
- Ember.run(function() {
- view.appendTo('#qunit-fixture');
- });
+ appendView();
equal(view.$('b').length, 1, "creates an element");
@@ -185,9 +183,7 @@ test("should not escape HTML if string is a Handlebars.SafeString", function() {
output: new Handlebars.SafeString("you need to be more <b>bold</b>")
});
- Ember.run(function() {
- view.appendTo('#qunit-fixture');
- });
+ appendView();
equal(view.$('b').length, 1, "creates an element");
@@ -293,9 +289,7 @@ test("Ember.View should bind properties in the parent context", function() {
template: Ember.Handlebars.compile('<h1 id="first">{{#with content}}{{wham}}-{{../blam}}{{/with}}</h1>')
});
- Ember.run(function() {
- view.appendTo('#qunit-fixture');
- });
+ appendView();
equal(view.$('#first').text(), "bam-shazam", "renders parent properties");
});
@@ -318,9 +312,7 @@ test("Ember.View should bind properties in the grandparent context", function()
template: Ember.Handlebars.compile('<h1 id="first">{{#with content}}{{#with thankYou}}{{value}}-{{../wham}}-{{../../blam}}{{/with}}{{/with}}</h1>')
});
- Ember.run(function() {
- view.appendTo('#qunit-fixture');
- });
+ appendView();
equal(view.$('#first').text(), "ma'am-bam-shazam", "renders grandparent properties");
});
@@ -338,9 +330,7 @@ test("Ember.View should update when a property changes and the bind helper is us
})
});
- Ember.run(function() {
- view.appendTo('#qunit-fixture');
- });
+ appendView();
equal(view.$('#first').text(), "bam", "precond - view renders Handlebars template");
@@ -362,9 +352,7 @@ test("Ember.View should not use keyword incorrectly - Issue #1315", function() {
])
});
- Ember.run(function() {
- view.appendTo('#qunit-fixture');
- });
+ appendView();
equal(view.$().text(), 'X-1:One 2:Two Y-1:One 2:Two ');
});
@@ -386,9 +374,7 @@ test("Ember.View should update when a property changes and no bind helper is use
})
});
- Ember.run(function() {
- view.appendTo('#qunit-fixture');
- });
+ appendView();
equal(view.$('#first').text(), "bam", "precond - view renders Handlebars template");
@@ -1763,9 +1749,7 @@ test("should allow standard Handlebars template usage", function() {
template: Handlebars.compile("Hello, {{name}}")
});
- Ember.run(function() {
- view.appendTo('#qunit-fixture');
- });
+ appendView();
equal(view.$().text(), "Hello, Erik");
});
@@ -1776,9 +1760,7 @@ test("should be able to use standard Handlebars #each helper", function() {
template: Handlebars.compile("{{#each items}}{{this}}{{/each}}")
});
- Ember.run(function() {
- view.appendTo('#qunit-fixture');
- });
+ appendView();
equal(view.$().html(), "abc");
});
@@ -1837,9 +1819,7 @@ test("should expose a controller keyword when present on the view", function() {
template: Ember.Handlebars.compile(templateString)
});
- Ember.run(function() {
- view.appendTo("#qunit-fixture");
- });
+ appendView();
equal(view.$().text(), "barbang", "renders values from controller and parent controller");
@@ -1861,9 +1841,7 @@ test("should expose a controller keyword when present on the view", function() {
template: Ember.Handlebars.compile("{{controller}}")
});
- Ember.run(function() {
- view.appendTo('#qunit-fixture');
- });
+ appendView();
equal(view.$().text(), "aString", "renders the controller itself if no additional path is specified");
});
@@ -1878,9 +1856,7 @@ test("should expose a controller keyword that can be used in conditionals", func
template: Ember.Handlebars.compile(templateString)
});
- Ember.run(function() {
- view.appendTo("#qunit-fixture");
- });
+ appendView();
equal(view.$().text(), "bar", "renders values from controller and parent controller");
@@ -1901,9 +1877,7 @@ test("should expose a controller keyword that persists through Ember.ContainerVi
template: Ember.Handlebars.compile(templateString)
});
- Ember.run(function() {
- view.appendTo("#qunit-fixture");
- });
+ appendView();
var containerView = get(view, 'childViews.firstObject');
var viewInstanceToBeInserted = Ember.View.create({
@@ -1932,9 +1906,7 @@ test("should expose a view keyword", function() {
template: Ember.Handlebars.compile(templateString)
});
- Ember.run(function() {
- view.appendTo("#qunit-fixture");
- });
+ appendView();
equal(view.$().text(), "barbang", "renders values from view and child view");
});
@@ -1952,9 +1924,7 @@ test("Ember.Button targets should respect keywords", function() {
}
});
- Ember.run(function() {
- view.appendTo('#qunit-fixture');
- });
+ appendView();
var button = view.get('childViews').objectAt(0);
equal(button.get('targetObject'), "bar", "resolves the target");
@@ -2171,9 +2141,7 @@ test("bindings should be relative to the current context", function() {
template: Ember.Handlebars.compile('{{#if view.museumOpen}} {{view view.museumView nameBinding="view.museumDetails.name" dollarsBinding="view.museumDetails.price"}} {{/if}}')
});
- Ember.run(function() {
- view.appendTo('#qunit-fixture');
- });
+ appendView();
equal(Ember.$.trim(view.$().text()), "Name: SFMoMA Price: $20", "should print baz twice");
});
@@ -2197,9 +2165,7 @@ test("bindings should respect keywords", function() {
template: Ember.Handlebars.compile('{{#if view.museumOpen}}{{view view.museumView nameBinding="controller.museumDetails.name" dollarsBinding="controller.museumDetails.price"}}{{/if}}')
});
- Ember.run(function() {
- view.appendTo('#qunit-fixture');
- });
+ appendView();
equal(Ember.$.trim(view.$().text()), "Name: SFMoMA Price: $20", "should print baz twice");
});
@@ -2220,9 +2186,7 @@ test("bindings can be 'this', in which case they *are* the current context", fun
template: Ember.Handlebars.compile('{{#if view.museumOpen}} {{#with view.museumDetails}}{{view museumView museumBinding="this"}} {{/with}}{{/if}}')
});
- Ember.run(function() {
- view.appendTo('#qunit-fixture');
- });
+ appendView();
equal(Ember.$.trim(view.$().text()), "Name: SFMoMA Price: $20", "should print baz twice");
});
@@ -2277,9 +2241,7 @@ test("should update bound values after the view is removed and then re-appended"
boundValue: "foo"
});
- Ember.run(function() {
- view.appendTo('#qunit-fixture');
- });
+ appendView();
equal(Ember.$.trim(view.$().text()), "foo");
Ember.run(function() {
@@ -2299,9 +2261,7 @@ test("should update bound values after the view is removed and then re-appended"
Ember.run(function() {
set(view, 'showStuff', true);
});
- Ember.run(function() {
- view.appendTo('#qunit-fixture');
- });
+ appendView();
Ember.run(function() {
set(view, 'boundValue', "bar"); | false |
Other | emberjs | ember.js | 3d87f631e2b3924b584a6b4ceb2a1a02b4142908.json | update doc example to current router | packages/ember-application/lib/system/application.js | @@ -284,10 +284,10 @@ var Application = Ember.Application = Ember.Namespace.extend(Ember.DeferredMixin
This allows application developers to do:
```javascript
- App = Ember.Application.create();
+ var App = Ember.Application.create();
- App.Router.map(function(match) {
- match("/").to("index");
+ App.Router.map(function() {
+ this.resource('posts');
});
```
| false |
Other | emberjs | ember.js | 84858a10e0090bd708284921d2e6673f4778f73e.json | Fix downloads link for starter-kit
The link to downloads is deprecated.
* https://github.com/blog/1302-goodbye-uploads
Now, we can download tagged version from '/tags'. | README.md | @@ -115,7 +115,7 @@ developers struggle with every day.
# Getting Started
For new users, we recommend downloading the [Ember.js Starter
-Kit](https://github.com/emberjs/starter-kit/downloads), which includes
+Kit](https://github.com/emberjs/starter-kit/tags), which includes
everything you need to get started.
# Building Ember.js | false |
Other | emberjs | ember.js | 018661de496991d9b7d8e1eadcbbf4e7973bbd1e.json | Documentation: fix code block of Ember.String.capitalize
Code examples were not displayed in block code. | packages/ember-runtime/lib/system/string.js | @@ -231,10 +231,12 @@ Ember.String = {
/**
Returns the Capitalized form of a string
- 'innerHTML'.capitalize() // 'InnerHTML'
- 'action_name'.capitalize() // 'Action_name'
- 'css-class-name'.capitalize() // 'Css-class-name'
- 'my favorite items'.capitalize() // 'My favorite items'
+ ```javascript
+ 'innerHTML'.capitalize() // 'InnerHTML'
+ 'action_name'.capitalize() // 'Action_name'
+ 'css-class-name'.capitalize() // 'Css-class-name'
+ 'my favorite items'.capitalize() // 'My favorite items'
+ ```
@method capitalize
@param {String} str | false |
Other | emberjs | ember.js | 3173a49a82a7d80d189c03a257196c834959d0e5.json | Remove unnecessary yuidoc markup
The comments begining with `/**` is parsed as yuidoc.
These comments has no yuidoc markup. | packages/ember-routing/lib/system/transition_event.js | @@ -4,7 +4,7 @@
*/
-/**
+/*
A TransitionEvent is passed as the argument for `transitionTo`
events and contains information about an attempted transition
that can be modified or decorated by leafier `transitionTo` event
@@ -16,7 +16,7 @@
*/
Ember.TransitionEvent = Ember.Object.extend({
- /**
+ /*
The Ember.Route method used to perform the transition. Presently,
the only valid values are 'transitionTo' and 'replaceWith'.
*/
@@ -30,7 +30,7 @@ Ember.TransitionEvent = Ember.Object.extend({
this.contexts = this.contexts || [];
},
- /**
+ /*
Convenience method that returns an array that can be used for
legacy `transitionTo` and `replaceWith`.
*/
@@ -41,7 +41,7 @@ Ember.TransitionEvent = Ember.Object.extend({
Ember.TransitionEvent.reopenClass({
- /**
+ /*
This is the default transition event handler that will be injected
into ApplicationRoute. The context, like all route event handlers in
the events hash, will be an `Ember.Route`. | true |
Other | emberjs | ember.js | 3173a49a82a7d80d189c03a257196c834959d0e5.json | Remove unnecessary yuidoc markup
The comments begining with `/**` is parsed as yuidoc.
These comments has no yuidoc markup. | packages/ember-views/lib/system/utils.js | @@ -3,7 +3,7 @@
@submodule ember-views
*/
-/*** BEGIN METAMORPH HELPERS ***/
+/* BEGIN METAMORPH HELPERS */
// Internet Explorer prior to 9 does not allow setting innerHTML if the first element
// is a "zero-scope" element. This problem can be worked around by making
@@ -76,7 +76,7 @@ var setInnerHTMLWithoutFix = function(element, html) {
}
};
-/*** END METAMORPH HELPERS */
+/* END METAMORPH HELPERS */
var innerHTMLTags = {}; | true |
Other | emberjs | ember.js | ea7e746d13f7c9173d2b3f3a4b66d1228aeb60c2.json | Remove unnecessary reference
`Error.prototype.constructor` returns `Error`. | packages/ember-runtime/lib/core.js | @@ -288,7 +288,7 @@ var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'n
@constructor
*/
Ember.Error = function() {
- var tmp = Error.prototype.constructor.apply(this, arguments);
+ var tmp = Error.apply(this, arguments);
// Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
for (var idx = 0; idx < errorProps.length; idx++) { | false |
Other | emberjs | ember.js | 2e85b0e67f5f077b57c56c7232fee43a7b4710b9.json | Remove SC compatibility in Ember.Array
I think `Ember.Array#isSCArray` is no longer necessary. | packages/ember-runtime/lib/mixins/array.js | @@ -49,9 +49,6 @@ var get = Ember.get, set = Ember.set, isNone = Ember.isNone, map = Ember.Enumera
*/
Ember.Array = Ember.Mixin.create(Ember.Enumerable, /** @scope Ember.Array.prototype */ {
- // compatibility
- isSCArray: true,
-
/**
Your array must support the `length` property. Your replace methods should
set this property whenever it changes. | false |
Other | emberjs | ember.js | 4fffc17412c126590d1bc4cce8a0620af5d3a419.json | Remove unused variables and helper function | packages/ember-metal/lib/events.js | @@ -10,7 +10,7 @@ var o_create = Ember.create,
metaFor = Ember.meta,
META_KEY = Ember.META_KEY,
/* listener flags */
- ONCE = 1, SUSPENDED = 2, IMMEDIATE = 4;
+ ONCE = 1, SUSPENDED = 2;
/*
The event system uses a series of nested hashes to store listeners on an | true |
Other | emberjs | ember.js | 4fffc17412c126590d1bc4cce8a0620af5d3a419.json | Remove unused variables and helper function | packages/ember-metal/lib/mixin.js | @@ -199,14 +199,6 @@ function mergeMixins(mixins, m, descs, values, base, keys) {
}
}
-function writableReq(obj) {
- var m = Ember.meta(obj), req = m.required;
- if (!req || !m.hasOwnProperty('required')) {
- req = m.required = req ? o_create(req) : {};
- }
- return req;
-}
-
var IS_BINDING = Ember.IS_BINDING = /^.+Binding$/;
function detectBinding(obj, key, value, m) { | true |
Other | emberjs | ember.js | 4fffc17412c126590d1bc4cce8a0620af5d3a419.json | Remove unused variables and helper function | packages/ember-metal/lib/observer.js | @@ -11,8 +11,6 @@ require('ember-metal/array');
var AFTER_OBSERVERS = ':change';
var BEFORE_OBSERVERS = ':before';
-var guidFor = Ember.guidFor;
-
function changeEvent(keyName) {
return keyName+AFTER_OBSERVERS;
} | true |
Other | emberjs | ember.js | 4fffc17412c126590d1bc4cce8a0620af5d3a419.json | Remove unused variables and helper function | packages/ember-metal/lib/properties.js | @@ -28,7 +28,7 @@ var MANDATORY_SETTER = Ember.ENV.MANDATORY_SETTER;
@private
@constructor
*/
-var Descriptor = Ember.Descriptor = function() {};
+Ember.Descriptor = function() {};
// ..........................................................
// DEFINING PROPERTIES API | true |
Other | emberjs | ember.js | 4fffc17412c126590d1bc4cce8a0620af5d3a419.json | Remove unused variables and helper function | packages/ember-metal/lib/property_events.js | @@ -182,7 +182,7 @@ var endPropertyChanges = Ember.endPropertyChanges = function() {
@param {Function} callback
@param [binding]
*/
-var changeProperties = Ember.changeProperties = function(cb, binding){
+Ember.changeProperties = function(cb, binding){
beginPropertyChanges();
tryFinally(cb, endPropertyChanges, binding);
}; | true |
Other | emberjs | ember.js | 4fffc17412c126590d1bc4cce8a0620af5d3a419.json | Remove unused variables and helper function | packages/ember-metal/lib/utils.js | @@ -90,7 +90,7 @@ Ember.guidFor = function guidFor(obj) {
if (obj === undefined) return "(undefined)";
if (obj === null) return "(null)";
- var cache, ret;
+ var ret;
var type = typeof obj;
// Don't allow prototype changes to String etc. to change the guidFor
@@ -491,7 +491,7 @@ if (needsFinallyFix) {
*/
if (needsFinallyFix) {
Ember.tryCatchFinally = function(tryable, catchable, finalizer, binding) {
- var result, finalResult, finalError, finalReturn;
+ var result, finalResult, finalError;
binding = binding || this;
| true |
Other | emberjs | ember.js | 4fffc17412c126590d1bc4cce8a0620af5d3a419.json | Remove unused variables and helper function | packages/ember-metal/lib/watch_path.js | @@ -33,7 +33,7 @@ Ember.watchPath = function(obj, keyPath) {
};
Ember.unwatchPath = function(obj, keyPath) {
- var m = metaFor(obj), watching = m.watching, desc;
+ var m = metaFor(obj), watching = m.watching;
if (watching[keyPath] === 1) {
watching[keyPath] = 0; | true |
Other | emberjs | ember.js | a8b6e3042244af1dd315e94c9349722450bca301.json | Replace Ember.RunLoop with Backburner.js | packages/ember-application/lib/system/application.js | @@ -463,7 +463,7 @@ var Application = Ember.Application = Ember.Namespace.extend(Ember.DeferredMixin
},
reset: function() {
- Ember.assert('App#reset no longer needs to be wrapped in a run-loop', !Ember.run.currentRunLoop);
+ Ember.assert('App#reset no longer needs to be wrapped in a run-loop', !Ember.run.backburner.currentInstance);
Ember.run(this, function(){
Ember.run(this.__container__, 'destroy');
| true |
Other | emberjs | ember.js | a8b6e3042244af1dd315e94c9349722450bca301.json | Replace Ember.RunLoop with Backburner.js | packages/ember-metal/lib/main.js | @@ -24,4 +24,4 @@ require('ember-metal/events');
require('ember-metal/observer');
require('ember-metal/mixin');
require('ember-metal/binding');
-require('ember-metal/run_loop');
+require('ember-metal/run_loop');
\ No newline at end of file | true |
Other | emberjs | ember.js | a8b6e3042244af1dd315e94c9349722450bca301.json | Replace Ember.RunLoop with Backburner.js | packages/ember-metal/lib/run_loop.js | @@ -1,180 +1,13 @@
-require('ember-metal/core'); // Ember.Logger
-require('ember-metal/watching'); // Ember.watch.flushPending
-require('ember-metal/observer'); // Ember.beginPropertyChanges, Ember.endPropertyChanges
-require('ember-metal/utils'); // Ember.guidFor, Ember.tryFinally
+require('ember-metal/vendor/backburner');
-/**
-@module ember-metal
-*/
-
-// ..........................................................
-// HELPERS
-//
-
-var slice = [].slice,
- forEach = Ember.ArrayPolyfills.forEach;
-
-// invokes passed params - normalizing so you can pass target/func,
-// target/string or just func
-function invoke(target, method, args, ignore) {
-
- if (method === undefined) {
- method = target;
- target = undefined;
- }
-
- if ('string' === typeof method) { method = target[method]; }
- if (args && ignore > 0) {
- args = args.length > ignore ? slice.call(args, ignore) : null;
- }
-
- return Ember.handleErrors(function() {
- // IE8's Function.prototype.apply doesn't accept undefined/null arguments.
- return method.apply(target || this, args || []);
- }, this);
-}
-
-
-// ..........................................................
-// RUNLOOP
-//
-
-/**
-Ember RunLoop (Private)
-
-@class RunLoop
-@namespace Ember
-@private
-@constructor
-*/
-var RunLoop = function(prev) {
- this._prev = prev || null;
- this.onceTimers = {};
-};
-
-RunLoop.prototype = {
- /**
- @method end
- */
- end: function() {
- this.flush();
- },
-
- /**
- @method prev
- */
- prev: function() {
- return this._prev;
- },
-
- // ..........................................................
- // Delayed Actions
- //
-
- /**
- @method schedule
- @param {String} queueName
- @param target
- @param method
- */
- schedule: function(queueName, target, method) {
- var queues = this._queues, queue;
- if (!queues) { queues = this._queues = {}; }
- queue = queues[queueName];
- if (!queue) { queue = queues[queueName] = []; }
-
- var args = arguments.length > 3 ? slice.call(arguments, 3) : null;
- queue.push({ target: target, method: method, args: args });
- return this;
- },
-
- /**
- @method flush
- @param {String} queueName
- */
- flush: function(queueName) {
- var queueNames, idx, len, queue, log;
-
- if (!this._queues) { return this; } // nothing to do
-
- function iter(item) {
- invoke(item.target, item.method, item.args);
- }
-
- function tryable() {
- forEach.call(queue, iter);
- }
-
- Ember.watch.flushPending(); // make sure all chained watchers are setup
-
- if (queueName) {
- while (this._queues && (queue = this._queues[queueName])) {
- this._queues[queueName] = null;
-
- // the sync phase is to allow property changes to propagate. don't
- // invoke observers until that is finished.
- if (queueName === 'sync') {
- log = Ember.LOG_BINDINGS;
- if (log) { Ember.Logger.log('Begin: Flush Sync Queue'); }
-
- Ember.beginPropertyChanges();
-
- Ember.tryFinally(tryable, Ember.endPropertyChanges);
-
- if (log) { Ember.Logger.log('End: Flush Sync Queue'); }
-
- } else {
- forEach.call(queue, iter);
- }
- }
-
- } else {
- queueNames = Ember.run.queues;
- len = queueNames.length;
- idx = 0;
-
- outerloop:
- while (idx < len) {
- queueName = queueNames[idx];
- queue = this._queues && this._queues[queueName];
- delete this._queues[queueName];
-
- if (queue) {
- // the sync phase is to allow property changes to propagate. don't
- // invoke observers until that is finished.
- if (queueName === 'sync') {
- log = Ember.LOG_BINDINGS;
- if (log) { Ember.Logger.log('Begin: Flush Sync Queue'); }
-
- Ember.beginPropertyChanges();
-
- Ember.tryFinally(tryable, Ember.endPropertyChanges);
-
- if (log) { Ember.Logger.log('End: Flush Sync Queue'); }
- } else {
- forEach.call(queue, iter);
- }
- }
-
- // Loop through prior queues
- for (var i = 0; i <= idx; i++) {
- if (this._queues && this._queues[queueNames[i]]) {
- // Start over at the first queue with contents
- idx = i;
- continue outerloop;
- }
- }
-
- idx++;
+var Backburner = requireModule('backburner').Backburner,
+ backburner = new Backburner(['sync', 'actions', 'destroy'], {
+ sync: {
+ before: Ember.beginPropertyChanges,
+ after: Ember.endPropertyChanges
}
- }
-
- return this;
- }
-
-};
-
-Ember.RunLoop = RunLoop;
+ }),
+ slice = [].slice;
// ..........................................................
// Ember.run - this is ideally the only public API the dev sees
@@ -208,20 +41,22 @@ Ember.RunLoop = RunLoop;
@return {Object} return value from invoking the passed function.
*/
Ember.run = function(target, method) {
- var args = arguments;
- run.begin();
-
- function tryable() {
- if (target || method) {
- return invoke(target, method, args, 2);
+ var ret;
+ try {
+ ret = backburner.run.apply(backburner, arguments);
+ } catch (e) {
+ if (Ember.onerror) {
+ Ember.onerror(e);
+ } else {
+ throw e;
}
}
-
- return Ember.tryFinally(tryable, run.end);
+ return ret;
};
-var run = Ember.run;
+Ember.run.backburner = backburner;
+var run = Ember.run;
/**
Begins a new RunLoop. Any deferred actions invoked after the begin will
@@ -238,7 +73,7 @@ var run = Ember.run;
@return {void}
*/
Ember.run.begin = function() {
- run.currentRunLoop = new RunLoop(run.currentRunLoop);
+ backburner.begin();
};
/**
@@ -256,12 +91,7 @@ Ember.run.begin = function() {
@return {void}
*/
Ember.run.end = function() {
- Ember.assert('must have a current run loop', run.currentRunLoop);
-
- function tryable() { run.currentRunLoop.end(); }
- function finalizer() { run.currentRunLoop = run.currentRunLoop.prev(); }
-
- Ember.tryFinally(tryable, finalizer);
+ backburner.end();
};
/**
@@ -274,7 +104,6 @@ Ember.run.end = function() {
@type Array
@default ['sync', 'actions', 'destroy']
*/
-Ember.run.queues = ['sync', 'actions', 'destroy'];
/**
Adds the passed target/method and any optional arguments to the named
@@ -313,57 +142,17 @@ Ember.run.queues = ['sync', 'actions', 'destroy'];
@return {void}
*/
Ember.run.schedule = function(queue, target, method) {
- var loop = run.autorun();
- loop.schedule.apply(loop, arguments);
+ backburner.schedule.apply(backburner, arguments);
};
-var scheduledAutorun;
-function autorun() {
- scheduledAutorun = null;
- if (run.currentRunLoop) { run.end(); }
-}
-
// Used by global test teardown
Ember.run.hasScheduledTimers = function() {
- return !!(scheduledAutorun || scheduledLater);
+ return backburner.hasTimers();
};
// Used by global test teardown
Ember.run.cancelTimers = function () {
- if (scheduledAutorun) {
- clearTimeout(scheduledAutorun);
- scheduledAutorun = null;
- }
- if (scheduledLater) {
- clearTimeout(scheduledLater);
- scheduledLater = null;
- }
- timers = {};
-};
-
-/**
- Begins a new RunLoop if necessary and schedules a timer to flush the
- RunLoop at a later time. This method is used by parts of Ember to
- ensure the RunLoop always finishes. You normally do not need to call this
- method directly. Instead use `Ember.run()`
-
- @method autorun
- @example
- Ember.run.autorun();
- @return {Ember.RunLoop} the new current RunLoop
-*/
-Ember.run.autorun = function() {
- if (!run.currentRunLoop) {
- Ember.assert("You have turned on testing mode, which disabled the run-loop's autorun. You will need to wrap any code with asynchronous side-effects in an Ember.run", !Ember.testing);
-
- run.begin();
-
- if (!scheduledAutorun) {
- scheduledAutorun = setTimeout(autorun, 1);
- }
- }
-
- return run.currentRunLoop;
+ backburner.cancelTimers();
};
/**
@@ -383,59 +172,9 @@ Ember.run.autorun = function() {
@return {void}
*/
Ember.run.sync = function() {
- run.autorun();
- run.currentRunLoop.flush('sync');
+ backburner.currentInstance.queues.sync.flush();
};
-// ..........................................................
-// TIMERS
-//
-
-var timers = {}; // active timers...
-
-function sortByExpires(timerA, timerB) {
- var a = timerA.expires,
- b = timerB.expires;
-
- if (a > b) { return 1; }
- if (a < b) { return -1; }
- return 0;
-}
-
-var scheduledLater, scheduledLaterExpires;
-function invokeLaterTimers() {
- scheduledLater = null;
- run(function() {
- var now = (+ new Date()), earliest = -1;
- var timersToBeInvoked = [];
- for (var key in timers) {
- if (!timers.hasOwnProperty(key)) { continue; }
- var timer = timers[key];
- if (timer && timer.expires) {
- if (now >= timer.expires) {
- delete timers[key];
- timersToBeInvoked.push(timer);
- } else {
- if (earliest < 0 || (timer.expires < earliest)) { earliest = timer.expires; }
- }
- }
- }
-
- forEach.call(timersToBeInvoked.sort(sortByExpires), function(timer) {
- invoke(timer.target, timer.method, timer.args, 2);
- });
-
- // schedule next timeout to fire when the earliest timer expires
- if (earliest > 0) {
- // To allow overwrite `setTimeout` as stub from test code.
- // The assignment to `window.setTimeout` doesn't equal to `setTimeout` in older IE.
- // So `window` is required.
- scheduledLater = window.setTimeout(invokeLaterTimers, earliest - now);
- scheduledLaterExpires = earliest;
- }
- });
-}
-
/**
Invokes the passed target/method and optional arguments after a specified
period if time. The last parameter of this method must always be a number
@@ -463,74 +202,9 @@ function invokeLaterTimers() {
{{#crossLink "Ember/run.cancel"}}{{/crossLink}} later.
*/
Ember.run.later = function(target, method) {
- var args, expires, timer, guid, wait;
-
- // setTimeout compatibility...
- if (arguments.length===2 && 'function' === typeof target) {
- wait = method;
- method = target;
- target = undefined;
- args = [target, method];
- } else {
- args = slice.call(arguments);
- wait = args.pop();
- }
-
- expires = (+ new Date()) + wait;
- timer = { target: target, method: method, expires: expires, args: args };
- guid = Ember.guidFor(timer);
- timers[guid] = timer;
-
- if(scheduledLater && expires < scheduledLaterExpires) {
- // Cancel later timer (then reschedule earlier timer below)
- clearTimeout(scheduledLater);
- scheduledLater = null;
- }
-
- if (!scheduledLater) {
- // Schedule later timers to be run.
- scheduledLater = setTimeout(invokeLaterTimers, wait);
- scheduledLaterExpires = expires;
- }
-
- return guid;
+ return backburner.later.apply(backburner, arguments);
};
-function invokeOnceTimer(guid, onceTimers) {
- if (onceTimers[this.tguid]) { delete onceTimers[this.tguid][this.mguid]; }
- if (timers[guid]) { invoke(this.target, this.method, this.args); }
- delete timers[guid];
-}
-
-function scheduleOnce(queue, target, method, args) {
- var tguid = Ember.guidFor(target),
- mguid = Ember.guidFor(method),
- onceTimers = run.autorun().onceTimers,
- guid = onceTimers[tguid] && onceTimers[tguid][mguid],
- timer;
-
- if (guid && timers[guid]) {
- timers[guid].args = args; // replace args
- } else {
- timer = {
- target: target,
- method: method,
- args: args,
- tguid: tguid,
- mguid: mguid
- };
-
- guid = Ember.guidFor(timer);
- timers[guid] = timer;
- if (!onceTimers[tguid]) { onceTimers[tguid] = {}; }
- onceTimers[tguid][mguid] = guid; // so it isn't scheduled more than once
-
- run.schedule(queue, timer, invokeOnceTimer, guid, onceTimers);
- }
-
- return guid;
-}
-
/**
Schedule a function to run one time during the current RunLoop. This is equivalent
to calling `scheduleOnce` with the "actions" queue.
@@ -544,7 +218,9 @@ function scheduleOnce(queue, target, method, args) {
@return {Object} timer
*/
Ember.run.once = function(target, method) {
- return scheduleOnce('actions', target, method, slice.call(arguments, 2));
+ var args = slice.call(arguments);
+ args.unshift('actions');
+ return backburner.scheduleOnce.apply(backburner, args);
};
/**
@@ -592,12 +268,12 @@ Ember.run.once = function(target, method) {
@return {Object} timer
*/
Ember.run.scheduleOnce = function(queue, target, method) {
- return scheduleOnce(queue, target, method, slice.call(arguments, 3));
+ return backburner.scheduleOnce.apply(backburner, arguments);
};
/**
- Schedules an item to run from within a separate run loop, after
- control has been returned to the system. This is equivalent to calling
+ Schedules an item to run from within a separate run loop, after
+ control has been returned to the system. This is equivalent to calling
`Ember.run.later` with a wait time of 1ms.
```javascript
@@ -609,7 +285,7 @@ Ember.run.scheduleOnce = function(queue, target, method) {
Multiple operations scheduled with `Ember.run.next` will coalesce
into the same later run loop, along with any other operations
scheduled by `Ember.run.later` that expire right around the same
- time that `Ember.run.next` operations will fire.
+ time that `Ember.run.next` operations will fire.
Note that there are often alternatives to using `Ember.run.next`.
For instance, if you'd like to schedule an operation to happen
@@ -635,13 +311,13 @@ Ember.run.scheduleOnce = function(queue, target, method) {
One benefit of the above approach compared to using `Ember.run.next` is
that you will be able to perform DOM/CSS operations before unprocessed
- elements are rendered to the screen, which may prevent flickering or
+ elements are rendered to the screen, which may prevent flickering or
other artifacts caused by delaying processing until after rendering.
- The other major benefit to the above approach is that `Ember.run.next`
- introduces an element of non-determinism, which can make things much
- harder to test, due to its reliance on `setTimeout`; it's much harder
- to guarantee the order of scheduled operations when they are scheduled
+ The other major benefit to the above approach is that `Ember.run.next`
+ introduces an element of non-determinism, which can make things much
+ harder to test, due to its reliance on `setTimeout`; it's much harder
+ to guarantee the order of scheduled operations when they are scheduled
outside of the current run loop, i.e. with `Ember.run.next`.
@method next
@@ -654,8 +330,8 @@ Ember.run.scheduleOnce = function(queue, target, method) {
*/
Ember.run.next = function() {
var args = slice.call(arguments);
- args.push(1); // 1 millisecond wait
- return run.later.apply(this, args);
+ args.push(1);
+ return backburner.later.apply(backburner, args);
};
/**
@@ -684,5 +360,5 @@ Ember.run.next = function() {
@return {void}
*/
Ember.run.cancel = function(timer) {
- delete timers[timer];
+ return backburner.cancel(timer);
}; | true |
Other | emberjs | ember.js | a8b6e3042244af1dd315e94c9349722450bca301.json | Replace Ember.RunLoop with Backburner.js | packages/ember-metal/lib/vendor/backburner.js | @@ -0,0 +1,443 @@
+define("backburner",
+ ["backburner/deferred_action_queues","exports"],
+ function(__dependency1__, __exports__) {
+ "use strict";
+ var DeferredActionQueues = __dependency1__.DeferredActionQueues;
+
+ var slice = [].slice,
+ pop = [].pop,
+ debouncees = [],
+ timers = [],
+ autorun, laterTimer, laterTimerExpiresAt;
+
+ function Backburner(queueNames, options) {
+ this.queueNames = queueNames;
+ this.options = options || {};
+ }
+
+ Backburner.prototype = {
+ queueNames: null,
+ options: null,
+ currentInstance: null,
+ previousInstance: null,
+
+ begin: function() {
+ if (this.currentInstance) {
+ this.previousInstance = this.currentInstance;
+ }
+ this.currentInstance = new DeferredActionQueues(this.queueNames, this.options);
+ },
+
+ end: function() {
+ try {
+ this.currentInstance.flush();
+ } finally {
+ this.currentInstance = null;
+ if (this.previousInstance) {
+ this.currentInstance = this.previousInstance;
+ this.previousInstance = null;
+ }
+ }
+ },
+
+ run: function(target, method /*, args */) {
+ var ret;
+ this.begin();
+
+ if (!method) {
+ method = target;
+ target = null;
+ }
+
+ if (typeof method === 'string') {
+ method = target[method];
+ }
+
+ // Prevent Safari double-finally.
+ var finallyAlreadyCalled = false;
+ try {
+ if (arguments.length > 2) {
+ ret = method.apply(target, slice.call(arguments, 2));
+ } else {
+ ret = method.call(target);
+ }
+ } finally {
+ if (!finallyAlreadyCalled) {
+ finallyAlreadyCalled = true;
+ this.end();
+ }
+ }
+ return ret;
+ },
+
+ defer: function(queueName, target, method /* , args */) {
+ if (!method) {
+ method = target;
+ target = null;
+ }
+
+ if (typeof method === 'string') {
+ method = target[method];
+ }
+
+ var stack = new Error().stack,
+ args = arguments.length > 3 ? slice.call(arguments, 3) : undefined;
+ if (!this.currentInstance) { createAutorun(this); }
+ return this.currentInstance.schedule(queueName, target, method, args, false, stack);
+ },
+
+ deferOnce: function(queueName, target, method /* , args */) {
+ if (!method) {
+ method = target;
+ target = null;
+ }
+
+ if (typeof method === 'string') {
+ method = target[method];
+ }
+
+ var stack = new Error().stack,
+ args = arguments.length > 3 ? slice.call(arguments, 3) : undefined;
+ if (!this.currentInstance) { createAutorun(this); }
+ return this.currentInstance.schedule(queueName, target, method, args, true, stack);
+ },
+
+ setTimeout: function() {
+ var self = this,
+ wait = pop.call(arguments),
+ target = arguments[0],
+ method = arguments[1],
+ executeAt = (+new Date()) + wait;
+
+ if (!method) {
+ method = target;
+ target = null;
+ }
+
+ if (typeof method === 'string') {
+ method = target[method];
+ }
+
+ var fn, args;
+ if (arguments.length > 2) {
+ args = slice.call(arguments, 2);
+
+ fn = function() {
+ method.apply(target, args);
+ };
+ } else {
+ fn = function() {
+ method.call(target);
+ };
+ }
+
+ // find position to insert - TODO: binary search
+ var i, l;
+ for (i = 0, l = timers.length; i < l; i += 2) {
+ if (executeAt < timers[i]) { break; }
+ }
+
+ timers.splice(i, 0, executeAt, fn);
+
+ if (laterTimer && laterTimerExpiresAt < executeAt) { return fn; }
+
+ if (laterTimer) {
+ clearTimeout(laterTimer);
+ laterTimer = null;
+ }
+ laterTimer = setTimeout(function() {
+ executeTimers(self);
+ laterTimer = null;
+ laterTimerExpiresAt = null;
+ }, wait);
+ laterTimerExpiresAt = executeAt;
+
+ return fn;
+ },
+
+ debounce: function(target, method /* , args, wait */) {
+ var self = this,
+ args = arguments,
+ wait = pop.call(args),
+ debouncee;
+
+ for (var i = 0, l = debouncees.length; i < l; i++) {
+ debouncee = debouncees[i];
+ if (debouncee[0] === target && debouncee[1] === method) { return; } // do nothing
+ }
+
+ var timer = setTimeout(function() {
+ self.run.apply(self, args);
+
+ // remove debouncee
+ var index = -1;
+ for (var i = 0, l = debouncees.length; i < l; i++) {
+ debouncee = debouncees[i];
+ if (debouncee[0] === target && debouncee[1] === method) {
+ index = i;
+ break;
+ }
+ }
+
+ if (index > -1) { debouncees.splice(index, 1); }
+ }, wait);
+
+ debouncees.push([target, method, timer]);
+ },
+
+ cancelTimers: function() {
+ for (var i = 0, l = debouncees.length; i < l; i++) {
+ clearTimeout(debouncees[i][2]);
+ }
+ debouncees = [];
+
+ if (laterTimer) {
+ clearTimeout(laterTimer);
+ laterTimer = null;
+ }
+ timers = [];
+
+ if (autorun) { clearTimeout(autorun); }
+ },
+
+ hasTimers: function() {
+ return !!timers.length && !autorun;
+ },
+
+ cancel: function(timer) {
+ if (typeof timer === 'object' && timer.queue && timer.method) { // we're cancelling a deferOnce
+ return timer.queue.cancel(timer);
+ } else if (typeof timer === 'function') { // we're cancelling a setTimeout
+ for (var i = 0, l = timers.length; i < l; i += 2) {
+ if (timers[i + 1] === timer) {
+ timers.splice(i, 2); // remove the two elements
+ return true;
+ }
+ }
+ }
+ }
+ };
+
+ Backburner.prototype.schedule = Backburner.prototype.defer;
+ Backburner.prototype.scheduleOnce = Backburner.prototype.deferOnce;
+ Backburner.prototype.later = Backburner.prototype.setTimeout;
+
+ function createAutorun(backburner) {
+ backburner.begin();
+ autorun = setTimeout(function() {
+ backburner.end();
+ });
+ }
+
+ function executeTimers(self) {
+ var now = +new Date(),
+ time, fns, i, l;
+
+ self.run(function() {
+ // TODO: binary search
+ for (i = 0, l = timers.length; i < l; i += 2) {
+ time = timers[i];
+ if (time > now) { break; }
+ }
+
+ fns = timers.splice(0, i);
+
+ for (i = 1, l = fns.length; i < l; i += 2) {
+ self.schedule(self.queueNames[0], null, fns[i]); // TODO: make default queue configurable
+ }
+ });
+
+ if (timers.length) {
+ laterTimer = setTimeout(function() {
+ executeTimers(self);
+ }, timers[0] - now);
+ laterTimerExpiresAt = timers[0];
+ }
+ }
+
+
+ __exports__.Backburner = Backburner;
+ });
+
+define("backburner/deferred_action_queues",
+ ["backburner/queue","exports"],
+ function(__dependency1__, __exports__) {
+ "use strict";
+ var Queue = __dependency1__.Queue;
+
+ function DeferredActionQueues(queueNames, options) {
+ var queues = this.queues = {};
+ this.queueNames = queueNames = queueNames || [];
+
+ var queueName;
+ for (var i = 0, l = queueNames.length; i < l; i++) {
+ queueName = queueNames[i];
+ queues[queueName] = new Queue(this, queueName, options[queueName]);
+ }
+ }
+
+ DeferredActionQueues.prototype = {
+ queueNames: null,
+ queues: null,
+
+ schedule: function(queueName, target, method, args, onceFlag, stack) {
+ var queues = this.queues,
+ queue = queues[queueName];
+
+ if (!queue) { throw new Error("You attempted to schedule an action in a queue (" + queueName + ") that doesn't exist"); }
+
+ if (onceFlag) {
+ return queue.pushUnique(target, method, args, stack);
+ } else {
+ return queue.push(target, method, args, stack);
+ }
+ },
+
+ flush: function() {
+ var queues = this.queues,
+ queueNames = this.queueNames,
+ queueName, queue, queueItems, priorQueueNameIndex,
+ queueNameIndex = 0, numberOfQueues = queueNames.length;
+
+ outerloop:
+ while (queueNameIndex < numberOfQueues) {
+ queueName = queueNames[queueNameIndex];
+ queue = queues[queueName];
+ queueItems = queue._queue.slice();
+ queue._queue = [];
+
+ var options = queue.options,
+ before = options && options.before,
+ after = options && options.after,
+ target, method, args,
+ queueIndex = 0, numberOfQueueItems = queueItems.length;
+
+ if (numberOfQueueItems && before) { before(); }
+ while (queueIndex < numberOfQueueItems) {
+ target = queueItems[queueIndex];
+ method = queueItems[queueIndex+1];
+ args = queueItems[queueIndex+2];
+
+ if (typeof method === 'string') { method = target[method]; }
+
+ // TODO: error handling
+ if (args && args.length > 0) {
+ method.apply(target, args);
+ } else {
+ method.call(target);
+ }
+
+ queueIndex += 4;
+ }
+ if (numberOfQueueItems && after) { after(); }
+
+ if ((priorQueueNameIndex = indexOfPriorQueueWithActions(this, queueNameIndex)) !== -1) {
+ queueNameIndex = priorQueueNameIndex;
+ continue outerloop;
+ }
+
+ queueNameIndex++;
+ }
+ }
+ };
+
+ function indexOfPriorQueueWithActions(daq, currentQueueIndex) {
+ var queueName, queue;
+
+ for (var i = 0, l = currentQueueIndex; i <= l; i++) {
+ queueName = daq.queueNames[i];
+ queue = daq.queues[queueName];
+ if (queue._queue.length) { return i; }
+ }
+
+ return -1;
+ }
+
+ __exports__.DeferredActionQueues = DeferredActionQueues;
+ });
+
+define("backburner/queue",
+ ["exports"],
+ function(__exports__) {
+ "use strict";
+ function Queue(daq, name, options) {
+ this.daq = daq;
+ this.name = name;
+ this.options = options;
+ this._queue = [];
+ }
+
+ Queue.prototype = {
+ daq: null,
+ name: null,
+ options: null,
+ _queue: null,
+
+ push: function(target, method, args, stack) {
+ var queue = this._queue;
+ queue.push(target, method, args, stack);
+ return {queue: this, target: target, method: method};
+ },
+
+ pushUnique: function(target, method, args, stack) {
+ var queue = this._queue, currentTarget, currentMethod;
+
+ for (var i = 0, l = queue.length; i < l; i += 4) {
+ currentTarget = queue[i];
+ currentMethod = queue[i+1];
+
+ if (currentTarget === target && currentMethod === method) {
+ queue[i+2] = args; // replace args
+ queue[i+3] = stack; // replace stack
+ return {queue: this, target: target, method: method}; // TODO: test this code path
+ }
+ }
+
+ this._queue.push(target, method, args, stack);
+ return {queue: this, target: target, method: method};
+ },
+
+ // TODO: remove me, only being used for Ember.run.sync
+ flush: function() {
+ var queue = this._queue,
+ options = this.options,
+ before = options && options.before,
+ after = options && options.after,
+ action, target, method, args, i, l = queue.length;
+
+ if (l && before) { before(); }
+ for (i = 0; i < l; i += 4) {
+ target = queue[i];
+ method = queue[i+1];
+ args = queue[i+2];
+
+ method.apply(target, args); // TODO: error handling
+ }
+ if (l && after) { after(); }
+
+ // check if new items have been added
+ if (queue.length > l) {
+ this._queue = queue.slice(l);
+ this.flush();
+ } else {
+ this._queue.length = 0;
+ }
+ },
+
+ cancel: function(actionToCancel) {
+ var queue = this._queue, currentTarget, currentMethod, i, l;
+
+ for (i = 0, l = queue.length; i < l; i += 4) {
+ currentTarget = queue[i];
+ currentMethod = queue[i+1];
+
+ if (currentTarget === actionToCancel.target && currentMethod === actionToCancel.method) {
+ queue.splice(i, 4);
+ return true;
+ }
+ }
+ }
+ };
+
+ __exports__.Queue = Queue;
+ });
\ No newline at end of file | true |
Other | emberjs | ember.js | a8b6e3042244af1dd315e94c9349722450bca301.json | Replace Ember.RunLoop with Backburner.js | packages/ember-metal/tests/binding/connect_test.js | @@ -5,7 +5,7 @@ require('ember-metal/~tests/props_helper');
function performTest(binding, a, b, get, set, connect) {
if (connect === undefined) connect = function(){binding.connect(a);};
- ok(!Ember.run.currentRunLoop, 'performTest should not have a currentRunLoop');
+ ok(!Ember.run.backburner.currentInstance, 'performTest should not have a currentRunLoop');
equal(get(a, 'foo'), 'FOO', 'a should not have changed');
equal(get(b, 'bar'), 'BAR', 'b should not have changed'); | true |
Other | emberjs | ember.js | a8b6e3042244af1dd315e94c9349722450bca301.json | Replace Ember.RunLoop with Backburner.js | packages/ember-metal/tests/run_loop/later_test.js | @@ -69,11 +69,11 @@ asyncTest('should always invoke within a separate runloop', function() {
var obj = { invoked: 0 }, firstRunLoop, secondRunLoop;
Ember.run(function() {
- firstRunLoop = Ember.run.currentRunLoop;
+ firstRunLoop = Ember.run.backburner.currentInstance;
Ember.run.later(obj, function(amt) {
this.invoked += amt;
- secondRunLoop = Ember.run.currentRunLoop;
+ secondRunLoop = Ember.run.backburner.currentInstance;
}, 10, 1);
// Synchronous "sleep". This simulates work being done
@@ -88,7 +88,7 @@ asyncTest('should always invoke within a separate runloop', function() {
});
ok(firstRunLoop, "first run loop captured");
- ok(!Ember.run.currentRunLoop, "shouldn't be in a run loop after flush");
+ ok(!Ember.run.backburner.currentInstance, "shouldn't be in a run loop after flush");
equal(obj.invoked, 0, "shouldn't have invoked later item yet");
wait(function() {
@@ -121,7 +121,7 @@ asyncTest('callback order', function() {
asyncTest('callbacks coalesce into same run loop if expiring at the same time', function() {
var array = [];
- function fn(val) { array.push(Ember.run.currentRunLoop); }
+ function fn(val) { array.push(Ember.run.backburner.currentInstance); }
Ember.run(function() {
@@ -154,16 +154,16 @@ asyncTest('inception calls to run.later should run callbacks in separate run loo
var runLoop, finished;
Ember.run(function() {
- runLoop = Ember.run.currentRunLoop;
+ runLoop = Ember.run.backburner.currentInstance;
ok(runLoop);
Ember.run.later(function() {
- ok(Ember.run.currentRunLoop && Ember.run.currentRunLoop !== runLoop,
+ ok(Ember.run.backburner.currentInstance && Ember.run.backburner.currentInstance !== runLoop,
'first later callback has own run loop');
- runLoop = Ember.run.currentRunLoop;
+ runLoop = Ember.run.backburner.currentInstance;
Ember.run.later(function() {
- ok(Ember.run.currentRunLoop && Ember.run.currentRunLoop !== runLoop,
+ ok(Ember.run.backburner.currentInstance && Ember.run.backburner.currentInstance !== runLoop,
'second later callback has own run loop');
finished = true;
}, 40); | true |
Other | emberjs | ember.js | a8b6e3042244af1dd315e94c9349722450bca301.json | Replace Ember.RunLoop with Backburner.js | packages/ember-metal/tests/run_loop/next_test.js | @@ -21,8 +21,8 @@ asyncTest('should invoke immediately on next timeout', function() {
asyncTest('callback should be called from within separate loop', function() {
var firstRunLoop, secondRunLoop;
Ember.run(function() {
- firstRunLoop = Ember.run.currentRunLoop;
- Ember.run.next(function() { secondRunLoop = Ember.run.currentRunLoop; });
+ firstRunLoop = Ember.run.backburner.currentInstance;
+ Ember.run.next(function() { secondRunLoop = Ember.run.backburner.currentInstance; });
});
setTimeout(function() {
@@ -35,9 +35,9 @@ asyncTest('callback should be called from within separate loop', function() {
asyncTest('multiple calls to Ember.run.next share coalesce callbacks into same run loop', function() {
var firstRunLoop, secondRunLoop, thirdRunLoop;
Ember.run(function() {
- firstRunLoop = Ember.run.currentRunLoop;
- Ember.run.next(function() { secondRunLoop = Ember.run.currentRunLoop; });
- Ember.run.next(function() { thirdRunLoop = Ember.run.currentRunLoop; });
+ firstRunLoop = Ember.run.backburner.currentInstance;
+ Ember.run.next(function() { secondRunLoop = Ember.run.backburner.currentInstance; });
+ Ember.run.next(function() { thirdRunLoop = Ember.run.backburner.currentInstance; });
});
setTimeout(function() { | true |
Other | emberjs | ember.js | a8b6e3042244af1dd315e94c9349722450bca301.json | Replace Ember.RunLoop with Backburner.js | packages/ember-metal/tests/run_loop/once_test.js | @@ -48,7 +48,7 @@ test('should be inside of a runloop when running', function() {
Ember.run(function() {
Ember.run.once(function() {
- ok(!!Ember.run.currentRunLoop, 'should have a runloop');
+ ok(!!Ember.run.backburner.currentInstance, 'should have a runloop');
});
});
}); | true |
Other | emberjs | ember.js | a8b6e3042244af1dd315e94c9349722450bca301.json | Replace Ember.RunLoop with Backburner.js | packages/ember-metal/tests/run_loop/schedule_test.js | @@ -35,30 +35,30 @@ test('prior queues should be flushed before moving on to next queue', function()
var order = [];
Ember.run(function() {
- var runLoop = Ember.run.currentRunLoop;
+ var runLoop = Ember.run.backburner.currentInstance;
ok(runLoop, 'run loop present');
Ember.run.schedule('sync', function() {
order.push('sync');
- equal(runLoop, Ember.run.currentRunLoop, 'same run loop used');
+ equal(runLoop, Ember.run.backburner.currentInstance, 'same run loop used');
});
Ember.run.schedule('actions', function() {
order.push('actions');
- equal(runLoop, Ember.run.currentRunLoop, 'same run loop used');
+ equal(runLoop, Ember.run.backburner.currentInstance, 'same run loop used');
Ember.run.schedule('actions', function() {
order.push('actions');
- equal(runLoop, Ember.run.currentRunLoop, 'same run loop used');
+ equal(runLoop, Ember.run.backburner.currentInstance, 'same run loop used');
});
Ember.run.schedule('sync', function() {
order.push('sync');
- equal(runLoop, Ember.run.currentRunLoop, 'same run loop used');
+ equal(runLoop, Ember.run.backburner.currentInstance, 'same run loop used');
});
});
Ember.run.schedule('destroy', function() {
order.push('destroy');
- equal(runLoop, Ember.run.currentRunLoop, 'same run loop used');
+ equal(runLoop, Ember.run.backburner.currentInstance, 'same run loop used');
});
});
| true |
Other | emberjs | ember.js | a8b6e3042244af1dd315e94c9349722450bca301.json | Replace Ember.RunLoop with Backburner.js | packages/ember-metal/tests/run_loop/unwind_test.js | @@ -1,7 +1,7 @@
module('system/run_loop/unwind_test');
test('RunLoop unwinds despite unhandled exception', function() {
- var initialRunLoop = Ember.run.currentRunLoop;
+ var initialRunLoop = Ember.run.backburner.currentInstance;
raises(function(){
Ember.run(function() {
@@ -13,26 +13,26 @@ test('RunLoop unwinds despite unhandled exception', function() {
// tasks into the already-dead runloop, which will never get
// flushed. I can't easily demonstrate this in a unit test because
// autorun explicitly doesn't work in test mode. - ef4
- equal(Ember.run.currentRunLoop, initialRunLoop, "Previous run loop should be cleaned up despite exception");
+ equal(Ember.run.backburner.currentInstance, initialRunLoop, "Previous run loop should be cleaned up despite exception");
// Prevent a failure in this test from breaking subsequent tests.
- Ember.run.currentRunLoop = initialRunLoop;
+ Ember.run.backburner.currentInstance = initialRunLoop;
});
test('Ember.run unwinds despite unhandled exception', function() {
- var initialRunLoop = Ember.run.currentRunLoop;
+ var initialRunLoop = Ember.run.backburner.currentInstance;
raises(function(){
Ember.run(function() {
throw new Error("boom!");
});
}, Error, "boom!");
- equal(Ember.run.currentRunLoop, initialRunLoop, "Previous run loop should be cleaned up despite exception");
+ equal(Ember.run.backburner.currentInstance, initialRunLoop, "Previous run loop should be cleaned up despite exception");
// Prevent a failure in this test from breaking subsequent tests.
- Ember.run.currentRunLoop = initialRunLoop;
+ Ember.run.backburner.currentInstance = initialRunLoop;
});
| true |
Other | emberjs | ember.js | a8b6e3042244af1dd315e94c9349722450bca301.json | Replace Ember.RunLoop with Backburner.js | packages/ember-testing/lib/helpers.js | @@ -49,7 +49,7 @@ function wait(app, value) {
var routerIsLoading = app.__container__.lookup('router:main').router.isLoading;
if (routerIsLoading) { return; }
if (pendingAjaxRequests) { return; }
- if (Ember.run.hasScheduledTimers() || Ember.run.currentRunLoop) { return; }
+ if (Ember.run.hasScheduledTimers() || Ember.run.backburner.currentInstance) { return; }
clearInterval(watcher);
start();
Ember.run(function() {
@@ -64,4 +64,4 @@ helper('visit', visit);
helper('click', click);
helper('fillIn', fillIn);
helper('find', find);
-helper('wait', wait);
\ No newline at end of file
+helper('wait', wait); | true |
Other | emberjs | ember.js | a8b6e3042244af1dd315e94c9349722450bca301.json | Replace Ember.RunLoop with Backburner.js | packages/ember-views/lib/system/ext.js | @@ -6,6 +6,6 @@
// Add a new named queue for rendering views that happens
// after bindings have synced, and a queue for scheduling actions
// that that should occur after view rendering.
-var queues = Ember.run.queues,
+var queues = Ember.run.backburner.queueNames,
indexOf = Ember.ArrayPolyfills.indexOf;
queues.splice(indexOf.call(queues, 'actions')+1, 0, 'render', 'afterRender'); | true |
Other | emberjs | ember.js | 4ab23f79393ed6a143074676e8a79ed5ccea7491.json | Fix Ember.Test.registerHelper test | packages/ember-testing/tests/helpers_test.js | @@ -52,7 +52,7 @@ test("Ember.Application#setupForTesting", function() {
});
test("Ember.Test.registerHelper/unregisterHelper", function() {
- expect(3);
+ expect(5);
var appBooted = false;
Ember.Test.registerHelper('boot', function(app) {
@@ -67,14 +67,17 @@ test("Ember.Test.registerHelper/unregisterHelper", function() {
App.injectTestHelpers();
});
+ ok(App.testHelpers.boot);
ok(window.boot);
window.boot().then(function() {
ok(appBooted);
- });
- App.removeTestHelpers();
- Ember.Test.unregisterHelper('boot');
+ App.removeTestHelpers();
+ Ember.Test.unregisterHelper('boot');
+
+ ok(!App.testHelpers.boot);
+ ok(!window.boot);
+ });
- ok(!window.boot);
}); | false |
Other | emberjs | ember.js | ef48e0fbcad620406bd5201cc6381332ff985ec8.json | Fix code comment at `Ember.TextField`
This property is `onEvent`. | packages/ember-handlebars/lib/controls/text_field.js | @@ -113,7 +113,7 @@ Ember.TextField = Ember.View.extend(Ember.TextSupport,
* `enter`: the user pressed enter
* `keypress`: the user pressed a key
- @property on
+ @property onEvent
@type String
@default enter
*/ | false |
Other | emberjs | ember.js | 816350374b203f24d47b87b98285a243c810a603.json | Fix language type | packages/ember-handlebars/lib/controls/checkbox.js | @@ -23,7 +23,7 @@ var set = Ember.set, get = Ember.get;
You can add a `label` tag yourself in the template where the `Ember.Checkbox`
is being used.
- ```html
+ ```handlebars
<label>
{{view Ember.Checkbox classNames="applicaton-specific-checkbox"}}
Some Title | false |
Other | emberjs | ember.js | c0f74e2614841a75d03a795dd72dd9fadeb9d393.json | Fix warning message
The argument of `Ember.String.fmt` should be an array. | packages/ember-routing/lib/system/route.js | @@ -548,7 +548,7 @@ function parentTemplate(route, isRecursive) {
if (!parent) { return; }
- Ember.warn(fmt("The immediate parent route ('%@') did not render into the main outlet and the default 'into' option ('%@') may not be expected", get(parent, 'routeName'), get(route, 'routeName')), !isRecursive);
+ Ember.warn(fmt("The immediate parent route ('%@') did not render into the main outlet and the default 'into' option ('%@') may not be expected", [get(parent, 'routeName'), get(route, 'routeName')]), !isRecursive);
if (template = parent.lastRenderedTemplate) {
return template; | false |
Other | emberjs | ember.js | 3a55a881c6a911a6ab1d100a0bbfa5d6c482afe1.json | Stop unnecessary `jQuery.fn` extension
I replaced jQeury methods to helper functions. | packages/ember-handlebars/tests/handlebars_test.js | @@ -14,47 +14,41 @@ var firstChild = nthChild;
var originalLog, logCalls;
-(function() {
+var caretPosition = function (element) {
+ var ctrl = element[0];
+ var caretPos = 0;
- Ember.$.fn.caretPosition = function() {
- var ctrl = this[0];
+ // IE Support
+ if (document.selection) {
+ ctrl.focus();
+ var selection = document.selection.createRange();
- var CaretPos = 0;
- // IE Support
- if (document.selection) {
+ selection.moveStart('character', -ctrl.value.length);
- ctrl.focus();
- var Sel = document.selection.createRange ();
-
- Sel.moveStart ('character', -ctrl.value.length);
-
- CaretPos = Sel.text.length;
- }
- // Firefox support
- else if (ctrl.selectionStart || ctrl.selectionStart === '0') {
- CaretPos = ctrl.selectionStart;
- }
-
- return (CaretPos);
- };
-
-
- Ember.$.fn.setCaretPosition = function(pos) {
- var ctrl = this[0];
+ caretPos = selection.text.length;
+ }
+ // Firefox support
+ else if (ctrl.selectionStart || ctrl.selectionStart === '0') {
+ caretPos = ctrl.selectionStart;
+ }
- if(ctrl.setSelectionRange) {
- ctrl.focus();
- ctrl.setSelectionRange(pos,pos);
- } else if (ctrl.createTextRange) {
- var range = ctrl.createTextRange();
- range.collapse(true);
- range.moveEnd('character', pos);
- range.moveStart('character', pos);
- range.select();
- }
- };
+ return caretPos;
+};
-})();
+var setCaretPosition = function (element, pos) {
+ var ctrl = element[0];
+
+ if (ctrl.setSelectionRange) {
+ ctrl.focus();
+ ctrl.setSelectionRange(pos,pos);
+ } else if (ctrl.createTextRange) {
+ var range = ctrl.createTextRange();
+ range.collapse(true);
+ range.moveEnd('character', pos);
+ range.moveStart('character', pos);
+ range.select();
+ }
+};
var view;
@@ -1505,13 +1499,13 @@ test("should not reset cursor position when text field receives keyUp event", fu
});
view.$().val('Brosiedoon, King of the Brocean');
- view.$().setCaretPosition(5);
+ setCaretPosition(view.$(), 5);
Ember.run(function() {
view.trigger('keyUp', {});
});
- equal(view.$().caretPosition(), 5, "The keyUp event should not result in the cursor being reset due to the bindAttr observers");
+ equal(caretPosition(view.$()), 5, "The keyUp event should not result in the cursor being reset due to the bindAttr observers");
Ember.run(function() {
view.destroy(); | false |
Other | emberjs | ember.js | 933fd07cdefa6f997061061a9943b83436c71e3b.json | Use helper function
`append` is defined for append `checkboxView` to '#qunit-fixture'. | packages/ember-handlebars/tests/controls/checkbox_test.js | @@ -190,7 +190,7 @@ test("checked property mirrors input value", function() {
test("checking the checkbox updates the value", function() {
checkboxView = Ember.Checkbox.create({ checked: true });
- Ember.run(function() { checkboxView.appendTo('#qunit-fixture'); });
+ append();
equal(get(checkboxView, 'checked'), true, "precond - initially starts with a true value");
equal(!!checkboxView.$().prop('checked'), true, "precond - the initial checked property is true"); | false |
Other | emberjs | ember.js | 1e86986a930c61c912effe0a62fa659f7ada15f7.json | Add onInjectHelpers method | packages/ember-testing/lib/helpers.js | @@ -2,7 +2,20 @@ require('ember-testing/test');
var Promise = Ember.RSVP.Promise,
get = Ember.get,
- helper = Ember.Test.registerHelper;
+ helper = Ember.Test.registerHelper,
+ pendingAjaxRequests = 0;
+
+
+Ember.Test.onInjectHelpers(function() {
+ Ember.$(document).ajaxStart(function() {
+ pendingAjaxRequests++;
+ });
+
+ Ember.$(document).ajaxStop(function() {
+ pendingAjaxRequests--;
+ });
+});
+
function visit(app, url) {
Ember.run(app, app.handleURL, url);
@@ -34,7 +47,7 @@ function wait(app, value) {
var watcher = setInterval(function() {
var routerIsLoading = app.__container__.lookup('router:main').router.isLoading;
if (routerIsLoading) { return; }
- if (Ember.Test.pendingAjaxRequests) { return; }
+ if (pendingAjaxRequests) { return; }
if (Ember.run.hasScheduledTimers() || Ember.run.currentRunLoop) { return; }
clearInterval(watcher);
start(); | true |
Other | emberjs | ember.js | 1e86986a930c61c912effe0a62fa659f7ada15f7.json | Add onInjectHelpers method | packages/ember-testing/lib/test.js | @@ -1,6 +1,7 @@
var slice = [].slice,
helpers = {},
- originalMethods = {};
+ originalMethods = {},
+ injectHelpersCallbacks = [];
/**
@class Test
@@ -53,6 +54,7 @@ Ember.Test = {
helpers[name] = helperMethod;
},
/**
+ @public
@method unregisterHelper
@param name {String}
*/
@@ -64,7 +66,21 @@ Ember.Test = {
delete originalMethods[name];
},
- pendingAjaxRequests: 0
+ /**
+ @public
+
+ Used to register callbacks to be fired
+ whenever `App.injectTestHelpers` is called
+
+ The callback will receive the current application
+ as an argument.
+
+ @method unregisterHelper
+ @param name {String}
+ */
+ onInjectHelpers: function(callback) {
+ injectHelpersCallbacks.push(callback);
+ }
};
@@ -90,19 +106,14 @@ Ember.Application.reopen({
injectTestHelpers: function() {
this.testHelpers = {};
-
- Ember.$(document).ajaxStart(function() {
- Ember.Test.pendingAjaxRequests++;
- });
-
- Ember.$(document).ajaxStop(function() {
- Ember.Test.pendingAjaxRequests--;
- });
-
for (var name in helpers) {
originalMethods[name] = window[name];
this.testHelpers[name] = window[name] = curry(this, helpers[name]);
}
+
+ for(var i = 0, l = injectHelpersCallbacks.length; i < l; i++) {
+ injectHelpersCallbacks[i](this);
+ }
},
removeTestHelpers: function() { | true |
Other | emberjs | ember.js | 79aefff9b875026e3925a8a4a2a7b9dfe07a4f0f.json | Create Ember.Test with registerHelper method | packages/ember-testing/lib/helpers.js | @@ -1,10 +1,8 @@
-/*globals EMBER_APP_BEING_TESTED */
+require('ember-testing/test');
var Promise = Ember.RSVP.Promise,
- pendingAjaxRequests = 0,
- originalFind,
- slice = [].slice,
- get = Ember.get;
+ get = Ember.get,
+ helper = Ember.Test.registerHelper;
function visit(app, url) {
Ember.run(app, app.handleURL, url);
@@ -36,7 +34,7 @@ function wait(app, value) {
var watcher = setInterval(function() {
var routerIsLoading = app.__container__.lookup('router:main').router.isLoading;
if (routerIsLoading) { return; }
- if (pendingAjaxRequests) { return; }
+ if (Ember.Test.pendingAjaxRequests) { return; }
if (Ember.run.hasScheduledTimers() || Ember.run.currentRunLoop) { return; }
clearInterval(watcher);
start();
@@ -47,46 +45,9 @@ function wait(app, value) {
});
}
-function curry(app, fn) {
- return function() {
- var args = slice.call(arguments);
- args.unshift(app);
- return fn.apply(app, args);
- };
-}
-
-Ember.Application.reopen({
- setupForTesting: function() {
- this.deferReadiness();
-
- this.Router.reopen({
- location: 'none'
- });
- },
-
- injectTestHelpers: function() {
- Ember.$(document).ajaxStart(function() {
- pendingAjaxRequests++;
- });
-
- Ember.$(document).ajaxStop(function() {
- pendingAjaxRequests--;
- });
-
- // todo do this safer.
- window.visit = curry(this, visit);
- window.click = curry(this, click);
- window.fillIn = curry(this, fillIn);
- originalFind = window.find;
- window.find = curry(this, find);
- window.wait = curry(this, wait);
- },
-
- removeTestHelpers: function() {
- window.visit = null;
- window.click = null;
- window.fillIn = null;
- window.wait = null;
- window.find = originalFind;
- }
-});
+// expose these methods as test helpers
+helper('visit', visit);
+helper('click', click);
+helper('fillIn', fillIn);
+helper('find', find);
+helper('wait', wait);
\ No newline at end of file | true |
Other | emberjs | ember.js | 79aefff9b875026e3925a8a4a2a7b9dfe07a4f0f.json | Create Ember.Test with registerHelper method | packages/ember-testing/lib/main.js | @@ -1,2 +1,3 @@
require('ember-application');
+require('ember-testing/test');
require('ember-testing/helpers');
\ No newline at end of file | true |
Other | emberjs | ember.js | 79aefff9b875026e3925a8a4a2a7b9dfe07a4f0f.json | Create Ember.Test with registerHelper method | packages/ember-testing/lib/test.js | @@ -0,0 +1,115 @@
+var slice = [].slice,
+ helpers = {},
+ originalMethods = {};
+
+/**
+ @class Test
+ @namespace Ember
+*/
+Ember.Test = {
+
+ /**
+ @public
+
+ `registerHelper` is used to register a
+ test helper that will be injected when
+ `App.injectTestHelpers` is called.
+
+ The helper method will always be called
+ with the current Application as the first
+ parameter.
+
+ For example:
+ ```javascript
+ Ember.Test.registerHelper('boot', function(app)) {
+ Ember.run(app, app.deferReadiness);
+ }
+ ```
+
+ This helper can later be called without arguments
+ because it will be called with `app` as the
+ first parameter.
+
+ ```javascript
+ App = Ember.Application.create();
+ App.injectTestHelpers();
+ boot();
+ ```
+
+ Whenever you register a helper that
+ performs async operations,
+ make sure you `return wait();` at the
+ end of the helper.
+
+ If an async helper also needs to return a value,
+ pass it to the `wait` helper as a first argument:
+ `return wait(val);`
+
+ @method registerHelper
+ @param name {String}
+ @param helperMethod {Function}
+ */
+ registerHelper: function(name, helperMethod) {
+ helpers[name] = helperMethod;
+ },
+ /**
+ @method unregisterHelper
+ @param name {String}
+ */
+ unregisterHelper: function(name) {
+ delete helpers[name];
+ if (originalMethods[name]) {
+ window[name] = originalMethods[name];
+ }
+ delete originalMethods[name];
+ },
+
+ pendingAjaxRequests: 0
+};
+
+
+function curry(app, fn) {
+ return function() {
+ var args = slice.call(arguments);
+ args.unshift(app);
+ return fn.apply(app, args);
+ };
+}
+
+
+Ember.Application.reopen({
+ testHelpers: {},
+
+ setupForTesting: function() {
+ this.deferReadiness();
+
+ this.Router.reopen({
+ location: 'none'
+ });
+ },
+
+ injectTestHelpers: function() {
+ this.testHelpers = {};
+
+ Ember.$(document).ajaxStart(function() {
+ Ember.Test.pendingAjaxRequests++;
+ });
+
+ Ember.$(document).ajaxStop(function() {
+ Ember.Test.pendingAjaxRequests--;
+ });
+
+ for (var name in helpers) {
+ originalMethods[name] = window[name];
+ this.testHelpers[name] = window[name] = curry(this, helpers[name]);
+ }
+ },
+
+ removeTestHelpers: function() {
+ for (var name in helpers) {
+ window[name] = originalMethods[name];
+ delete this.testHelpers[name];
+ delete originalMethods[name];
+ }
+ }
+}); | true |
Other | emberjs | ember.js | 79aefff9b875026e3925a8a4a2a7b9dfe07a4f0f.json | Create Ember.Test with registerHelper method | packages/ember-testing/tests/helpers_test.js | @@ -11,24 +11,35 @@ module("ember-testing", {
test("Ember.Application#injectTestHelpers/#removeTestHelpers", function() {
App = Ember.run(Ember.Application, Ember.Application.create);
ok(!window.visit);
+ ok(!App.testHelpers.visit);
ok(!window.click);
+ ok(!App.testHelpers.click);
ok(!window.fillIn);
+ ok(!App.testHelpers.fillIn);
ok(!window.wait);
+ ok(!App.testHelpers.wait);
App.injectTestHelpers();
ok(window.visit);
+ ok(App.testHelpers.visit);
ok(window.click);
+ ok(App.testHelpers.click);
ok(window.fillIn);
- ok(window.find);
+ ok(App.testHelpers.fillIn);
ok(window.wait);
+ ok(App.testHelpers.wait);
App.removeTestHelpers();
ok(!window.visit);
+ ok(!App.testHelpers.visit);
ok(!window.click);
+ ok(!App.testHelpers.click);
ok(!window.fillIn);
+ ok(!App.testHelpers.fillIn);
ok(!window.wait);
+ ok(!App.testHelpers.wait);
});
test("Ember.Application#setupForTesting", function() {
@@ -39,3 +50,31 @@ test("Ember.Application#setupForTesting", function() {
equal(App.__container__.lookup('router:main').location.implementation, 'none');
});
+
+test("Ember.Test.registerHelper/unregisterHelper", function() {
+ expect(3);
+ var appBooted = false;
+
+ Ember.Test.registerHelper('boot', function(app) {
+ Ember.run(app, app.advanceReadiness);
+ appBooted = true;
+ return window.wait();
+ });
+
+ Ember.run(function() {
+ App = Ember.Application.create();
+ App.setupForTesting();
+ App.injectTestHelpers();
+ });
+
+ ok(window.boot);
+
+ window.boot().then(function() {
+ ok(appBooted);
+ });
+
+ App.removeTestHelpers();
+ Ember.Test.unregisterHelper('boot');
+
+ ok(!window.boot);
+}); | true |
Other | emberjs | ember.js | f7245ee05c288dbce94a6540af6222baa4a3f674.json | Remove duplicated test. | packages/ember-handlebars/tests/helpers/each_test.js | @@ -416,17 +416,6 @@ test("#each accepts a name binding and can display child properties", function()
equal(view.$().text(), "My Cool Each Test 1My Cool Each Test 2");
});
-test("#each accepts 'this' as the right hand side", function() {
- view = Ember.View.create({
- template: templateFor("{{#each item in this}}{{view.title}} {{item.name}}{{/each}}"),
- title: "My Cool Each Test",
- controller: Ember.A([{ name: 1 }, { name: 2 }])
- });
-
- append(view);
-
- equal(view.$().text(), "My Cool Each Test 1My Cool Each Test 2");
-});
test("#each accepts 'this' as the right hand side", function() {
view = Ember.View.create({
template: templateFor("{{#each item in this}}{{view.title}} {{item.name}}{{/each}}"), | false |
Other | emberjs | ember.js | bc47ba53b499a968db1c7eae019b36769fa5e922.json | Remove unused helper function
`setAndFlush` is defined but not used. | packages/ember-handlebars/tests/controls/select_test.js | @@ -18,12 +18,6 @@ module("Ember.Select", {
}
});
-function setAndFlush(view, key, value) {
- Ember.run(function() {
- Ember.set(view, key, value);
- });
-}
-
function append() {
Ember.run(function() {
select.appendTo('#qunit-fixture'); | false |
Other | emberjs | ember.js | d7bcbf0628d6b177ea854ba7a9b274b4295caff1.json | Fix CollectionView.arrayDidChange documentation
CollectionView.arrayDidChange arguments have changed wihout
documentation changes. This commit fixes this method documentation. | packages/ember-views/lib/views/collection_view.js | @@ -288,9 +288,10 @@ Ember.CollectionView = Ember.ContainerView.extend(
This array observer is added in `contentDidChange`.
@method arrayDidChange
- @param {Array} addedObjects the objects that were added to the content
- @param {Array} removedObjects the objects that were removed from the content
- @param {Number} changeIndex the index at which the changes occurred
+ @param {Array} content the managed collection of objects
+ @param {Number} start the index at which the changes occurred
+ @param {Number} removed number of object removed from content
+ @param {Number} added number of object added to content
*/
arrayDidChange: function(content, start, removed, added) {
var itemViewClass = get(this, 'itemViewClass'), | false |
Other | emberjs | ember.js | 3c6dd5271cd4380a515c714edfbf7ca60f652445.json | Add test for visit helper in ember testing | packages/ember-testing/tests/helpers_test.js | @@ -37,4 +37,48 @@ test("Ember.Application#setupForTesting", function() {
equal(App.__container__.lookup('router:main').location.implementation, 'none');
equal(window.EMBER_APP_BEING_TESTED, App);
-});
\ No newline at end of file
+});
+
+test("visit transitions to the correct route", function() {
+ expect(2);
+
+ var visit, currentRoute;
+
+ Ember.run(function() {
+ App = Ember.Application.create();
+ App.setupForTesting();
+ });
+
+ App.injectTestHelpers();
+ visit = window.visit;
+
+ App.Router.map(function() {
+ this.route('posts');
+ this.route('comments');
+ });
+
+ App.PostsRoute = Ember.Route.extend({
+ renderTemplate: function() {
+ currentRoute = 'posts';
+ }
+ });
+
+ App.CommentsRoute = Ember.Route.extend({
+ renderTemplate: function() {
+ currentRoute = 'comments';
+ }
+ });
+
+ Ember.run(App, App.advanceReadiness);
+
+ currentRoute = 'index';
+
+ visit('/posts').then(function() {
+ equal(currentRoute, 'posts', "Successfully visited posts route");
+ return visit('/comments');
+ }).then(function() {
+ equal(currentRoute, 'comments', "visit can be chained");
+ });
+
+ App.removeTestHelpers();
+}); | false |
Other | emberjs | ember.js | 849e6e5248a91f96c95b6242fd1ef1ea16d9e625.json | Update route-recognizer - Fixes #2559 | packages/ember-routing/lib/vendor/route-recognizer.js | @@ -373,14 +373,14 @@ define("route-recognizer",
},
recognize: function(path) {
- var states = [ this.rootState ], i, l;
+ var states = [ this.rootState ],
+ pathLen, i, l;
// DEBUG GROUP path
- var pathLen = path.length;
-
if (path.charAt(0) !== "/") { path = "/" + path; }
+ pathLen = path.length;
if (pathLen > 1 && path.charAt(pathLen - 1) === "/") {
path = path.substr(0, pathLen - 1);
} | false |
Other | emberjs | ember.js | 0e4873d1710a0546711c7b052027cbe417fd8ebb.json | prevent exception on empty Em.Select content | packages/ember-handlebars/lib/controls/select.js | @@ -472,7 +472,7 @@ Ember.Select = Ember.View.extend(
content = get(this, 'content'),
prompt = get(this, 'prompt');
- if (!get(content, 'length')) { return; }
+ if (!content || !get(content, 'length')) { return; }
if (prompt && selectedIndex === 0) { set(this, 'selection', null); return; }
if (prompt) { selectedIndex -= 1; } | false |
Other | emberjs | ember.js | 05bcbd58e72921d3f944a3f7ffc30f60f082ce46.json | fix some typos in the test names | packages/ember-views/tests/views/view/append_to_test.js | @@ -14,7 +14,7 @@ module("Ember.View - append() and appendTo()", {
}
});
-test("should be added to the specified element when calling append()", function() {
+test("should be added to the specified element when calling appendTo()", function() {
Ember.$("#qunit-fixture").html('<div id="menu"></div>');
view = View.create();
@@ -29,7 +29,7 @@ test("should be added to the specified element when calling append()", function(
ok(viewElem.length > 0, "creates and appends the view's element");
});
-test("should be added to the document body when calling appendTo()", function() {
+test("should be added to the document body when calling append()", function() {
view = View.create({
render: function(buffer) {
buffer.push("foo bar baz"); | false |
Other | emberjs | ember.js | 7be8024dcd65c3c8a49f06df0a6452c1641a4d14.json | Add tests to deferred mixin | packages/ember-runtime/tests/mixins/deferred_test.js | @@ -12,7 +12,7 @@ test("can resolve deferred", function() {
});
Ember.run(function() {
- deferred.resolve();
+ deferred.resolve(deferred);
});
equal(count, 1, "was fulfilled");
@@ -52,7 +52,7 @@ test("can resolve with then", function() {
});
Ember.run(function() {
- deferred.resolve();
+ deferred.resolve(deferred);
});
equal(count1, 1, "then were resolved");
@@ -94,9 +94,9 @@ test("can call resolve multiple times", function() {
});
Ember.run(function() {
- deferred.resolve();
- deferred.resolve();
- deferred.resolve();
+ deferred.resolve(deferred);
+ deferred.resolve(deferred);
+ deferred.resolve(deferred);
});
equal(count, 1, "calling resolve multiple times has no effect");
@@ -116,7 +116,7 @@ test("resolve prevent reject", function() {
});
Ember.run(function() {
- deferred.resolve();
+ deferred.resolve(deferred);
});
Ember.run(function() {
@@ -144,7 +144,7 @@ test("reject prevent resolve", function() {
deferred.reject();
});
Ember.run(function() {
- deferred.resolve();
+ deferred.resolve(deferred);
});
equal(resolved, false, "is not resolved");
@@ -194,8 +194,96 @@ test("then is chainable", function() {
});
Ember.run(function() {
- deferred.resolve();
+ deferred.resolve(deferred);
});
equal(count, 1, "chained callback was called");
});
+
+
+test("can self fulfill", function() {
+ expect(1);
+ var deferred;
+
+ Ember.run(function() {
+ deferred = Ember.Object.createWithMixins(Ember.DeferredMixin);
+ });
+
+ deferred.then(function(value) {
+ equal(value, deferred, "successfully resolved to itself");
+ });
+
+ Ember.run(function() {
+ deferred.resolve(deferred);
+ });
+});
+
+
+
+test("can fulfill to a custom value", function() {
+ expect(1);
+ var deferred, obj = {};
+
+ Ember.run(function() {
+ deferred = Ember.Object.createWithMixins(Ember.DeferredMixin);
+ });
+
+ deferred.then(function(value) {
+ equal(value, obj, "successfully resolved to given value");
+ });
+
+ Ember.run(function() {
+ deferred.resolve(obj);
+ });
+});
+
+
+test("can chain self fulfilling objects", function() {
+ expect(2);
+ var firstDeferred, secondDeferred;
+
+ Ember.run(function() {
+ firstDeferred = Ember.Object.createWithMixins(Ember.DeferredMixin);
+ secondDeferred = Ember.Object.createWithMixins(Ember.DeferredMixin);
+ });
+
+ firstDeferred.then(function(value) {
+ equal(value, firstDeferred, "successfully resolved to the first deferred");
+ return secondDeferred;
+ })
+ .then(function(value) {
+ equal(value, secondDeferred, "successfully resolved to the second deferred");
+ });
+
+ Ember.run(function() {
+ firstDeferred.resolve(firstDeferred);
+ secondDeferred.resolve(secondDeferred);
+ });
+});
+
+test("can do multi level assimilation", function() {
+ expect(1);
+ var firstDeferred, secondDeferred, firstDeferredResolved = false;
+
+ Ember.run(function() {
+ firstDeferred = Ember.Object.createWithMixins(Ember.DeferredMixin);
+ secondDeferred = Ember.Object.createWithMixins(Ember.DeferredMixin);
+ });
+
+ firstDeferred.then(function() {
+ firstDeferredResolved = true;
+ });
+
+ secondDeferred.then(function() {
+ ok(firstDeferredResolved, "first deferred already resolved");
+ });
+
+ Ember.run(function() {
+ secondDeferred.resolve(firstDeferred);
+ });
+
+ Ember.run(function() {
+ firstDeferred.resolve(firstDeferred);
+ });
+});
+ | false |
Other | emberjs | ember.js | 24e00ebd62535f638d4d8533d03f2c7a7d6445ba.json | Normalize Ember.Handlebars.helper hashes | packages/ember-handlebars-compiler/lib/main.js | @@ -37,6 +37,7 @@ Ember.Handlebars.helper = function(name, value) {
if (Ember.View.detect(value)) {
Ember.Handlebars.registerHelper(name, function(options) {
Ember.assert("You can only pass attributes as parameters to a application-defined helper", arguments.length < 3);
+ options.hash = Ember.Handlebars.resolveHash(options.hash);
return Ember.Handlebars.helpers.view.call(this, value, options);
});
} else { | false |
Other | emberjs | ember.js | a035ae76d303fad9747a16f747f2e51f2e327935.json | Fix bug with Ember.Handlebars.helper
When used to create a dyanmic tag | packages/ember-handlebars-compiler/lib/main.js | @@ -35,7 +35,7 @@ Ember.Handlebars = objectCreate(Handlebars);
Ember.Handlebars.helper = function(name, value) {
if (Ember.View.detect(value)) {
- Ember.Handlebars.registerHelper(name, function(name, options) {
+ Ember.Handlebars.registerHelper(name, function(options) {
Ember.assert("You can only pass attributes as parameters to a application-defined helper", arguments.length < 3);
return Ember.Handlebars.helpers.view.call(this, value, options);
}); | false |
Other | emberjs | ember.js | 3f8bc3245cb07f49223111b6c33c6241014a23bd.json | clarify input documentation | packages/ember-handlebars/lib/controls.js | @@ -15,7 +15,7 @@ function normalizeHash(hash, hashTypes) {
/**
* `{{input}}` inserts a new instance of either Ember.TextField or
- * Ember.Checkbox, depending on the `inputType` passed in. If no `inputType`
+ * Ember.Checkbox, depending on the `type` option passed in. If no `type`
* is supplied it defaults to Ember.TextField.
*
* @method input | false |
Other | emberjs | ember.js | 174bc158d79148dea5445db75c7ca785fd2cca6b.json | Move linkTo docs to helper instead of LinkView | packages/ember-routing/lib/helpers/link_to.js | @@ -38,6 +38,66 @@ Ember.onLoad('Ember.Handlebars', function(Handlebars) {
return ret.concat(resolvedPaths(linkView.parameters));
}
+ /**
+ @class LinkView
+ @namespace Ember
+ @extends Ember.View
+ **/
+ var LinkView = Ember.LinkView = Ember.View.extend({
+ tagName: 'a',
+ namedRoute: null,
+ currentWhen: null,
+ title: null,
+ activeClass: 'active',
+ replace: false,
+ attributeBindings: ['href', 'title'],
+ classNameBindings: 'active',
+
+ // Even though this isn't a virtual view, we want to treat it as if it is
+ // so that you can access the parent with {{view.prop}}
+ concreteView: Ember.computed(function() {
+ return get(this, 'parentView');
+ }).property('parentView'),
+
+ active: Ember.computed(function() {
+ var router = this.get('router'),
+ params = resolvedPaths(this.parameters),
+ currentWithIndex = this.currentWhen + '.index',
+ isActive = router.isActive.apply(router, [this.currentWhen].concat(params)) ||
+ router.isActive.apply(router, [currentWithIndex].concat(params));
+
+ if (isActive) { return get(this, 'activeClass'); }
+ }).property('namedRoute', 'router.url'),
+
+ router: Ember.computed(function() {
+ return this.get('controller').container.lookup('router:main');
+ }),
+
+ click: function(event) {
+ if (!isSimpleClick(event)) { return true; }
+
+ event.preventDefault();
+ if (this.bubbles === false) { event.stopPropagation(); }
+
+ var router = this.get('router');
+
+ if (this.get('replace')) {
+ router.replaceWith.apply(router, args(this, router));
+ } else {
+ router.transitionTo.apply(router, args(this, router));
+ }
+ },
+
+ href: Ember.computed(function() {
+ if (this.get('tagName') !== 'a') { return false; }
+
+ var router = this.get('router');
+ return router.generate.apply(router, args(this, router));
+ })
+ });
+
+ LinkView.toString = function() { return "LinkView"; };
+
/**
The `{{linkTo}}` helper renders a link to the supplied
`routeName` passing an optionally supplied model to the
@@ -57,12 +117,12 @@ Ember.onLoad('Ember.Handlebars', function(Handlebars) {
</a>
```
- ## Supplying a tagName
- By default `{{linkTo}} renders an `<a>` element. This can
+ ### Supplying a tagName
+ By default `{{linkTo}}` renders an `<a>` element. This can
be overridden for a single use of `{{linkTo}}` by supplying
a `tagName` option:
- ```
+ ```handlebars
{{#linkTo photoGallery tagName="li"}}
Great Hamster Photos
{{/linkTo}}
@@ -77,21 +137,21 @@ Ember.onLoad('Ember.Handlebars', function(Handlebars) {
To override this option for your entire application, see
"Overriding Application-wide Defaults".
- ## Handling `href`
+ ### Handling `href`
`{{linkTo}}` will use your application's Router to
fill the element's `href` property with a url that
matches the path to the supplied `routeName` for your
routers's configured `Location` scheme, which defaults
to Ember.HashLocation.
- ## Handling current route
+ ### Handling current route
`{{linkTo}}` will apply a CSS class name of 'active'
when the application's current route matches
the supplied routeName. For example, if the application's
current route is 'photoGallery.recent' the following
use of `{{linkTo}}`:
- ```
+ ```handlebars
{{#linkTo photoGallery.recent}}
Great Hamster Photos from the last week
{{/linkTo}}
@@ -109,7 +169,7 @@ Ember.onLoad('Ember.Handlebars', function(Handlebars) {
for a single use of `{{linkTo}}` by passing an `activeClass`
option:
- ```
+ ```handlebars
{{#linkTo photoGallery.recent activeClass="current-url"}}
Great Hamster Photos from the last week
{{/linkTo}}
@@ -124,7 +184,7 @@ Ember.onLoad('Ember.Handlebars', function(Handlebars) {
To override this option for your entire application, see
"Overriding Application-wide Defaults".
- ## Supplying a model
+ ### Supplying a model
An optional model argument can be used for routes whose
paths contain dynamic segments. This argument will become
the model context of the linked route:
@@ -147,7 +207,7 @@ Ember.onLoad('Ember.Handlebars', function(Handlebars) {
</a>
```
- ## Supplying multiple models
+ ### Supplying multiple models
For deep-linking to route paths that contain multiple
dynamic segments, multiple model arguments can be used.
As the router transitions through the route path, each
@@ -175,7 +235,7 @@ Ember.onLoad('Ember.Handlebars', function(Handlebars) {
</a>
```
- ## Overriding Application-wide Defaults
+ ### Overriding Application-wide Defaults
``{{linkTo}}`` creates an instance of Ember.LinkView
for rendering. To override options for your entire
application, reopen Ember.LinkView and supply the
@@ -187,67 +247,7 @@ Ember.onLoad('Ember.Handlebars', function(Handlebars) {
tagName: 'li'
})
```
-
- @class LinkView
- @namespace Ember
- @extends Ember.View
- **/
- var LinkView = Ember.LinkView = Ember.View.extend({
- tagName: 'a',
- namedRoute: null,
- currentWhen: null,
- title: null,
- activeClass: 'active',
- replace: false,
- attributeBindings: ['href', 'title'],
- classNameBindings: 'active',
-
- // Even though this isn't a virtual view, we want to treat it as if it is
- // so that you can access the parent with {{view.prop}}
- concreteView: Ember.computed(function() {
- return get(this, 'parentView');
- }).property('parentView'),
-
- active: Ember.computed(function() {
- var router = this.get('router'),
- params = resolvedPaths(this.parameters),
- currentWithIndex = this.currentWhen + '.index',
- isActive = router.isActive.apply(router, [this.currentWhen].concat(params)) ||
- router.isActive.apply(router, [currentWithIndex].concat(params));
-
- if (isActive) { return get(this, 'activeClass'); }
- }).property('namedRoute', 'router.url'),
-
- router: Ember.computed(function() {
- return this.get('controller').container.lookup('router:main');
- }),
-
- click: function(event) {
- if (!isSimpleClick(event)) { return true; }
- event.preventDefault();
- if (this.bubbles === false) { event.stopPropagation(); }
-
- var router = this.get('router');
-
- if (this.get('replace')) {
- router.replaceWith.apply(router, args(this, router));
- } else {
- router.transitionTo.apply(router, args(this, router));
- }
- },
-
- href: Ember.computed(function() {
- if (this.get('tagName') !== 'a') { return false; }
-
- var router = this.get('router');
- return router.generate.apply(router, args(this, router));
- })
- });
-
- LinkView.toString = function() { return "LinkView"; };
-
- /**
@method linkTo
@for Ember.Handlebars.helpers
@param {String} routeName | false |
Other | emberjs | ember.js | fa627f4421e8b665fc32dca8350a2649103a94eb.json | Switch assertion for simulated Ember.create
The object created by simulated `Ember.create` has many property.
So `deepEqual` couldn't be used for its' assertion. | packages/ember-routing/tests/helpers/control_test.js | @@ -215,7 +215,12 @@ if (Ember.ENV.EXPERIMENTAL_CONTROL_HELPER) {
var childController = view.get('childViews').objectAt(0).get('controller');
ok(view.$().text().match(/^.*Tom Dale.*$/), "The view rendered");
- deepEqual(childController.get('model'), { name: "Tom Dale" });
+
+ if (Ember.create.isSimulated) {
+ equal(childController.get('model').name, "Tom Dale");
+ } else {
+ deepEqual(childController.get('model'), { name: "Tom Dale" });
+ }
Ember.run(function() {
controller.set('model', { name: "Yehuda Katz" }); | true |
Other | emberjs | ember.js | fa627f4421e8b665fc32dca8350a2649103a94eb.json | Switch assertion for simulated Ember.create
The object created by simulated `Ember.create` has many property.
So `deepEqual` couldn't be used for its' assertion. | packages/ember-routing/tests/helpers/render_test.js | @@ -118,7 +118,11 @@ test("{{render}} helper should render given template with a supplied model", fun
set(controller, 'post', { title: "Rails is unagi" });
equal(view.$().text(), 'HIRails is unagi');
- deepEqual(postController.get('model'), { title: "Rails is unagi" });
+ if (Ember.create.isSimulated) {
+ equal(postController.get('model').title, "Rails is unagi");
+ } else {
+ deepEqual(postController.get('model'), { title: "Rails is unagi" });
+ }
});
test("{{render}} helper should render with given controller", function() {
@@ -192,7 +196,11 @@ test("{{render}} helper should render templates with models multiple times", fun
set(controller, 'post1', { title: "I am new" });
equal(view.$().text(), 'HI I am new Then me');
- deepEqual(postController1.get('model'), { title: "I am new" });
+ if (Ember.create.isSimulated) {
+ equal(postController1.get('model').title, "I am new");
+ } else {
+ deepEqual(postController1.get('model'), { title: "I am new" });
+ }
});
test("{{render}} helper should render templates both with and without models", function() {
@@ -230,7 +238,11 @@ test("{{render}} helper should render templates both with and without models", f
set(controller, 'post', { title: "Rails is unagi" });
equal(view.$().text(), 'HI Title: Title:Rails is unagi');
- deepEqual(postController2.get('model'), { title: "Rails is unagi" });
+ if (Ember.create.isSimulated) {
+ equal(postController2.get('model').title, "Rails is unagi");
+ } else {
+ deepEqual(postController2.get('model'), { title: "Rails is unagi" });
+ }
});
test("{{render}} helper should link child controllers to the parent controller", function() { | true |
Other | emberjs | ember.js | 1b06211af6ed18c0ea4582c77902d9ad68fb62d0.json | Use stub `Object.create` for IE8
It couldn't treat property descripters. | packages/ember-metal/lib/platform.js | @@ -24,6 +24,13 @@ var platform = Ember.platform = {};
*/
Ember.create = Object.create;
+// IE8 has Object.create but it couldn't treat property descripters.
+if (Ember.create) {
+ if (Ember.create({a: 1}, {a: {value: 2}}).a !== 2) {
+ Ember.create = null;
+ }
+}
+
// STUB_OBJECT_CREATE allows us to override other libraries that stub
// Object.create different than we would prefer
if (!Ember.create || Ember.ENV.STUB_OBJECT_CREATE) { | false |
Other | emberjs | ember.js | 9ba85b860c2ec691891bdc6b61b8d205d699c646.json | Include ember-testing in full build | Assetfile | @@ -4,8 +4,8 @@ distros = {
"runtime" => %w(ember-metal rsvp container ember-runtime),
"template-compiler" => %w(ember-handlebars-compiler),
"data-deps" => %w(ember-metal rsvp container ember-runtime ember-states),
- "full" => %w(ember-metal rsvp container ember-runtime ember-views metamorph handlebars ember-handlebars-compiler ember-handlebars ember-routing ember-application ember-states),
- "old-router" => %w(ember-metal rsvp container ember-runtime ember-views ember-states ember-viewstates metamorph handlebars ember-handlebars-compiler ember-handlebars ember-old-router )
+ "full" => %w(ember-metal rsvp container ember-runtime ember-views metamorph handlebars ember-handlebars-compiler ember-handlebars ember-routing ember-application ember-states ember-testing),
+ "old-router" => %w(ember-metal rsvp container ember-runtime ember-views ember-states ember-viewstates metamorph handlebars ember-handlebars-compiler ember-handlebars ember-old-router)
}
class AddMicroLoader < Rake::Pipeline::Filter | false |
Other | emberjs | ember.js | f870e8e98d3c09297388fd7e7e5424456e20cd22.json | fix failing tests for outerHTML fallback | packages/ember-views/lib/system/render_buffer.js | @@ -454,8 +454,11 @@ Ember._RenderBuffer.prototype =
string: function() {
if (this._hasElement && this._element) {
// Firefox versions < 11 do not have support for element.outerHTML.
- return this.element().outerHTML ||
- new XMLSerializer().serializeToString(this.element());
+ var thisElement = this.element(), outerHTML = thisElement.outerHTML;
+ if (typeof outerHTML === 'undefined'){
+ return Ember.$('<div/>').append(thisElement).html();
+ }
+ return outerHTML;
} else {
return this.innerString();
} | true |
Other | emberjs | ember.js | f870e8e98d3c09297388fd7e7e5424456e20cd22.json | fix failing tests for outerHTML fallback | packages/ember-views/tests/system/render_buffer_test.js | @@ -93,7 +93,7 @@ test("handles browsers like Firefox < 11 that don't support outerHTML Issue #195
// Make sure element.outerHTML is falsy to trigger the fallback.
var elementStub = '<div></div>';
buffer.element = function(){ return elementStub; };
- equal(new XMLSerializer().serializeToString(elementStub), buffer.string());
+ equal(elementStub, buffer.string());
});
module("Ember.RenderBuffer - without tagName"); | true |
Other | emberjs | ember.js | 2b389b43fb792cea18249f6598f4bcb81181767a.json | Fix method comments | packages/ember-runtime/lib/controllers/array_controller.js | @@ -126,9 +126,9 @@ Ember.ArrayController = Ember.ArrayProxy.extend(Ember.ControllerMixin,
});
```
- @method
- @type String
- @default null
+ @method lookupItemController
+ @param {Object} object
+ @return {String}
*/
lookupItemController: function(object) {
return get(this, 'itemController'); | true |
Other | emberjs | ember.js | 2b389b43fb792cea18249f6598f4bcb81181767a.json | Fix method comments | packages/ember-runtime/lib/system/native_array.js | @@ -117,9 +117,8 @@ if (ignore.length>0) {
@namespace Ember
@extends Ember.Mixin
@uses Ember.MutableArray
- @uses Ember.MutableEnumerable
+ @uses Ember.Observable
@uses Ember.Copyable
- @uses Ember.Freezable
*/
Ember.NativeArray = NativeArray;
| true |
Other | emberjs | ember.js | 81f55a1045800fd37a3249b3b6d95b6b7d02e9bb.json | Eliminate unused variables
I used jshint with '"unused": true' option. | packages/container/lib/main.js | @@ -238,7 +238,7 @@ define("container",
var factory = factoryFor(container, fullName);
var splitName = fullName.split(":"),
- type = splitName[0], name = splitName[1],
+ type = splitName[0],
value;
if (option(container, fullName, 'instantiate') === false) { | true |
Other | emberjs | ember.js | 81f55a1045800fd37a3249b3b6d95b6b7d02e9bb.json | Eliminate unused variables
I used jshint with '"unused": true' option. | packages/ember-handlebars/lib/ext.js | @@ -336,7 +336,7 @@ function evaluateMultiPropertyBoundHelper(context, fn, normalizedProperties, opt
bindView = new Ember._SimpleHandlebarsView(null, null, !hash.unescaped, data);
bindView.normalizedValue = function() {
- var args = [], value, boundOption;
+ var args = [], boundOption;
// Copy over bound options.
for (boundOption in boundOptions) { | true |
Other | emberjs | ember.js | 81f55a1045800fd37a3249b3b6d95b6b7d02e9bb.json | Eliminate unused variables
I used jshint with '"unused": true' option. | packages/ember-handlebars/lib/helpers/collection.js | @@ -181,8 +181,6 @@ Ember.Handlebars.registerHelper('collection', function(path, options) {
}
}
- var tagName = hash.tagName || collectionPrototype.tagName;
-
if (fn) {
itemHash.template = fn;
delete options.fn;
@@ -204,8 +202,6 @@ Ember.Handlebars.registerHelper('collection', function(path, options) {
itemHash._context = Ember.computed.alias('content');
}
- var viewString = view.toString();
-
var viewOptions = Ember.Handlebars.ViewHelper.propertiesFromHTMLOptions({ data: data, hash: itemHash }, this);
hash.itemViewClass = itemViewClass.extend(viewOptions);
| true |
Other | emberjs | ember.js | 81f55a1045800fd37a3249b3b6d95b6b7d02e9bb.json | Eliminate unused variables
I used jshint with '"unused": true' option. | packages/ember-handlebars/lib/helpers/view.js | @@ -116,11 +116,8 @@ EmberHandlebars.ViewHelper = Ember.Object.create({
},
helper: function(thisContext, path, options) {
- var inverse = options.inverse,
- data = options.data,
- view = data.view,
+ var data = options.data,
fn = options.fn,
- hash = options.hash,
newView;
if ('string' === typeof path) {
@@ -134,7 +131,7 @@ EmberHandlebars.ViewHelper = Ember.Object.create({
var viewOptions = this.propertiesFromHTMLOptions(options, thisContext);
var currentView = data.view;
- viewOptions.templateData = options.data;
+ viewOptions.templateData = data;
var newViewProto = newView.proto ? newView.proto() : newView;
if (fn) { | true |
Other | emberjs | ember.js | 81f55a1045800fd37a3249b3b6d95b6b7d02e9bb.json | Eliminate unused variables
I used jshint with '"unused": true' option. | packages/ember-metal/lib/chains.js | @@ -75,7 +75,6 @@ function isProto(pvalue) {
// value for the key then the node won't actually watch it. For a root node
// pass null for parent and key and object for value.
var ChainNode = Ember._ChainNode = function(parent, key, value) {
- var obj;
this._parent = parent;
this._key = key;
| true |
Other | emberjs | ember.js | 81f55a1045800fd37a3249b3b6d95b6b7d02e9bb.json | Eliminate unused variables
I used jshint with '"unused": true' option. | packages/ember-metal/lib/computed.js | @@ -699,7 +699,6 @@ Ember.computed.alias = function(dependentKey) {
*/
Ember.computed.defaultTo = function(defaultPath) {
return Ember.computed(function(key, newValue, cachedValue) {
- var result;
if (arguments.length === 1) {
return cachedValue != null ? cachedValue : get(this, defaultPath);
} | true |
Other | emberjs | ember.js | 81f55a1045800fd37a3249b3b6d95b6b7d02e9bb.json | Eliminate unused variables
I used jshint with '"unused": true' option. | packages/ember-metal/lib/property_set.js | @@ -5,8 +5,6 @@ require('ember-metal/property_events'); // propertyWillChange, propertyDidChange
var META_KEY = Ember.META_KEY,
MANDATORY_SETTER = Ember.ENV.MANDATORY_SETTER,
IS_GLOBAL = /^([A-Z$]|([0-9][A-Z$]))/,
- propertyWillChange = Ember.propertyWillChange,
- propertyDidChange = Ember.propertyDidChange,
getPath = Ember._getPath;
/** | true |
Other | emberjs | ember.js | 81f55a1045800fd37a3249b3b6d95b6b7d02e9bb.json | Eliminate unused variables
I used jshint with '"unused": true' option. | packages/ember-old-router/lib/router.js | @@ -10,15 +10,6 @@ require('ember-metal/utils'); // Ember.tryFinally
var get = Ember.get, set = Ember.set;
-var merge = function(original, hash) {
- for (var prop in hash) {
- if (!hash.hasOwnProperty(prop)) { continue; }
- if (original.hasOwnProperty(prop)) { continue; }
-
- original[prop] = hash[prop];
- }
-};
-
/**
`Ember.Router` is the subclass of `Ember.StateManager` responsible for
providing URL-based application state detection. The `Ember.Router` instance | true |
Other | emberjs | ember.js | 81f55a1045800fd37a3249b3b6d95b6b7d02e9bb.json | Eliminate unused variables
I used jshint with '"unused": true' option. | packages/ember-routing/lib/vendor/router.js | @@ -68,8 +68,7 @@ define("router",
@return {Array} an Array of `[handler, parameter]` tuples
*/
handleURL: function(url) {
- var results = this.recognizer.recognize(url),
- objects = [];
+ var results = this.recognizer.recognize(url);
if (!results) {
throw new Error("No route matched the URL '" + url + "'");
@@ -238,7 +237,7 @@ define("router",
var contexts = [].slice.call(arguments, 1);
var currentHandlerInfos = this.currentHandlerInfos,
- found = false, names, object, handlerInfo, handlerObj;
+ found = false, object, handlerInfo;
for (var i=currentHandlerInfos.length-1; i>=0; i--) {
handlerInfo = currentHandlerInfos[i]; | true |
Other | emberjs | ember.js | 81f55a1045800fd37a3249b3b6d95b6b7d02e9bb.json | Eliminate unused variables
I used jshint with '"unused": true' option. | packages/ember-views/lib/views/view.js | @@ -1309,7 +1309,7 @@ Ember.View = Ember.CoreView.extend(
@param {Ember.RenderBuffer} buffer
*/
_applyAttributeBindings: function(buffer, attributeBindings) {
- var attributeValue, elem, type;
+ var attributeValue, elem;
a_forEach(attributeBindings, function(binding) {
var split = binding.split(':'),
@@ -2030,7 +2030,6 @@ Ember.View = Ember.CoreView.extend(
*/
destroy: function() {
var childViews = this._childViews,
- parent = this._parentView,
// get parentView before calling super because it'll be destroyed
nonVirtualParentView = get(this, 'parentView'),
viewName = this.viewName, | true |
Other | emberjs | ember.js | 7bb81ad97fdb0904373e43148d52abe53ccaa8cb.json | Add missing item type
YUIDoc shows the some warnings for `Missing item type`. | packages/ember-application/lib/system/application.js | @@ -656,6 +656,7 @@ Ember.Application.reopenClass({
This allows the application to register default injections in the container
that could be overridden by the normal naming convention.
+ @method resolverFor
@param {Ember.Namespace} namespace the namespace to look for classes
@return {*} the resolved value for a given lookup
*/ | true |
Other | emberjs | ember.js | 7bb81ad97fdb0904373e43148d52abe53ccaa8cb.json | Add missing item type
YUIDoc shows the some warnings for `Missing item type`. | packages/ember-handlebars/lib/ext.js | @@ -319,6 +319,7 @@ Ember.Handlebars.registerBoundHelper = function(name, fn) {
Renders the unbound form of an otherwise bound helper function.
+ @method evaluateMultiPropertyBoundHelper
@param {Function} fn
@param {Object} context
@param {Array} normalizedProperties
@@ -380,6 +381,7 @@ function evaluateMultiPropertyBoundHelper(context, fn, normalizedProperties, opt
Renders the unbound form of an otherwise bound helper function.
+ @method evaluateUnboundHelper
@param {Function} fn
@param {Object} context
@param {Array} normalizedProperties | true |
Other | emberjs | ember.js | 7bb81ad97fdb0904373e43148d52abe53ccaa8cb.json | Add missing item type
YUIDoc shows the some warnings for `Missing item type`. | packages/ember-routing/lib/system/route.js | @@ -172,6 +172,8 @@ Ember.Route = Ember.Object.extend({
@private
Called when the context is changed by router.js.
+
+ @method contextDidChange
*/
contextDidChange: function() {
this.currentModel = this.context; | true |
Other | emberjs | ember.js | 7993f8cdbee02eabd55328c8d1cef29a0a5aa2e5.json | Fix method comment about arguments | packages/ember-runtime/lib/system/string.js | @@ -48,7 +48,8 @@ Ember.String = {
```
@method fmt
- @param {Object...} [args]
+ @param {String} str The string to format
+ @param {Array} formats An array of parameters to interpolate into string.
@return {String} formatted string
*/
fmt: function(str, formats) { | false |
Other | emberjs | ember.js | 06bae5ad65bfcbf1c375bb79f40307bd55536b0e.json | fix a typo in {{bindAttr}} doc | packages/ember-handlebars/lib/helpers/binding.js | @@ -419,7 +419,7 @@ EmberHandlebars.registerHelper('unless', function(context, options) {
Results in the following rendered output:
```html
- <img class=":class-name-to-always-apply">
+ <img class="class-name-to-always-apply">
```
All three strategies - string return value, boolean return value, and | false |
Other | emberjs | ember.js | b86b0a23467158850c97f6bd04f2a9e990de647a.json | Remove unused argument from helper functions | packages/ember-metal/lib/computed.js | @@ -38,7 +38,7 @@ var get = Ember.get,
This function returns a map of unique dependencies for a
given object and key.
*/
-function keysForDep(obj, depsMeta, depKey) {
+function keysForDep(depsMeta, depKey) {
var keys = depsMeta[depKey];
if (!keys) {
// if there are no dependencies yet for a the given key
@@ -52,8 +52,8 @@ function keysForDep(obj, depsMeta, depKey) {
return keys;
}
-function metaForDeps(obj, meta) {
- return keysForDep(obj, meta, 'deps');
+function metaForDeps(meta) {
+ return keysForDep(meta, 'deps');
}
function addDependentKeys(desc, obj, keyName, meta) {
@@ -62,12 +62,12 @@ function addDependentKeys(desc, obj, keyName, meta) {
var depKeys = desc._dependentKeys, depsMeta, idx, len, depKey, keys;
if (!depKeys) return;
- depsMeta = metaForDeps(obj, meta);
+ depsMeta = metaForDeps(meta);
for(idx = 0, len = depKeys.length; idx < len; idx++) {
depKey = depKeys[idx];
// Lookup keys meta for depKey
- keys = keysForDep(obj, depsMeta, depKey);
+ keys = keysForDep(depsMeta, depKey);
// Increment the number of times depKey depends on keyName.
keys[keyName] = (keys[keyName] || 0) + 1;
// Watch the depKey
@@ -81,12 +81,12 @@ function removeDependentKeys(desc, obj, keyName, meta) {
var depKeys = desc._dependentKeys, depsMeta, idx, len, depKey, keys;
if (!depKeys) return;
- depsMeta = metaForDeps(obj, meta);
+ depsMeta = metaForDeps(meta);
for(idx = 0, len = depKeys.length; idx < len; idx++) {
depKey = depKeys[idx];
// Lookup keys meta for depKey
- keys = keysForDep(obj, depsMeta, depKey);
+ keys = keysForDep(depsMeta, depKey);
// Increment the number of times depKey depends on keyName.
keys[keyName] = (keys[keyName] || 0) - 1;
// Watch the depKey | false |
Other | emberjs | ember.js | 6c446205090966f6838cdd1576e677aadf64411f.json | Use isNone to check tag name | packages/ember-views/lib/views/view.js | @@ -127,7 +127,7 @@ Ember.CoreView = Ember.Object.extend(Ember.Evented, {
// insert a new buffer after the "parent buffer").
var tagName = this.tagName;
- if (tagName === null || tagName === undefined) {
+ if (Ember.isNone(tagName)) {
tagName = 'div';
}
| false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.