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 | 28a16f2b56584c7a786b85e393606aeb23d58802.json | fix typo in computed_macros.js
change 'provied' to 'provided' to improve API doc readability. | packages/ember-metal/lib/computed_macros.js | @@ -258,7 +258,7 @@ registerComputed('equal', function(dependentKey, value) {
});
/**
- A computed property that returns true if the provied dependent property
+ A computed property that returns true if the provided dependent property
is greater than the provided value.
Example | false |
Other | emberjs | ember.js | 85dd050c40c1458616c004dc0098123e03bd4ec4.json | Update morph and use new DOM Helper APIs | bower.json | @@ -11,6 +11,6 @@
"rsvp": "https://github.com/tildeio/rsvp.js.git#3.0.13",
"router.js": "https://github.com/tildeio/router.js.git#1562462f120156a140b9153bf36f1046f85e7812",
"route-recognizer": "https://github.com/tildeio/route-recognizer.git#8e1058e29de741b8e05690c69da9ec402a167c69",
- "htmlbars": "https://github.com/tildeio/htmlbars.git#7889d3f4d2a979f8e32648c92afa033f1f32b434"
+ "htmlbars": "https://github.com/tildeio/htmlbars.git#6582d5584146c657dc61de8f5c5d00438d0e248d"
}
} | true |
Other | emberjs | ember.js | 85dd050c40c1458616c004dc0098123e03bd4ec4.json | Update morph and use new DOM Helper APIs | packages/ember-metal-views/lib/renderer.js | @@ -132,12 +132,7 @@ Renderer.prototype.scheduleInsert =
Renderer.prototype.appendTo =
function Renderer_appendTo(view, target) {
- // TODO use dom helper for creating this morph.
- var start = document.createTextNode('');
- var end = document.createTextNode('');
- target.appendChild(start);
- target.appendChild(end);
- var morph = this._dom.createMorph(target, start, end);
+ var morph = this._dom.appendMorph(target);
this.scheduleInsert(view, morph);
};
| true |
Other | emberjs | ember.js | 85dd050c40c1458616c004dc0098123e03bd4ec4.json | Update morph and use new DOM Helper APIs | packages/ember-views/lib/system/render_buffer.js | @@ -231,15 +231,11 @@ _RenderBuffer.prototype = {
var el = this._element;
for (var i=0,l=childViews.length; i<l; i++) {
var childView = childViews[i];
- var morphId = '#morph-'+i;
- var ref = el.querySelector(morphId);
+ var ref = el.querySelector('#morph-'+i);
var parent = ref.parentNode;
- var start = document.createTextNode('');
- var end = document.createTextNode('');
- parent.insertBefore(start, ref);
- parent.insertBefore(end, ref);
+
+ childView._morph = this.dom.insertMorphBefore(parent, ref);
parent.removeChild(ref);
- childView._morph = this.dom.createMorph(parent, start, end);
}
},
| true |
Other | emberjs | ember.js | 85dd050c40c1458616c004dc0098123e03bd4ec4.json | Update morph and use new DOM Helper APIs | packages/ember-views/lib/system/renderer.js | @@ -48,11 +48,7 @@ EmberRenderer.prototype.createChildViewsMorph =
view._childViewsMorph = view._morph;
} else {
element = document.createDocumentFragment();
- var start = document.createTextNode('');
- var end = document.createTextNode('');
- element.appendChild(start);
- element.appendChild(end);
- view._childViewsMorph = this._dom.createMorph(element, start, end);
+ view._childViewsMorph = this._dom.appendMorph(element);
}
} else {
view._childViewsMorph = this._dom.createMorph(element, element.lastChild, null); | true |
Other | emberjs | ember.js | 47d00139ee7285a640930e9dbad3096ead8bd398.json | Update Morph to latest version.
Compare view:
https://github.com/tildeio/htmlbars/compare/1a4d5985824f4df23bb6e78829e442fe368937aa...7889d3f4d2a979f8e32648c92afa033f1f32b434
This includes some perf fixes by Stef to allow Morph's constructor to be
inlineable. | bower.json | @@ -11,6 +11,6 @@
"rsvp": "https://github.com/tildeio/rsvp.js.git#3.0.13",
"router.js": "https://github.com/tildeio/router.js.git#1562462f120156a140b9153bf36f1046f85e7812",
"route-recognizer": "https://github.com/tildeio/route-recognizer.git#8e1058e29de741b8e05690c69da9ec402a167c69",
- "htmlbars": "https://github.com/tildeio/htmlbars.git#1a4d5985824f4df23bb6e78829e442fe368937aa"
+ "htmlbars": "https://github.com/tildeio/htmlbars.git#7889d3f4d2a979f8e32648c92afa033f1f32b434"
}
} | false |
Other | emberjs | ember.js | d0052ac58ea7045c1bc5b1190bd8225c42deb2c7.json | Remove dead code and polyfill for containsElement. | packages/ember-views/lib/views/states/pre_render.js | @@ -1,5 +1,3 @@
-/* global Node */
-
import _default from "ember-views/views/states/default";
import { create } from "ember-metal/platform";
import merge from "ember-metal/merge";
@@ -11,21 +9,4 @@ import jQuery from "ember-views/system/jquery";
*/
var preRender = create(_default);
-var containsElement;
-if (typeof Node === 'object') {
- containsElement = Node.prototype.contains;
-
- if (!containsElement && Node.prototype.compareDocumentPosition) {
- // polyfill for older Firefox.
- // http://compatibility.shwups-cms.ch/en/polyfills/?&id=52
- containsElement = function(node){
- return !!(this.compareDocumentPosition(node) & 16);
- };
- }
-} else {
- containsElement = function(element) {
- return this.contains(element);
- };
-}
-
export default preRender; | false |
Other | emberjs | ember.js | f9eee1f2939fe07f4fccf13571c64b965bcd5300.json | Multiline variable declarations | packages/ember-metal/lib/utils.js | @@ -357,7 +357,8 @@ export function setMeta(obj, property, value) {
*/
export function metaPath(obj, path, writable) {
Ember.deprecate("Ember.metaPath is deprecated and will be removed from future releases.");
- var _meta = meta(obj, writable), keyName, value;
+ var _meta = meta(obj, writable);
+ var keyName, value;
for (var i=0, l=path.length; i<l; i++) {
keyName = path[i];
@@ -392,7 +393,8 @@ export function metaPath(obj, path, writable) {
*/
export function wrap(func, superFunc) {
function superWrapper() {
- var ret, sup = this && this.__nextSuper;
+ var ret;
+ var sup = this && this.__nextSuper;
if(this) { this.__nextSuper = superFunc; }
ret = apply(this, func, arguments);
if(this) { this.__nextSuper = sup; }
@@ -797,7 +799,8 @@ export function inspect(obj) {
return obj + '';
}
- var v, ret = [];
+ var v;
+ var ret = [];
for(var key in obj) {
if (obj.hasOwnProperty(key)) {
v = obj[key]; | false |
Other | emberjs | ember.js | f3d41537475b44c5f7880dc48d6b0da53b810e0d.json | Remove publishing on failure.
All tests passing no need to publish on failure. | .travis.yml | @@ -10,8 +10,7 @@ cache:
install:
- "npm install"
- "./bin/generate_docs.js"
-after_failure:
- - "./bin/bower_ember_build"
+
after_success:
- "./bin/publish_to_s3.js"
- "./bin/bower_ember_build" | false |
Other | emberjs | ember.js | f959c8d9664ea53a8fca1ba74aa8ff575db7c2c6.json | Update more tests for ember-metal-views
* Fix test that prior rendering of a subtree doesn’t allow rerender until it is actually inserted if the root view is or will be inserted
* Fix odd test that doesn’t really make sense anymore as it is calling a private API that is going away. | packages/ember-metal-views/lib/renderer.js | @@ -18,8 +18,10 @@ function Renderer_renderTree(_view, _parentView, _insertAt) {
var total = 1;
var levelBase = _parentView ? _parentView._level+1 : 0;
- // if root view && view has a _morph assigned or _parentView._elementInserted
- var willInsert = _parentView == null ? !!_view._morph : _parentView._elementInserted;
+ var root = _parentView == null ? _view : _parentView._root;
+
+ // if root view has a _morph assigned
+ var willInsert = !!root._morph;
var queue = this._queue;
queue[0] = 0;
@@ -40,6 +42,7 @@ function Renderer_renderTree(_view, _parentView, _insertAt) {
// ensure props we add are in same order
view._morph = null;
}
+ view._root = root;
this.uuid(view);
view._level = levelBase + level;
if (view._elementCreated) { | true |
Other | emberjs | ember.js | f959c8d9664ea53a8fca1ba74aa8ff575db7c2c6.json | Update more tests for ember-metal-views
* Fix test that prior rendering of a subtree doesn’t allow rerender until it is actually inserted if the root view is or will be inserted
* Fix odd test that doesn’t really make sense anymore as it is calling a private API that is going away. | packages/ember-views/lib/system/renderer.js | @@ -5,17 +5,10 @@ import run from "ember-metal/run_loop";
import { set } from "ember-metal/property_set";
function EmberRenderer() {
- EmberRenderer.super.call(this);
+ Renderer.call(this);
}
-EmberRenderer.super = Renderer;
-EmberRenderer.prototype = Object.create(Renderer.prototype, {
- constructor: {
- value: EmberRenderer,
- enumerable: false,
- writable: true,
- configurable: true
- }
-});
+EmberRenderer.prototype = create(Renderer.prototype);
+EmberRenderer.prototype.constructor = EmberRenderer;
var BAD_TAG_NAME_TEST_REGEXP = /[^a-zA-Z0-9\-]/;
var BAD_TAG_NAME_REPLACE_REGEXP = /[^a-zA-Z0-9\-]/g;
@@ -103,7 +96,11 @@ EmberRenderer.prototype.createElement =
}
view.buffer = null;
- set(view, 'element', element);
+ if (element && element.nodeType === 1) {
+ // We have hooks, we shouldn't make element observable
+ // consider just doing view.element = element
+ set(view, 'element', element);
+ }
return element;
};
@@ -135,14 +132,14 @@ Renderer.prototype.didInsertElement = function (view) {
}
if (view.trigger) { view.trigger('didInsertElement'); }
}; // inDOM // placed into DOM
-Renderer.prototype.willRemoveElement = function (view) {
- // removed from DOM willDestroyElement currently paired with didInsertElement
- if (view.trigger) { view.trigger('willDestroyElement'); }
-};
+
+Renderer.prototype.willRemoveElement = function (view) {};
+
Renderer.prototype.willDestroyElement = function (view) {
- // willClearRender (currently balanced with render) this is now paired with createElement
+ if (view.trigger) { view.trigger('willDestroyElement'); }
if (view.trigger) { view.trigger('willClearRender'); }
};
+
Renderer.prototype.didDestroyElement = function (view) {
set(view, 'element', null);
if (view._transitionTo) { | true |
Other | emberjs | ember.js | f959c8d9664ea53a8fca1ba74aa8ff575db7c2c6.json | Update more tests for ember-metal-views
* Fix test that prior rendering of a subtree doesn’t allow rerender until it is actually inserted if the root view is or will be inserted
* Fix odd test that doesn’t really make sense anymore as it is calling a private API that is going away. | packages/ember-views/lib/views/states/has_element.js | @@ -31,6 +31,9 @@ merge(hasElement, {
// once the view has been inserted into the DOM, rerendering is
// deferred to allow bindings to synchronize.
rerender: function(view) {
+ if (view._root._morph && !view._elementInserted) {
+ throw new EmberError("Something you did caused a view to re-render after it rendered but before it was inserted into the DOM.");
+ }
// TODO: should be scheduled with renderer
run.scheduleOnce('render', function () {
if (view.isDestroying) return; | true |
Other | emberjs | ember.js | f959c8d9664ea53a8fca1ba74aa8ff575db7c2c6.json | Update more tests for ember-metal-views
* Fix test that prior rendering of a subtree doesn’t allow rerender until it is actually inserted if the root view is or will be inserted
* Fix odd test that doesn’t really make sense anymore as it is calling a private API that is going away. | packages/ember-views/tests/views/view/child_views_test.js | @@ -4,7 +4,7 @@ import run from "ember-metal/run_loop";
import EmberView from "ember-views/views/view";
-var parentView, childView, childViews;
+var parentView, childView;
QUnit.module('tests/views/view/child_views_tests.js', {
setup: function() {
@@ -25,8 +25,6 @@ QUnit.module('tests/views/view/child_views_tests.js', {
parentView.destroy();
childView.destroy();
});
-
- childViews = null;
}
});
@@ -42,7 +40,7 @@ test("should render an inserted child view when the child is inserted before a D
equal(parentView.$().text(), 'Ember', 'renders the child view after the parent view');
});
-test("should not duplicate childViews when rerendering in buffer", function() {
+test("should not duplicate childViews when rerendering", function() {
var Inner = EmberView.extend({
template: function() { return ''; }
@@ -66,16 +64,14 @@ test("should not duplicate childViews when rerendering in buffer", function() {
});
run(function() {
- outer.renderToBuffer();
+ outer.append();
});
equal(outer.get('middle.childViews.length'), 2, 'precond middle has 2 child views rendered to buffer');
- raises(function() {
- run(function() {
- outer.middle.rerender();
- });
- }, /Something you did caused a view to re-render after it rendered but before it was inserted into the DOM./);
+ run(function() {
+ outer.middle.rerender();
+ });
equal(outer.get('middle.childViews.length'), 2, 'middle has 2 child views rendered to buffer');
| true |
Other | emberjs | ember.js | eb8c4aa464c2b17216802566f74da96acd49fdcc.json | Pull htmlbars in via bower.
This allows much simpler updating to new versions, just update the sha
in `bower.json`, run `bower update htmlbars` and boom: new morph
version. | Brocfile.js | @@ -245,7 +245,7 @@ var vendoredPackages = {
'metamorph': vendoredPackage('metamorph'),
'router': vendoredEs6Package('router.js'),
'route-recognizer': vendoredEs6Package('route-recognizer'),
- 'morph': vendoredPackage('morph')
+ 'morph': morphTree('htmlbars/packages/morph')
};
var emberHandlebarsCompiler = pickFiles('packages/ember-handlebars-compiler/lib', {
@@ -502,6 +502,21 @@ sourceTrees = mergeTrees(sourceTrees);
testTrees = mergeTrees(testTrees);
+function morphTree() {
+ var tree = pickFiles('bower_components/htmlbars/packages/morph/lib', {
+ srcDir: '/', destDir: '/morph'
+ });
+
+ tree = moveFile(tree, {
+ srcFile: '/morph/main.js',
+ destFile: 'morph.js'
+ });
+
+ return transpileES6(tree, {
+ moduleName: true
+ });
+}
+
/*
Relies on bower to install other Ember micro libs. Assumes that /lib is
available and contains all the necessary ES6 modules necessary for the library | true |
Other | emberjs | ember.js | eb8c4aa464c2b17216802566f74da96acd49fdcc.json | Pull htmlbars in via bower.
This allows much simpler updating to new versions, just update the sha
in `bower.json`, run `bower update htmlbars` and boom: new morph
version. | bower.json | @@ -10,6 +10,7 @@
"backburner": "https://github.com/ebryn/backburner.js.git#bf91c46978cced9aa130ca0793c5a72107e649db",
"rsvp": "https://github.com/tildeio/rsvp.js.git#3.0.13",
"router.js": "https://github.com/tildeio/router.js.git#1562462f120156a140b9153bf36f1046f85e7812",
- "route-recognizer": "https://github.com/tildeio/route-recognizer.git#8e1058e29de741b8e05690c69da9ec402a167c69"
+ "route-recognizer": "https://github.com/tildeio/route-recognizer.git#8e1058e29de741b8e05690c69da9ec402a167c69",
+ "htmlbars": "https://github.com/tildeio/htmlbars.git#1a4d5985824f4df23bb6e78829e442fe368937aa"
}
} | true |
Other | emberjs | ember.js | eb8c4aa464c2b17216802566f74da96acd49fdcc.json | Pull htmlbars in via bower.
This allows much simpler updating to new versions, just update the sha
in `bower.json`, run `bower update htmlbars` and boom: new morph
version. | packages/morph/lib/main.js | @@ -1,398 +0,0 @@
-define("morph",
- ["morph/morph","morph/dom-helper","exports"],
- function(__dependency1__, __dependency2__, __exports__) {
- "use strict";
- var Morph = __dependency1__["default"];
- var Morph;
- __exports__.Morph = Morph;
- var DOMHelper = __dependency2__["default"];
- var DOMHelper;
- __exports__.DOMHelper = DOMHelper;
- });
-define("morph/dom-helper",
- ["morph/morph","exports"],
- function(__dependency1__, __exports__) {
- "use strict";
- var Morph = __dependency1__["default"];
-
- var emptyString = '';
-
- var deletesBlankTextNodes = (function(){
- var element = document.createElement('div');
- element.appendChild( document.createTextNode('') );
- var clonedElement = element.cloneNode(true);
- return clonedElement.childNodes.length === 0;
- })();
-
- var ignoresCheckedAttribute = (function(){
- var element = document.createElement('input');
- element.setAttribute('checked', 'checked');
- var clonedElement = element.cloneNode(false);
- return !clonedElement.checked;
- })();
-
- /*
- * A class wrapping DOM functions to address environment compatibility,
- * namespaces, contextual elements for morph un-escaped content
- * insertion.
- *
- * When entering a template, a DOMHelper should be passed:
- *
- * template(context, { hooks: hooks, dom: new DOMHelper() });
- *
- * TODO: support foreignObject as a passed contextual element. It has
- * a namespace (svg) that does not match its internal namespace
- * (xhtml).
- *
- * @class DOMHelper
- * @constructor
- * @param {HTMLDocument} _document The document DOM methods are proxied to
- */
- function DOMHelper(_document){
- this.document = _document || window.document;
- }
-
- var prototype = DOMHelper.prototype;
- prototype.constructor = DOMHelper;
-
- prototype.appendChild = function(element, childElement) {
- element.appendChild(childElement);
- };
-
- prototype.appendText = function(element, text) {
- element.appendChild(this.document.createTextNode(text));
- };
-
- prototype.setAttribute = function(element, name, value) {
- element.setAttribute(name, value);
- };
-
- prototype.createElement = function(tagName) {
- if (this.namespaceURI) {
- return this.document.createElementNS(this.namespaceURI, tagName);
- } else {
- return this.document.createElement(tagName);
- }
- };
-
- prototype.createDocumentFragment = function(){
- return this.document.createDocumentFragment();
- };
-
- prototype.createTextNode = function(text){
- return this.document.createTextNode(text);
- };
-
- prototype.repairClonedNode = function(element, blankChildTextNodes, isChecked){
- if (deletesBlankTextNodes && blankChildTextNodes.length > 0) {
- for (var i=0, len=blankChildTextNodes.length;i<len;i++){
- var textNode = document.createTextNode(emptyString),
- offset = blankChildTextNodes[i],
- before = element.childNodes[offset];
- if (before) {
- element.insertBefore(textNode, before);
- } else {
- element.appendChild(textNode);
- }
- }
- }
- if (ignoresCheckedAttribute && isChecked) {
- element.setAttribute('checked', 'checked');
- }
- };
-
- prototype.cloneNode = function(element, deep){
- var clone = element.cloneNode(!!deep);
- return clone;
- };
-
- prototype.createMorph = function(parent, start, end, contextualElement){
- if (!contextualElement && parent.nodeType === Node.ELEMENT_NODE) {
- contextualElement = parent;
- }
- if (!contextualElement) {
- contextualElement = this.document.body;
- }
- return new Morph(parent, start, end, this, contextualElement);
- };
-
- // This helper is just to keep the templates good looking,
- // passing integers instead of element references.
- prototype.createMorphAt = function(parent, startIndex, endIndex, contextualElement){
- var childNodes = parent.childNodes,
- start = startIndex === -1 ? null : childNodes[startIndex],
- end = endIndex === -1 ? null : childNodes[endIndex];
- return this.createMorph(parent, start, end, contextualElement);
- };
-
- prototype.parseHTML = function(html, contextualElement){
- var element = this.cloneNode(contextualElement, false);
- element.innerHTML = html;
- return element.childNodes;
- };
-
- __exports__["default"] = DOMHelper;
- });
-define("morph/morph",
- ["exports"],
- function(__exports__) {
- "use strict";
- var splice = Array.prototype.splice;
-
- function Morph(parent, start, end, domHelper, contextualElement) {
- // TODO: this is an internal API, this should be an assert
- if (parent.nodeType === 11) {
- if (start === null || end === null) {
- throw new Error('a fragment parent must have boundary nodes in order to detect insertion');
- }
- this.element = null;
- } else {
- this.element = parent;
- }
- this._parent = parent;
- this.start = start;
- this.end = end;
- this.domHelper = domHelper;
- if (!contextualElement || contextualElement.nodeType !== Node.ELEMENT_NODE) {
- throw new Error('An element node must be provided for a contextualElement, you provided '+(contextualElement ? 'nodeType '+contextualElement.nodeType : 'nothing'));
- }
- this.contextualElement = contextualElement;
- this.text = null;
- this.owner = null;
- this.morphs = null;
- this.before = null;
- this.after = null;
- this.escaped = true;
- }
-
- Morph.prototype.parent = function () {
- if (!this.element) {
- var parent = this.start.parentNode;
- if (this._parent !== parent) {
- this.element = this._parent = parent;
- }
- }
- return this._parent;
- };
-
- Morph.prototype.destroy = function () {
- if (this.owner) {
- this.owner.removeMorph(this);
- } else {
- clear(this.element || this.parent(), this.start, this.end);
- }
- };
-
- Morph.prototype.removeMorph = function (morph) {
- var morphs = this.morphs;
- for (var i=0, l=morphs.length; i<l; i++) {
- if (morphs[i] === morph) {
- this.replace(i, 1);
- break;
- }
- }
- };
-
- Morph.prototype.update = function (nodeOrString) {
- this._update(this.element || this.parent(), nodeOrString);
- };
-
- Morph.prototype.updateNode = function (node) {
- var parent = this.element || this.parent();
- if (!node) return this._updateText(parent, '');
- this._updateNode(parent, node);
- };
-
- Morph.prototype.updateText = function (text) {
- this._updateText(this.element || this.parent(), text);
- };
-
- Morph.prototype.updateHTML = function (html) {
- var parent = this.element || this.parent();
- if (!html) return this._updateText(parent, '');
- this._updateHTML(parent, html);
- };
-
- Morph.prototype._update = function (parent, nodeOrString) {
- if (nodeOrString === null || nodeOrString === undefined) {
- this._updateText(parent, '');
- } else if (typeof nodeOrString === 'string') {
- if (this.escaped) {
- this._updateText(parent, nodeOrString);
- } else {
- this._updateHTML(parent, nodeOrString);
- }
- } else if (nodeOrString.nodeType) {
- this._updateNode(parent, nodeOrString);
- } else if (nodeOrString.string) { // duck typed SafeString
- this._updateHTML(parent, nodeOrString.string);
- } else {
- this._updateText(parent, nodeOrString.toString());
- }
- };
-
- Morph.prototype._updateNode = function (parent, node) {
- if (this.text) {
- if (node.nodeType === 3) {
- this.text.nodeValue = node.nodeValue;
- return;
- } else {
- this.text = null;
- }
- }
- var start = this.start, end = this.end;
- clear(parent, start, end);
- parent.insertBefore(node, end);
- if (this.before !== null) {
- this.before.end = start.nextSibling;
- }
- if (this.after !== null) {
- this.after.start = end.previousSibling;
- }
- };
-
- Morph.prototype._updateText = function (parent, text) {
- if (this.text) {
- this.text.nodeValue = text;
- return;
- }
- var node = this.domHelper.createTextNode(text);
- this.text = node;
- clear(parent, this.start, this.end);
- parent.insertBefore(node, this.end);
- if (this.before !== null) {
- this.before.end = node;
- }
- if (this.after !== null) {
- this.after.start = node;
- }
- };
-
- Morph.prototype._updateHTML = function (parent, html) {
- var start = this.start, end = this.end;
- clear(parent, start, end);
- this.text = null;
- var childNodes = this.domHelper.parseHTML(html, this.contextualElement);
- appendChildren(parent, end, childNodes);
- if (this.before !== null) {
- this.before.end = start.nextSibling;
- }
- if (this.after !== null) {
- this.after.start = end.previousSibling;
- }
- };
-
- Morph.prototype.append = function (node) {
- if (this.morphs === null) this.morphs = [];
- var index = this.morphs.length;
- return this.insert(index, node);
- };
-
- Morph.prototype.insert = function (index, node) {
- if (this.morphs === null) this.morphs = [];
- var parent = this.element || this.parent(),
- morphs = this.morphs,
- before = index > 0 ? morphs[index-1] : null,
- after = index < morphs.length ? morphs[index] : null,
- start = before === null ? this.start : (before.end === null ? parent.lastChild : before.end.previousSibling),
- end = after === null ? this.end : (after.start === null ? parent.firstChild : after.start.nextSibling),
- morph = new Morph(parent, start, end, this.domHelper, this.contextualElement);
- morph.owner = this;
- morph._update(parent, node);
- if (before !== null) {
- morph.before = before;
- before.end = start.nextSibling;
- before.after = morph;
- }
- if (after !== null) {
- morph.after = after;
- after.before = morph;
- after.start = end.previousSibling;
- }
- this.morphs.splice(index, 0, morph);
- return morph;
- };
-
- Morph.prototype.replace = function (index, removedLength, addedNodes) {
- if (this.morphs === null) this.morphs = [];
- var parent = this.element || this.parent(),
- morphs = this.morphs,
- before = index > 0 ? morphs[index-1] : null,
- after = index+removedLength < morphs.length ? morphs[index+removedLength] : null,
- start = before === null ? this.start : (before.end === null ? parent.lastChild : before.end.previousSibling),
- end = after === null ? this.end : (after.start === null ? parent.firstChild : after.start.nextSibling),
- addedLength = addedNodes === undefined ? 0 : addedNodes.length,
- args, i, current;
-
- if (removedLength > 0) {
- clear(parent, start, end);
- }
-
- if (addedLength === 0) {
- if (before !== null) {
- before.after = after;
- before.end = end;
- }
- if (after !== null) {
- after.before = before;
- after.start = start;
- }
- morphs.splice(index, removedLength);
- return;
- }
-
- args = new Array(addedLength+2);
- if (addedLength > 0) {
- for (i=0; i<addedLength; i++) {
- args[i+2] = current = new Morph(parent, start, end, this.domHelper, this.contextualElement);
- current._update(parent, addedNodes[i]);
- current.owner = this;
- if (before !== null) {
- current.before = before;
- before.end = start.nextSibling;
- before.after = current;
- }
- before = current;
- start = end === null ? parent.lastChild : end.previousSibling;
- }
- if (after !== null) {
- current.after = after;
- after.before = current;
- after.start = end.previousSibling;
- }
- }
-
- args[0] = index;
- args[1] = removedLength;
-
- splice.apply(morphs, args);
- };
-
- function appendChildren(parent, end, nodeList) {
- var ref = end,
- i = nodeList.length,
- node;
- while (i--) {
- node = nodeList[i];
- parent.insertBefore(node, ref);
- ref = node;
- }
- }
-
- function clear(parent, start, end) {
- var current, previous;
- if (end === null) {
- current = parent.lastChild;
- } else {
- current = end.previousSibling;
- }
-
- while (current !== null && current !== start) {
- previous = current.previousSibling;
- parent.removeChild(current);
- current = previous;
- }
- }
-
- __exports__["default"] = Morph;
- });
\ No newline at end of file | true |
Other | emberjs | ember.js | dbdfa77b1adc13847034564a1578e8f6b1335002.json | Allow publishing on failure. | .travis.yml | @@ -10,7 +10,8 @@ cache:
install:
- "npm install"
- "./bin/generate_docs.js"
-
+after_failure:
+ - "./bin/bower_ember_build"
after_success:
- "./bin/publish_to_s3.js"
- "./bin/bower_ember_build" | false |
Other | emberjs | ember.js | ddda9e99d61d0960fcd1a6285f795625ac42cabe.json | Use sendEvent to fire willInsert/didInsertElement | packages/ember-metal-views/lib/main.js | @@ -7,6 +7,7 @@ import { set } from "ember-metal/property_set";
import { lookupView, setupView, teardownView, setupEventDispatcher, reset, events } from "ember-metal-views/events";
import { setupClassNames, setupClassNameBindings, setupAttributeBindings } from "ember-metal-views/attributes";
import { Placeholder } from "placeholder";
+import { sendEvent } from "ember-metal/events";
// FIXME: don't have a hard dependency on the ember run loop
// FIXME: avoid render/afterRender getting defined twice
@@ -102,7 +103,7 @@ function childViewsPlaceholder(parentView) {
function _render(_view) {
var views = [_view],
idx = 0,
- view, ret, tagName, el;
+ view, parentView, ret, tagName, el, i, l;
while (idx < views.length) {
view = views[idx];
@@ -141,7 +142,7 @@ function _render(_view) {
childView;
if (childViews) {
- for (var i = 0, l = childViews.length; i < l; i++) {
+ for (i = 0, l = childViews.length; i < l; i++) {
childView = childViews[i];
childView._parentView = view;
views.push(childView);
@@ -155,23 +156,25 @@ function _render(_view) {
if (_view._placeholder) {
setupEventDispatcher();
- for (var i = 0, l = views.length; i<l; i++) {
- var view = views[i];
+ for (i = 0, l = views.length; i<l; i++) {
+ view = views[i];
if (view.willInsertElement) {
view.willInsertElement(view.element);
}
+ sendEvent(view, 'willInsertElement', view.element);
}
_view._placeholder.update(ret);
- for (var i = 0, l = views.length; i<l; i++) {
- var view = views[i];
+ for (i = 0, l = views.length; i<l; i++) {
+ view = views[i];
if (view.transitionTo) {
view.transitionTo('inDOM');
}
if (view.didInsertElement) {
view.didInsertElement(view.element);
}
+ sendEvent(view, 'didInsertElement', view.element);
}
}
@@ -192,17 +195,17 @@ function _findTemplate(view) {
function _renderContents(view, el) {
var template = _findTemplate(view),
- templateOptions = {}, // TODO
+ templateOptions = view.templateOptions || (view._parentView && view._parentView.templateOptions) || view.constructor.templateOptions || {data: {keywords: {controller: view.controller}}},
i, l;
if (template) {
- if (!view.templateOptions) {
- console.log('templateOptions not specified on ', view);
- view.templateOptions = {data: {keywords: {controller: view.controller}}};
- }
- view.templateOptions.data.view = view;
+ // if (!templateOptions) {
+ // console.log('templateOptions not specified on ', view);
+ // view.templateOptions = {data: {keywords: {controller: view.controller}}};
+ // }
+ templateOptions.data.view = view;
if (view.beforeTemplate) { view.beforeTemplate(); }
- var templateFragment = template(view, view.templateOptions);
+ var templateFragment = template(view, templateOptions);
if (view.isVirtual) {
el = templateFragment;
} else {
@@ -211,7 +214,7 @@ function _renderContents(view, el) {
el.appendChild(templateFragment);
}
}
- view.templateOptions.data.view = null;
+ templateOptions.data.view = null;
} else if (view.textContent) { // TODO: bind?
el.textContent = view.textContent;
} else if (view.innerHTML) { // TODO: bind?
@@ -228,7 +231,7 @@ function fakeBufferFor(el) {
push: function(str) {
el.innerHTML += str;
}
- }
+ };
}
function _triggerRecursively(view, functionOrEventName, skipParent) {
@@ -347,4 +350,4 @@ function contextDidChange(view) {
var destroy = remove;
var createElementForView = _createElementForView;
-export { reset, events, appendTo, render, createChildView, appendChild, remove, destroy, createElementForView }
+export { reset, events, appendTo, render, createChildView, appendChild, remove, destroy, createElementForView }; | false |
Other | emberjs | ember.js | 0cdbf59ab65f3d9e7235cfb6176ad5944390ea5d.json | prefer safe initializer by name storage | packages/ember-application/lib/system/application.js | @@ -37,6 +37,15 @@ import {
import EmberHandlebars from "ember-handlebars-compiler";
var ContainerDebugAdapter;
+function props(obj) {
+ var properties = [];
+
+ for (var key in obj) {
+ properties.push(key);
+ }
+
+ return properties;
+}
/**
An instance of `Ember.Application` is the starting point for every Ember
@@ -653,20 +662,21 @@ var Application = Namespace.extend(DeferredMixin, {
@method runInitializers
*/
runInitializers: function() {
- var initializers = get(this.constructor, 'initializers');
+ var initializersByName = get(this.constructor, 'initializers');
+ var initializers = props(initializersByName);
var container = this.__container__;
var graph = new DAG();
var namespace = this;
var name, initializer;
- for (name in initializers) {
- initializer = initializers[name];
+ for (var i = 0; i < initializers.length; i++) {
+ initializer = initializersByName[initializers[i]];
graph.addEdges(initializer.name, initializer.initialize, initializer.before, initializer.after);
}
graph.topsort(function (vertex) {
var initializer = vertex.value;
- Ember.assert("No application initializer named '"+vertex.name+"'", initializer);
+ Ember.assert("No application initializer named '" + vertex.name + "'", initializer);
initializer(container, namespace);
});
},
@@ -776,7 +786,7 @@ var Application = Namespace.extend(DeferredMixin, {
});
Application.reopenClass({
- initializers: {},
+ initializers: Object.create(null),
/**
Initializer receives an object which has the following attributes: | false |
Other | emberjs | ember.js | d5bd2b9b9d1519791d0959fda997942e8ca714bc.json | prefer Object.create(null) for vertex by name map | packages/ember-application/lib/system/dag.js | @@ -37,7 +37,9 @@ function visit(vertex, fn, visited, path) {
*/
function DAG() {
this.names = [];
- this.vertices = {};
+ this.vertices = Object.create(null);
+}
+
/**
* DAG Vertex
*
@@ -61,15 +63,10 @@ function Vertex(name) {
* @param {String} name The name of the vertex to add
*/
DAG.prototype.add = function(name) {
-<<<<<<< HEAD
- if (this.vertices.hasOwnProperty(name)) {
- if (!name) { throw new Error("Can't add Vertex without name"); }
-=======
if (!name) {
throw new Error("Can't add Vertex without name");
}
if (this.vertices[name] !== undefined) {
->>>>>>> f30005d... asdf
return this.vertices[name];
}
var vertex = new Vertex(name); | false |
Other | emberjs | ember.js | e2cad66d95bbdbd6c50bb9d499c5bfee469f6323.json | Extract DAG Vertex to its own Constructor | packages/ember-application/lib/system/dag.js | @@ -38,6 +38,19 @@ function visit(vertex, fn, visited, path) {
function DAG() {
this.names = [];
this.vertices = {};
+/**
+ * DAG Vertex
+ *
+ * @class Vertex
+ * @constructor
+ */
+
+function Vertex(name) {
+ this.name = name;
+ this.incoming = {};
+ this.incomingNames = [];
+ this.hasOutgoing = false;
+ this.value = null;
}
/**
@@ -52,9 +65,7 @@ DAG.prototype.add = function(name) {
if (this.vertices.hasOwnProperty(name)) {
return this.vertices[name];
}
- var vertex = {
- name: name, incoming: {}, incomingNames: [], hasOutgoing: false, value: null
- };
+ var vertex = new Vertex(name);
this.vertices[name] = vertex;
this.names.push(name);
return vertex; | false |
Other | emberjs | ember.js | c8d3b95f3e56ec404f9aeef79b7d81370e7a3018.json | remove duplicate Ember.keys file and imports | packages/ember-runtime/lib/keys.js | @@ -1,67 +0,0 @@
-import EnumerableUtils from 'ember-metal/enumerable_utils';
-import { create } from 'ember-metal/platform';
-
-/**
- Returns all of the keys defined on an object or hash. This is useful
- when inspecting objects for debugging. On browsers that support it, this
- uses the native `Object.keys` implementation.
-
- @method keys
- @for Ember
- @param {Object} obj
- @return {Array} Array containing keys of obj
-*/
-var keys = Object.keys;
-
-if (!keys || create.isSimulated) {
- var prototypeProperties = [
- 'constructor',
- 'hasOwnProperty',
- 'isPrototypeOf',
- 'propertyIsEnumerable',
- 'valueOf',
- 'toLocaleString',
- 'toString'
- ];
- var pushPropertyName = function(obj, array, key) {
- // Prevents browsers that don't respect non-enumerability from
- // copying internal Ember properties
- if (key.substring(0, 2) === '__') {
- return;
- }
-
- if (key === '_super') {
- return;
- }
-
- if (EnumerableUtils.indexOf(array, key) >= 0) {
- return;
- }
-
- if (typeof obj.hasOwnProperty === 'function' && !obj.hasOwnProperty(key)) {
- return;
- }
-
- array.push(key);
- };
-
- keys = function keys(obj) {
- var ret = [];
- var key;
-
- for (key in obj) {
- pushPropertyName(obj, ret, key);
- }
-
- // IE8 doesn't enumerate property that named the same as prototype properties.
- for (var i = 0, l = prototypeProperties.length; i < l; i++) {
- key = prototypeProperties[i];
-
- pushPropertyName(obj, ret, key);
- }
-
- return ret;
- };
-}
-
-export default keys; | true |
Other | emberjs | ember.js | c8d3b95f3e56ec404f9aeef79b7d81370e7a3018.json | remove duplicate Ember.keys file and imports | packages/ember-runtime/lib/system/core_object.js | @@ -32,7 +32,7 @@ import {
import { indexOf } from "ember-metal/enumerable_utils";
import EmberError from "ember-metal/error";
import { platform } from "ember-metal/platform";
-import keys from "ember-runtime/keys";
+import keys from "ember-metal/keys";
import ActionHandler from "ember-runtime/mixins/action_handler";
import {defineProperty} from "ember-metal/properties";
import { Binding } from "ember-metal/binding"; | true |
Other | emberjs | ember.js | c8d3b95f3e56ec404f9aeef79b7d81370e7a3018.json | remove duplicate Ember.keys file and imports | packages/ember-runtime/tests/computed/reduce_computed_test.js | @@ -8,7 +8,7 @@ import { set } from 'ember-metal/property_set';
import { meta as metaFor } from 'ember-metal/utils';
import run from 'ember-metal/run_loop';
import { observer } from 'ember-metal/mixin';
-import keys from "ember-runtime/keys";
+import keys from "ember-metal/keys";
import EmberObject from "ember-runtime/system/object";
import {
ComputedProperty, | true |
Other | emberjs | ember.js | c8d3b95f3e56ec404f9aeef79b7d81370e7a3018.json | remove duplicate Ember.keys file and imports | packages/ember-runtime/tests/core/keys_test.js | @@ -1,5 +1,5 @@
import { set } from "ember-metal/property_set";
-import keys from "ember-runtime/keys";
+import keys from "ember-metal/keys";
import {
addObserver,
removeObserver | true |
Other | emberjs | ember.js | 73e5b11bba875253f80d11987aaaba4c02c91342.json | Fix incorrect usage of Ember.deprecate.
Apparently, I don't know how to Javascript. | packages/ember-routing-handlebars/lib/helpers/link_to.js | @@ -211,7 +211,7 @@ var LinkView = Ember.LinkView = EmberComponent.extend({
init: function() {
this._super.apply(this, arguments);
- Ember.deprecate('Using currentWhen with {{link-to}} is deprecated in favor of `current-when`.', this.currentWhen);
+ Ember.deprecate('Using currentWhen with {{link-to}} is deprecated in favor of `current-when`.', !this.currentWhen);
// Map desired event name to invoke function
var eventName = get(this, 'eventName'); | true |
Other | emberjs | ember.js | 73e5b11bba875253f80d11987aaaba4c02c91342.json | Fix incorrect usage of Ember.deprecate.
Apparently, I don't know how to Javascript. | packages/ember/tests/helpers/link_to_test.js | @@ -279,7 +279,7 @@ test("The {{link-to}} helper supports currentWhen (DEPRECATED)", function() {
});
Ember.TEMPLATES.index = Ember.Handlebars.compile("<h3>Home</h3>{{outlet}}");
- Ember.TEMPLATES['index/about'] = Ember.Handlebars.compile("{{#link-to 'item' id='other-link' current-when='index'}}ITEM{{/link-to}}");
+ Ember.TEMPLATES['index/about'] = Ember.Handlebars.compile("{{#link-to 'item' id='other-link' currentWhen='index'}}ITEM{{/link-to}}");
bootApplication();
| true |
Other | emberjs | ember.js | 13c807b7e085cd91e5d40263b0ab0f299ee6a078.json | Update documentation to avoid global view access | packages/ember-handlebars-compiler/lib/main.js | @@ -93,7 +93,7 @@ var EmberHandlebars = Ember.Handlebars = objectCreate(Handlebars);
Which is functionally equivalent to:
```handlebars
- {{view App.CalendarView}}
+ {{view 'calendar'}}
```
Options in the helper will be passed to the view in exactly the same | true |
Other | emberjs | ember.js | 13c807b7e085cd91e5d40263b0ab0f299ee6a078.json | Update documentation to avoid global view access | packages/ember-handlebars/lib/controls/select.js | @@ -115,7 +115,7 @@ var SelectOptgroup = CollectionView.extend({
```
```handlebars
- {{view Ember.Select content=names}}
+ {{view "select" content=names}}
```
Would result in the following HTML:
@@ -138,10 +138,7 @@ var SelectOptgroup = CollectionView.extend({
```
```handlebars
- {{view Ember.Select
- content=names
- value=selectedName
- }}
+ {{view "select" content=names value=selectedName}}
```
Would result in the following HTML with the `<option>` for 'Tom' selected:
@@ -180,7 +177,7 @@ var SelectOptgroup = CollectionView.extend({
```
```handlebars
- {{view Ember.Select
+ {{view "select"
content=programmers
optionValuePath="content.id"
optionLabelPath="content.firstName"}}
@@ -211,7 +208,7 @@ var SelectOptgroup = CollectionView.extend({
```
```handlebars
- {{view Ember.Select
+ {{view "select"
content=programmers
optionValuePath="content.id"
optionLabelPath="content.firstName"
@@ -244,15 +241,12 @@ var SelectOptgroup = CollectionView.extend({
App.ApplicationController = Ember.ObjectController.extend({
selectedPerson: tom,
- programmers: [
- yehuda,
- tom
- ]
+ programmers: [ yehuda, tom ]
});
```
```handlebars
- {{view Ember.Select
+ {{view "select"
content=programmers
optionValuePath="content.id"
optionLabelPath="content.firstName"
@@ -281,15 +275,12 @@ var SelectOptgroup = CollectionView.extend({
```javascript
App.ApplicationController = Ember.ObjectController.extend({
selectedProgrammer: null,
- programmers: [
- "Yehuda",
- "Tom"
- ]
+ programmers: ["Yehuda", "Tom"]
});
```
``` handlebars
- {{view Ember.Select
+ {{view "select"
content=programmers
value=selectedProgrammer
}}
@@ -313,15 +304,12 @@ var SelectOptgroup = CollectionView.extend({
```javascript
App.ApplicationController = Ember.ObjectController.extend({
selectedProgrammer: null,
- programmers: [
- "Yehuda",
- "Tom"
- ]
+ programmers: [ "Yehuda", "Tom" ]
});
```
```handlebars
- {{view Ember.Select
+ {{view "select"
content=programmers
value=selectedProgrammer
prompt="Please select a name"
@@ -391,7 +379,8 @@ var Select = View.extend({
Otherwise, this should be a list of objects. For instance:
```javascript
- Ember.Select.create({
+ var App = Ember.Application.create();
+ var App.MySelect = Ember.Select.extend({
content: Ember.A([
{ id: 1, firstName: 'Yehuda' },
{ id: 2, firstName: 'Tom' } | true |
Other | emberjs | ember.js | 13c807b7e085cd91e5d40263b0ab0f299ee6a078.json | Update documentation to avoid global view access | packages/ember-handlebars/lib/helpers/collection.js | @@ -36,52 +36,54 @@ var alias = computed.alias;
Given an empty `<body>` the following template:
```handlebars
- {{#collection contentBinding="App.items"}}
+ {{! application.hbs }}
+ {{#collection content=model}}
Hi {{view.content.name}}
{{/collection}}
```
And the following application code
```javascript
- App = Ember.Application.create()
- App.items = [
- Ember.Object.create({name: 'Dave'}),
- Ember.Object.create({name: 'Mary'}),
- Ember.Object.create({name: 'Sara'})
- ]
+ App = Ember.Application.create();
+ App.ApplicationRoute = Ember.Route.extend({
+ model: function(){
+ return [{name: 'Yehuda'},{name: 'Tom'},{name: 'Peter'}];
+ }
+ });
```
- Will result in the HTML structure below
+ The following HTML will result:
```html
<div class="ember-view">
- <div class="ember-view">Hi Dave</div>
- <div class="ember-view">Hi Mary</div>
- <div class="ember-view">Hi Sara</div>
+ <div class="ember-view">Hi Yehuda</div>
+ <div class="ember-view">Hi Tom</div>
+ <div class="ember-view">Hi Peter</div>
</div>
```
- ### Blockless use in a collection
+ ### Non-block version of collection
- If you provide an `itemViewClass` option that has its own `template` you can
+ If you provide an `itemViewClass` option that has its own `template` you may
omit the block.
The following template:
```handlebars
- {{collection contentBinding="App.items" itemViewClass="App.AnItemView"}}
+ {{! application.hbs }}
+ {{collection content=model itemViewClass="an-item"}}
```
And application code
```javascript
App = Ember.Application.create();
- App.items = [
- Ember.Object.create({name: 'Dave'}),
- Ember.Object.create({name: 'Mary'}),
- Ember.Object.create({name: 'Sara'})
- ];
+ App.ApplicationRoute = Ember.Route.extend({
+ model: function(){
+ return [{name: 'Yehuda'},{name: 'Tom'},{name: 'Peter'}];
+ }
+ });
App.AnItemView = Ember.View.extend({
template: Ember.Handlebars.compile("Greetings {{view.content.name}}")
@@ -92,9 +94,9 @@ var alias = computed.alias;
```html
<div class="ember-view">
- <div class="ember-view">Greetings Dave</div>
- <div class="ember-view">Greetings Mary</div>
- <div class="ember-view">Greetings Sara</div>
+ <div class="ember-view">Greetings Yehuda</div>
+ <div class="ember-view">Greetings Tom</div>
+ <div class="ember-view">Greetings Peter</div>
</div>
```
@@ -105,11 +107,13 @@ var alias = computed.alias;
the helper by passing it as the first argument:
```handlebars
- {{#collection App.MyCustomCollectionClass contentBinding="App.items"}}
+ {{#collection "my-custom-collection" content=model}}
Hi {{view.content.name}}
{{/collection}}
```
+ This example would look for the class `App.MyCustomCollection`.
+
### Forwarded `item.*`-named Options
As with the `{{view}}`, helper options passed to the `{{collection}}` will be
@@ -118,7 +122,7 @@ var alias = computed.alias;
item (note the camelcasing):
```handlebars
- {{#collection contentBinding="App.items"
+ {{#collection content=model
itemTagName="p"
itemClassNames="greeting"}}
Howdy {{view.content.name}}
@@ -129,9 +133,9 @@ var alias = computed.alias;
```html
<div class="ember-view">
- <p class="ember-view greeting">Howdy Dave</p>
- <p class="ember-view greeting">Howdy Mary</p>
- <p class="ember-view greeting">Howdy Sara</p>
+ <p class="ember-view greeting">Howdy Yehuda</p>
+ <p class="ember-view greeting">Howdy Tom</p>
+ <p class="ember-view greeting">Howdy Peter</p>
</div>
```
| true |
Other | emberjs | ember.js | 13c807b7e085cd91e5d40263b0ab0f299ee6a078.json | Update documentation to avoid global view access | packages/ember-handlebars/lib/helpers/each.js | @@ -260,131 +260,161 @@ GroupedEach.prototype = {
};
/**
- The `{{#each}}` helper loops over elements in a collection, rendering its
- block once for each item. It is an extension of the base Handlebars `{{#each}}`
- helper:
+ The `{{#each}}` helper loops over elements in a collection. It is an extension
+ of the base Handlebars `{{#each}}` helper.
+
+ The default behavior of `{{#each}}` is to yield its inner block once for every
+ item in an array. Each yield will provide the item as the context of the block.
```javascript
- Developers = [{name: 'Yehuda'},{name: 'Tom'}, {name: 'Paul'}];
+ var developers = [{name: 'Yehuda'},{name: 'Tom'}, {name: 'Paul'}];
```
```handlebars
- {{#each Developers}}
+ {{#each developers}}
{{name}}
+ {{! `this` is each developer }}
{{/each}}
```
- `{{each}}` supports an alternative syntax with element naming:
+ `{{#each}}` supports an alternative syntax with element naming. This preserves
+ context of the yielded block:
```handlebars
- {{#each person in Developers}}
+ {{#each person in developers}}
{{person.name}}
+ {{! `this` is whatever it was outside the #each }}
{{/each}}
```
- When looping over objects that do not have properties, `{{this}}` can be used
- to render the object:
+ The same rules apply to arrays of primitives, but the items may need to be
+ references with `{{this}}`.
```javascript
- DeveloperNames = ['Yehuda', 'Tom', 'Paul']
+ var developerNames = ['Yehuda', 'Tom', 'Paul']
```
```handlebars
- {{#each DeveloperNames}}
+ {{#each developerNames}}
{{this}}
{{/each}}
```
+
### {{else}} condition
+
`{{#each}}` can have a matching `{{else}}`. The contents of this block will render
if the collection is empty.
```
- {{#each person in Developers}}
+ {{#each person in developers}}
{{person.name}}
{{else}}
<p>Sorry, nobody is available for this task.</p>
{{/each}}
```
- ### Specifying a View class for items
- If you provide an `itemViewClass` option that references a view class
- with its own `template` you can omit the block.
+
+ ### Specifying an alternative view for each item
+
+ `itemViewClass` can control which view will be used during the render of each
+ item's template.
The following template:
```handlebars
- {{#view App.MyView }}
- {{each view.items itemViewClass="App.AnItemView"}}
- {{/view}}
+ <ul>
+ {{#each developers itemViewClass="person"}}
+ {{name}}
+ {{/each}}
+ </ul>
```
- And application code
+ Will use the following view for each item
```javascript
- App = Ember.Application.create({
- MyView: Ember.View.extend({
- items: [
- Ember.Object.create({name: 'Dave'}),
- Ember.Object.create({name: 'Mary'}),
- Ember.Object.create({name: 'Sara'})
- ]
- })
+ App.PersonView = Ember.View.extend({
+ tagName: 'li'
});
+ ```
+
+ Resulting in HTML output that looks like the following:
- App.AnItemView = Ember.View.extend({
- template: Ember.Handlebars.compile("Greetings {{name}}")
+ ```html
+ <ul>
+ <li class="ember-view">Yehuda</li>
+ <li class="ember-view">Tom</li>
+ <li class="ember-view">Paul</li>
+ </ul>
+ ```
+
+ `itemViewClass` also enables a non-block form of `{{each}}`. The view
+ must {{#crossLink "Ember.View/toc_templates"}}provide its own template{{/crossLink}},
+ and then the block should be dropped. An example that outputs the same HTML
+ as the previous one:
+
+ ```javascript
+ App.PersonView = Ember.View.extend({
+ tagName: 'li',
+ template: '{{name}}'
});
```
- Will result in the HTML structure below
+ ```handlebars
+ <ul>
+ {{each developers itemViewClass="person"}}
+ </ul>
+ ```
- ```html
- <div class="ember-view">
- <div class="ember-view">Greetings Dave</div>
- <div class="ember-view">Greetings Mary</div>
- <div class="ember-view">Greetings Sara</div>
- </div>
+ ### Specifying an alternative view for no items (else)
+
+ The `emptyViewClass` option provides the same flexibility to the `{{else}}`
+ case of the each helper.
+
+ ```javascript
+ App.NoPeopleView = Ember.View.extend({
+ tagName: 'li',
+ template: 'No person is available, sorry'
+ });
```
- If an `itemViewClass` is defined on the helper, and therefore the helper is not
- being used as a block, an `emptyViewClass` can also be provided optionally.
- The `emptyViewClass` will match the behavior of the `{{else}}` condition
- described above. That is, the `emptyViewClass` will render if the collection
- is empty.
+ ```handlebars
+ <ul>
+ {{#each developers emptyViewClass="no-people"}}
+ <li>{{name}}</li>
+ {{/each}}
+ </ul>
+ ```
- ### Representing each item with a Controller.
- By default the controller lookup within an `{{#each}}` block will be
- the controller of the template where the `{{#each}}` was used. If each
- item needs to be presented by a custom controller you can provide a
- `itemController` option which references a controller by lookup name.
- Each item in the loop will be wrapped in an instance of this controller
- and the item itself will be set to the `model` property of that controller.
+ ### Wrapping each item in a controller
- This is useful in cases where properties of model objects need transformation
- or synthesis for display:
+ Controllers in Ember manage state and decorate data. In many cases,
+ providing a controller for each item in a list can be useful.
+ Specifically, an {{#crossLink "Ember.ObjectController"}}Ember.ObjectController{{/crossLink}}
+ should probably be used. Item controllers are passed the item they
+ will present as a `model` property, and an object controller will
+ proxy property lookups to `model` for us.
+
+ This allows state and decoration to be added to the controller
+ while any other property lookups are delegated to the model. An example:
```javascript
- App.DeveloperController = Ember.ObjectController.extend({
+ App.RecruitController = Ember.ObjectController.extend({
isAvailableForHire: function() {
- return !this.get('model.isEmployed') && this.get('model.isSeekingWork');
+ return !this.get('isEmployed') && this.get('isSeekingWork');
}.property('isEmployed', 'isSeekingWork')
})
```
```handlebars
- {{#each person in developers itemController="developer"}}
+ {{#each person in developers itemController="recruit"}}
{{person.name}} {{#if person.isAvailableForHire}}Hire me!{{/if}}
{{/each}}
```
- Each itemController will receive a reference to the current controller as
- a `parentController` property.
-
### (Experimental) Grouped Each
- When used in conjunction with the experimental [group helper](https://github.com/emberjs/group-helper),
- you can inform Handlebars to re-render an entire group of items instead of
- re-rendering them one at a time (in the event that they are changed en masse
- or an item is added/removed).
+ If a list's membership often changes, but properties of items in that
+ group rarely change, a significant improvement in template rendering
+ time can be achieved by using the experimental [group helper](https://github.com/emberjs/group-helper).
```handlebars
{{#group}}
@@ -394,40 +424,40 @@ GroupedEach.prototype = {
{{/group}}
```
- This can be faster than the normal way that Handlebars re-renders items
- in some cases.
+ When the membership of `people` changes, or when any property changes, the entire
+ `{{#group}}` block will be re-rendered.
- If for some reason you have a group with more than one `#each`, you can make
- one of the collections be updated in normal (non-grouped) fashion by setting
- the option `groupedRows=true` (counter-intuitive, I know).
-
- For example,
+ An `{{#each}}` inside the `{{#group}}` helper can opt-out of the special group
+ behavior by passing the `groupedRows` option. For example:
```handlebars
- {{dealershipName}}
-
{{#group}}
{{#each dealers}}
+ {{! uses group's special behavior }}
{{firstName}} {{lastName}}
{{/each}}
{{#each car in cars groupedRows=true}}
+ {{! does not use group's special behavior }}
{{car.make}} {{car.model}} {{car.color}}
{{/each}}
{{/group}}
```
- Any change to `dealershipName` or the `dealers` collection will cause the
- entire group to be re-rendered. However, changes to the `cars` collection
- will be re-rendered individually (as normal).
- Note that `group` behavior is also disabled by specifying an `itemViewClass`.
+ Any change to the `dealers` collection will cause the entire group to be re-rendered.
+ Changes to the `cars` collection will be re-rendered individually, as they are with
+ normal `{{#each}}` usage.
+
+ `{{#group}}` is implemented with an `itemViewClass`, so specifying an `itemViewClass`
+ on an `{{#each}}` will also disable the special re-rendering behavior.
@method each
@for Ember.Handlebars.helpers
@param [name] {String} name for item (used with `in`)
@param [path] {String} path
@param [options] {Object} Handlebars key/value pairs of options
@param [options.itemViewClass] {String} a path to a view class used for each item
+ @param [options.emptyViewClass] {String} a path to a view class used for each item
@param [options.itemController] {String} name of a controller to be created for each item
@param [options.groupedRows] {boolean} enable normal item-by-item rendering when inside a `#group` helper
*/ | true |
Other | emberjs | ember.js | 13c807b7e085cd91e5d40263b0ab0f299ee6a078.json | Update documentation to avoid global view access | packages/ember-handlebars/lib/helpers/view.js | @@ -335,7 +335,7 @@ export var ViewHelper = EmberObject.create({
specify a path to a custom view class.
```handlebars
- {{#view "MyApp.CustomView"}}
+ {{#view "custom"}}{{! will look up App.CustomView }}
hello.
{{/view}}
```
@@ -349,7 +349,7 @@ export var ViewHelper = EmberObject.create({
innerViewClass: Ember.View.extend({
classNames: ['a-custom-view-class-as-property']
}),
- template: Ember.Handlebars.compile('{{#view "view.innerViewClass"}} hi {{/view}}')
+ template: Ember.Handlebars.compile('{{#view view.innerViewClass}} hi {{/view}}')
});
MyApp.OuterView.create().appendTo('body');
@@ -372,8 +372,21 @@ export var ViewHelper = EmberObject.create({
supplying a block. Attempts to use both a `templateName` option and supply a
block will throw an error.
+ ```javascript
+ var App = Ember.Application.create();
+ App.WithTemplateDefinedView = Ember.View.extend({
+ templateName: 'defined-template'
+ });
+ ```
+
+ ```handlebars
+ {{! application.hbs }}
+ {{view 'with-template-defined'}}
+ ```
+
```handlebars
- {{view "MyApp.ViewWithATemplateDefined"}}
+ {{! defined-template.hbs }}
+ Some content for the defined template view.
```
### `viewName` property | true |
Other | emberjs | ember.js | 13c807b7e085cd91e5d40263b0ab0f299ee6a078.json | Update documentation to avoid global view access | packages/ember-views/lib/views/collection_view.js | @@ -44,27 +44,32 @@ import EmberArray from "ember-runtime/mixins/array";
The view for each item in the collection will have its `content` property set
to the item.
- ## Specifying itemViewClass
+ ## Specifying `itemViewClass`
By default the view class for each item in the managed collection will be an
instance of `Ember.View`. You can supply a different class by setting the
`CollectionView`'s `itemViewClass` property.
- Given an empty `<body>` and the following code:
+ Given the following application code:
```javascript
- someItemsView = Ember.CollectionView.create({
+ var App = Ember.Application.create();
+ App.ItemListView = Ember.CollectionView.extend({
classNames: ['a-collection'],
content: ['A','B','C'],
itemViewClass: Ember.View.extend({
template: Ember.Handlebars.compile("the letter: {{view.content}}")
})
});
+ ```
- someItemsView.appendTo('body');
+ And a simple application template:
+
+ ```handlebars
+ {{view 'item-list'}}
```
- Will result in the following HTML structure
+ The following HTML will result:
```html
<div class="ember-view a-collection">
@@ -80,21 +85,26 @@ import EmberArray from "ember-runtime/mixins/array";
"ul", "ol", "table", "thead", "tbody", "tfoot", "tr", or "select" will result
in the item views receiving an appropriately matched `tagName` property.
- Given an empty `<body>` and the following code:
+ Given the following application code:
```javascript
- anUnorderedListView = Ember.CollectionView.create({
+ var App = Ember.Application.create();
+ App.UnorderedListView = Ember.CollectionView.create({
tagName: 'ul',
content: ['A','B','C'],
itemViewClass: Ember.View.extend({
template: Ember.Handlebars.compile("the letter: {{view.content}}")
})
});
+ ```
- anUnorderedListView.appendTo('body');
+ And a simple application template:
+
+ ```handlebars
+ {{view 'unordered-list-view'}}
```
- Will result in the following HTML structure
+ The following HTML will result:
```html
<ul class="ember-view a-collection">
@@ -105,7 +115,7 @@ import EmberArray from "ember-runtime/mixins/array";
```
Additional `tagName` pairs can be provided by adding to
- `Ember.CollectionView.CONTAINER_MAP `
+ `Ember.CollectionView.CONTAINER_MAP`. For example:
```javascript
Ember.CollectionView.CONTAINER_MAP['article'] = 'section'
@@ -118,7 +128,7 @@ import EmberArray from "ember-runtime/mixins/array";
`createChildView` method can be overidden:
```javascript
- CustomCollectionView = Ember.CollectionView.extend({
+ App.CustomCollectionView = Ember.CollectionView.extend({
createChildView: function(viewClass, attrs) {
if (attrs.content.kind == 'album') {
viewClass = App.AlbumView;
@@ -138,18 +148,23 @@ import EmberArray from "ember-runtime/mixins/array";
will be the `CollectionView`s only child.
```javascript
- aListWithNothing = Ember.CollectionView.create({
+ var App = Ember.Application.create();
+ App.ListWithNothing = Ember.CollectionView.create({
classNames: ['nothing']
content: null,
emptyView: Ember.View.extend({
template: Ember.Handlebars.compile("The collection is empty")
})
});
+ ```
+
+ And a simple application template:
- aListWithNothing.appendTo('body');
+ ```handlebars
+ {{view 'list-with-nothing'}}
```
- Will result in the following HTML structure
+ The following HTML will result:
```html
<div class="ember-view nothing"> | true |
Other | emberjs | ember.js | 13c807b7e085cd91e5d40263b0ab0f299ee6a078.json | Update documentation to avoid global view access | packages/ember-views/lib/views/view.js | @@ -600,8 +600,9 @@ var EMPTY_ARRAY = [];
on the descendent.
```javascript
- OuterView = Ember.View.extend({
- template: Ember.Handlebars.compile("outer {{#view InnerView}}inner{{/view}} outer"),
+ var App = Ember.Application.create();
+ App.OuterView = Ember.View.extend({
+ template: Ember.Handlebars.compile("outer {{#view 'inner'}}inner{{/view}} outer"),
eventManager: Ember.Object.create({
mouseEnter: function(event, view) {
// view might be instance of either
@@ -611,7 +612,7 @@ var EMPTY_ARRAY = [];
})
});
- InnerView = Ember.View.extend({
+ App.InnerView = Ember.View.extend({
click: function(event) {
// will be called if rendered inside
// an OuterView because OuterView's | true |
Other | emberjs | ember.js | 0434d7f12f88cd1d023ad2c5bb2720bb0db41358.json | Prefer isPath over indexOf | packages/ember-metal/lib/property_get.js | @@ -62,7 +62,7 @@ var get = function get(obj, keyName) {
var value = _getPath(obj, keyName);
Ember.deprecate(
"Ember.get fetched '"+keyName+"' from the global context. This behavior will change in the future (issue #3852)",
- !value || (obj && obj !== Ember.lookup) || keyName.indexOf('.') !== -1 || isGlobalPath(keyName+".") // Add a . to ensure simple paths are matched.
+ !value || (obj && obj !== Ember.lookup) || isPath(keyName) || isGlobalPath(keyName+".") // Add a . to ensure simple paths are matched.
);
return value;
} | false |
Other | emberjs | ember.js | 984b42329eff7eed66c36a05d0d79fc54000cba7.json | Replace multiline variable assignments.
* ember-handlebars
* ember-extension-support
* ember-debug | packages/ember-debug/lib/main.js | @@ -93,7 +93,9 @@ Ember.deprecate = function(message, test) {
try { __fail__.fail(); } catch (e) { error = e; }
if (Ember.LOG_STACKTRACE_ON_DEPRECATION && error.stack) {
- var stack, stackStr = '';
+ var stack;
+ var stackStr = '';
+
if (error['arguments']) {
// Chrome
stack = error.stack.replace(/^\s+at\s+/gm, ''). | true |
Other | emberjs | ember.js | 984b42329eff7eed66c36a05d0d79fc54000cba7.json | Replace multiline variable assignments.
* ember-handlebars
* ember-extension-support
* ember-debug | packages/ember-extension-support/tests/container_debug_adapter_test.js | @@ -5,7 +5,8 @@ import { default as EmberController } from "ember-runtime/controllers/controller
import "ember-extension-support"; // Must be required to export Ember.ContainerDebugAdapter
import Application from "ember-application/system/application";
-var adapter, App, Model = EmberObject.extend();
+var adapter, App;
+var Model = EmberObject.extend();
function boot() { | true |
Other | emberjs | ember.js | 984b42329eff7eed66c36a05d0d79fc54000cba7.json | Replace multiline variable assignments.
* ember-handlebars
* ember-extension-support
* ember-debug | packages/ember-extension-support/tests/data_adapter_test.js | @@ -12,7 +12,8 @@ import EmberDataAdapter from "ember-extension-support/data_adapter";
import EmberApplication from "ember-application/system/application";
import DefaultResolver from "ember-application/system/resolver";
-var adapter, App, Model = EmberObject.extend();
+var adapter, App;
+var Model = EmberObject.extend();
var DataAdapter = EmberDataAdapter.extend({
detect: function(klass) { | true |
Other | emberjs | ember.js | 984b42329eff7eed66c36a05d0d79fc54000cba7.json | Replace multiline variable assignments.
* ember-handlebars
* ember-extension-support
* ember-debug | packages/ember-handlebars/lib/ext.js | @@ -17,7 +17,8 @@ var resolveHelper,
import isEmpty from 'ember-metal/is_empty';
-var slice = [].slice, originalTemplate = EmberHandlebars.template;
+var slice = [].slice;
+var originalTemplate = EmberHandlebars.template;
/**
If a path starts with a reserved keyword, returns the root
@@ -443,7 +444,8 @@ function makeBoundHelper(fn) {
// Override SimpleHandlebarsView's method for generating the view's content.
bindView.normalizedValue = function() {
- var args = [], boundOption;
+ var args = [];
+ var boundOption;
// Copy over bound hash options.
for (boundOption in boundOptions) { | true |
Other | emberjs | ember.js | 984b42329eff7eed66c36a05d0d79fc54000cba7.json | Replace multiline variable assignments.
* ember-handlebars
* ember-extension-support
* ember-debug | packages/ember-handlebars/lib/helpers/binding.js | @@ -125,7 +125,8 @@ function bind(property, options, preserveContext, shouldDisplay, valueNormalizer
run.once(view, 'rerender');
};
- var template, context, result = handlebarsGet(currentContext, property, options);
+ var template, context;
+ var result = handlebarsGet(currentContext, property, options);
result = valueNormalizer ? valueNormalizer(result) : result;
@@ -494,7 +495,8 @@ function unboundIfHelper(property, fn) {
@return {String} HTML string
*/
function withHelper(context, options) {
- var bindContext, preserveContext, controller, helperName = 'with';
+ var bindContext, preserveContext, controller;
+ var helperName = 'with';
if (arguments.length === 4) {
var keywordName, path, rootPath, normalized, contextPath;
@@ -584,7 +586,9 @@ function unlessHelper(context, options) {
Ember.assert("You must pass exactly one argument to the unless helper", arguments.length === 2);
Ember.assert("You must pass a block to the unless helper", options.fn && options.fn !== Handlebars.VM.noop);
- var fn = options.fn, inverse = options.inverse, helperName = 'unless';
+ var fn = options.fn;
+ var inverse = options.inverse;
+ var helperName = 'unless';
if (context) {
helperName += ' ' + context;
@@ -855,7 +859,8 @@ function bindAttrHelperDeprecated() {
@return {Array} An array of class names to add
*/
function bindClasses(context, classBindings, view, bindAttrId, options) {
- var ret = [], newClass, value, elem;
+ var ret = [];
+ var newClass, value, elem;
// Helper method to retrieve the property from the context and
// determine which class string to return, based on whether it is | true |
Other | emberjs | ember.js | 984b42329eff7eed66c36a05d0d79fc54000cba7.json | Replace multiline variable assignments.
* ember-handlebars
* ember-extension-support
* ember-debug | packages/ember-handlebars/lib/helpers/collection.js | @@ -175,10 +175,13 @@ function collectionHelper(path, options) {
collectionClass = CollectionView;
}
- var hash = options.hash, itemHash = {}, match;
+ var hash = options.hash;
+ var itemHash = {};
+ var match;
// Extract item view class if provided else default to the standard class
- var collectionPrototype = collectionClass.proto(), itemViewClass;
+ var collectionPrototype = collectionClass.proto();
+ var itemViewClass;
if (hash.itemView) {
controller = data.keywords.controller; | true |
Other | emberjs | ember.js | 984b42329eff7eed66c36a05d0d79fc54000cba7.json | Replace multiline variable assignments.
* ember-handlebars
* ember-extension-support
* ember-debug | packages/ember-handlebars/lib/helpers/each.js | @@ -432,7 +432,8 @@ GroupedEach.prototype = {
@param [options.groupedRows] {boolean} enable normal item-by-item rendering when inside a `#group` helper
*/
function eachHelper(path, options) {
- var ctx, helperName = 'each';
+ var ctx;
+ var helperName = 'each';
if (arguments.length === 4) {
Ember.assert("If you pass more than one argument to the each helper, it must be in the form #each foo in bar", arguments[1] === "in"); | true |
Other | emberjs | ember.js | 984b42329eff7eed66c36a05d0d79fc54000cba7.json | Replace multiline variable assignments.
* ember-handlebars
* ember-extension-support
* ember-debug | packages/ember-handlebars/lib/helpers/view.js | @@ -23,12 +23,12 @@ import {
import EmberString from "ember-runtime/system/string";
-var LOWERCASE_A_Z = /^[a-z]/,
- VIEW_PREFIX = /^view\./;
+var LOWERCASE_A_Z = /^[a-z]/;
+var VIEW_PREFIX = /^view\./;
function makeBindings(thisContext, options) {
- var hash = options.hash,
- hashType = options.hashTypes;
+ var hash = options.hash;
+ var hashType = options.hashTypes;
for (var prop in hash) {
if (hashType[prop] === 'ID') { | true |
Other | emberjs | ember.js | 984b42329eff7eed66c36a05d0d79fc54000cba7.json | Replace multiline variable assignments.
* ember-handlebars
* ember-extension-support
* ember-debug | packages/ember-handlebars/lib/loader.js | @@ -38,12 +38,12 @@ function bootstrap(ctx) {
var compile = (script.attr('type') === 'text/x-raw-handlebars') ?
jQuery.proxy(Handlebars.compile, Handlebars) :
- jQuery.proxy(EmberHandlebars.compile, EmberHandlebars),
- // Get the name of the script, used by Ember.View's templateName property.
- // First look for data-template-name attribute, then fall back to its
- // id if no name is found.
- templateName = script.attr('data-template-name') || script.attr('id') || 'application',
- template = compile(script.html());
+ jQuery.proxy(EmberHandlebars.compile, EmberHandlebars);
+ // Get the name of the script, used by Ember.View's templateName property.
+ // First look for data-template-name attribute, then fall back to its
+ // id if no name is found.
+ var templateName = script.attr('data-template-name') || script.attr('id') || 'application';
+ var template = compile(script.html());
// Check if template of same name already exists
if (Ember.TEMPLATES[templateName] !== undefined) { | true |
Other | emberjs | ember.js | 984b42329eff7eed66c36a05d0d79fc54000cba7.json | Replace multiline variable assignments.
* ember-handlebars
* ember-extension-support
* ember-debug | packages/ember-handlebars/tests/controls/select_test.js | @@ -135,8 +135,9 @@ test("can specify the property path for an option's label and value", function()
});
test("can retrieve the current selected option when multiple=false", function() {
- var yehuda = { id: 1, firstName: 'Yehuda' },
- tom = { id: 2, firstName: 'Tom' };
+ var yehuda = { id: 1, firstName: 'Yehuda' };
+ var tom = { id: 2, firstName: 'Tom' };
+
select.set('content', Ember.A([yehuda, tom]));
append();
@@ -150,10 +151,11 @@ test("can retrieve the current selected option when multiple=false", function()
});
test("can retrieve the current selected options when multiple=true", function() {
- var yehuda = { id: 1, firstName: 'Yehuda' },
- tom = { id: 2, firstName: 'Tom' },
- david = { id: 3, firstName: 'David' },
- brennain = { id: 4, firstName: 'Brennain' };
+ var yehuda = { id: 1, firstName: 'Yehuda' };
+ var tom = { id: 2, firstName: 'Tom' };
+ var david = { id: 3, firstName: 'David' };
+ var brennain = { id: 4, firstName: 'Brennain' };
+
select.set('content', Ember.A([yehuda, tom, david, brennain]));
select.set('multiple', true);
select.set('optionLabelPath', 'content.firstName');
@@ -175,8 +177,8 @@ test("can retrieve the current selected options when multiple=true", function()
});
test("selection can be set when multiple=false", function() {
- var yehuda = { id: 1, firstName: 'Yehuda' },
- tom = { id: 2, firstName: 'Tom' };
+ var yehuda = { id: 1, firstName: 'Yehuda' };
+ var tom = { id: 2, firstName: 'Tom' };
run(function() {
select.set('content', Ember.A([yehuda, tom]));
@@ -194,10 +196,10 @@ test("selection can be set when multiple=false", function() {
});
test("selection can be set when multiple=true", function() {
- var yehuda = { id: 1, firstName: 'Yehuda' },
- tom = { id: 2, firstName: 'Tom' },
- david = { id: 3, firstName: 'David' },
- brennain = { id: 4, firstName: 'Brennain' };
+ var yehuda = { id: 1, firstName: 'Yehuda' };
+ var tom = { id: 2, firstName: 'Tom' };
+ var david = { id: 3, firstName: 'David' };
+ var brennain = { id: 4, firstName: 'Brennain' };
run(function() {
select.set('content', Ember.A([yehuda, tom, david, brennain]));
@@ -215,10 +217,10 @@ test("selection can be set when multiple=true", function() {
});
test("selection can be set when multiple=true and prompt", function() {
- var yehuda = { id: 1, firstName: 'Yehuda' },
- tom = { id: 2, firstName: 'Tom' },
- david = { id: 3, firstName: 'David' },
- brennain = { id: 4, firstName: 'Brennain' };
+ var yehuda = { id: 1, firstName: 'Yehuda' };
+ var tom = { id: 2, firstName: 'Tom' };
+ var david = { id: 3, firstName: 'David' };
+ var brennain = { id: 4, firstName: 'Brennain' };
run(function() {
select.set('content', Ember.A([yehuda, tom, david, brennain]));
@@ -239,10 +241,10 @@ test("selection can be set when multiple=true and prompt", function() {
});
test("multiple selections can be set when multiple=true", function() {
- var yehuda = { id: 1, firstName: 'Yehuda' },
- tom = { id: 2, firstName: 'Tom' },
- david = { id: 3, firstName: 'David' },
- brennain = { id: 4, firstName: 'Brennain' };
+ var yehuda = { id: 1, firstName: 'Yehuda' };
+ var tom = { id: 2, firstName: 'Tom' };
+ var david = { id: 3, firstName: 'David' };
+ var brennain = { id: 4, firstName: 'Brennain' };
run(function() {
select.set('content', Ember.A([yehuda, tom, david, brennain]));
@@ -265,11 +267,11 @@ test("multiple selections can be set when multiple=true", function() {
});
test("multiple selections can be set by changing in place the selection array when multiple=true", function() {
- var yehuda = { id: 1, firstName: 'Yehuda' },
- tom = { id: 2, firstName: 'Tom' },
- david = { id: 3, firstName: 'David' },
- brennain = { id: 4, firstName: 'Brennain' },
- selection = Ember.A([yehuda, tom]);
+ var yehuda = { id: 1, firstName: 'Yehuda' };
+ var tom = { id: 2, firstName: 'Tom' };
+ var david = { id: 3, firstName: 'David' };
+ var brennain = { id: 4, firstName: 'Brennain' };
+ var selection = Ember.A([yehuda, tom]);
run(function() {
select.set('content', Ember.A([yehuda, tom, david, brennain]));
@@ -296,11 +298,11 @@ test("multiple selections can be set by changing in place the selection array wh
test("multiple selections can be set indirectly via bindings and in-place when multiple=true (issue #1058)", function() {
var indirectContent = EmberObject.create();
- var yehuda = { id: 1, firstName: 'Yehuda' },
- tom = { id: 2, firstName: 'Tom' },
- david = { id: 3, firstName: 'David' },
- brennain = { id: 4, firstName: 'Brennain' },
- cyril = { id: 5, firstName: 'Cyril' };
+ var yehuda = { id: 1, firstName: 'Yehuda' };
+ var tom = { id: 2, firstName: 'Tom' };
+ var david = { id: 3, firstName: 'David' };
+ var brennain = { id: 4, firstName: 'Brennain' };
+ var cyril = { id: 5, firstName: 'Cyril' };
run(function() {
select.destroy(); // Destroy the existing select
@@ -437,11 +439,11 @@ test("select with group whose content is undefined doesn't breaks", function() {
});
test("selection uses the same array when multiple=true", function() {
- var yehuda = { id: 1, firstName: 'Yehuda' },
- tom = { id: 2, firstName: 'Tom' },
- david = { id: 3, firstName: 'David' },
- brennain = { id: 4, firstName: 'Brennain' },
- selection = Ember.A([yehuda, david]);
+ var yehuda = { id: 1, firstName: 'Yehuda' };
+ var tom = { id: 2, firstName: 'Tom' };
+ var david = { id: 3, firstName: 'David' };
+ var brennain = { id: 4, firstName: 'Brennain' };
+ var selection = Ember.A([yehuda, david]);
run(function() {
select.set('content', Ember.A([yehuda, tom, david, brennain]));
@@ -464,10 +466,10 @@ test("selection uses the same array when multiple=true", function() {
});
test("Ember.SelectedOption knows when it is selected when multiple=false", function() {
- var yehuda = { id: 1, firstName: 'Yehuda' },
- tom = { id: 2, firstName: 'Tom' },
- david = { id: 3, firstName: 'David' },
- brennain = { id: 4, firstName: 'Brennain' };
+ var yehuda = { id: 1, firstName: 'Yehuda' };
+ var tom = { id: 2, firstName: 'Tom' };
+ var david = { id: 3, firstName: 'David' };
+ var brennain = { id: 4, firstName: 'Brennain' };
run(function() {
select.set('content', Ember.A([yehuda, tom, david, brennain]));
@@ -486,10 +488,10 @@ test("Ember.SelectedOption knows when it is selected when multiple=false", funct
});
test("Ember.SelectedOption knows when it is selected when multiple=true", function() {
- var yehuda = { id: 1, firstName: 'Yehuda' },
- tom = { id: 2, firstName: 'Tom' },
- david = { id: 3, firstName: 'David' },
- brennain = { id: 4, firstName: 'Brennain' };
+ var yehuda = { id: 1, firstName: 'Yehuda' };
+ var tom = { id: 2, firstName: 'Tom' };
+ var david = { id: 3, firstName: 'David' };
+ var brennain = { id: 4, firstName: 'Brennain' };
run(function() {
select.set('content', Ember.A([yehuda, tom, david, brennain]));
@@ -526,8 +528,8 @@ test("Ember.SelectedOption knows when it is selected when multiple=true and opti
});
test("a prompt can be specified", function() {
- var yehuda = { id: 1, firstName: 'Yehuda' },
- tom = { id: 2, firstName: 'Tom' };
+ var yehuda = { id: 1, firstName: 'Yehuda' };
+ var tom = { id: 2, firstName: 'Tom' };
run(function() {
select.set('content', Ember.A([yehuda, tom]));
@@ -735,8 +737,8 @@ test("works from a template with bindings", function() {
});
test("upon content change, the DOM should reflect the selection (#481)", function() {
- var userOne = {name: 'Mike', options: Ember.A(['a', 'b']), selectedOption: 'a'},
- userTwo = {name: 'John', options: Ember.A(['c', 'd']), selectedOption: 'd'};
+ var userOne = {name: 'Mike', options: Ember.A(['a', 'b']), selectedOption: 'a'};
+ var userTwo = {name: 'John', options: Ember.A(['c', 'd']), selectedOption: 'd'};
view = EmberView.create({
user: userOne,
@@ -751,8 +753,8 @@ test("upon content change, the DOM should reflect the selection (#481)", functio
view.appendTo('#qunit-fixture');
});
- var select = view.get('select'),
- selectEl = select.$()[0];
+ var select = view.get('select');
+ var selectEl = select.$()[0];
equal(select.get('selection'), 'a', "Precond: Initial selection is correct");
equal(selectEl.selectedIndex, 0, "Precond: The DOM reflects the correct selection");
@@ -766,8 +768,8 @@ test("upon content change, the DOM should reflect the selection (#481)", functio
});
test("upon content change with Array-like content, the DOM should reflect the selection", function() {
- var tom = {id: 4, name: 'Tom'},
- sylvain = {id: 5, name: 'Sylvain'};
+ var tom = {id: 4, name: 'Tom'};
+ var sylvain = {id: 5, name: 'Sylvain'};
var proxy = ArrayProxy.create({
content: Ember.A(),
@@ -787,8 +789,8 @@ test("upon content change with Array-like content, the DOM should reflect the se
view.appendTo('#qunit-fixture');
});
- var select = view.get('select'),
- selectEl = select.$()[0];
+ var select = view.get('select');
+ var selectEl = select.$()[0];
equal(selectEl.selectedIndex, -1, "Precond: The DOM reflects the lack of selection");
@@ -811,8 +813,8 @@ function testValueBinding(templateString) {
view.appendTo('#qunit-fixture');
});
- var select = view.get('select'),
- selectEl = select.$()[0];
+ var select = view.get('select');
+ var selectEl = select.$()[0];
equal(view.get('val'), 'g', "Precond: Initial bound property is correct");
equal(select.get('value'), 'g', "Precond: Initial selection is correct"); | true |
Other | emberjs | ember.js | 984b42329eff7eed66c36a05d0d79fc54000cba7.json | Replace multiline variable assignments.
* ember-handlebars
* ember-extension-support
* ember-debug | packages/ember-handlebars/tests/handlebars_test.js | @@ -91,8 +91,8 @@ var appendView = function() {
run(function() { view.appendTo('#qunit-fixture'); });
};
-var originalLookup = Ember.lookup, lookup;
-var TemplateTests, container;
+var originalLookup = Ember.lookup;
+var TemplateTests, container, lookup;
/**
This module specifically tests integration with Handlebars and Ember-specific
@@ -397,8 +397,8 @@ test("View should bind properties in the parent context", function() {
});
test("using Handlebars helper that doesn't exist should result in an error", function() {
- var names = [{ name: 'Alex' }, { name: 'Stef' }],
- context = {
+ var names = [{ name: 'Alex' }, { name: 'Stef' }];
+ var context = {
content: A(names)
};
@@ -999,8 +999,9 @@ test("Child views created using the view helper and that have a viewName should
appendView();
- var parentView = firstChild(view),
- childView = firstGrandchild(view);
+ var parentView = firstChild(view);
+ var childView = firstGrandchild(view);
+
equal(get(parentView, 'ohai'), childView);
});
@@ -1575,8 +1576,8 @@ test("should be able to bind use {{bind-attr}} more than once on an element", fu
test("{{bindAttr}} is aliased to {{bind-attr}}", function() {
- var originalBindAttr = EmberHandlebars.helpers['bind-attr'],
- originalWarn = Ember.warn;
+ var originalBindAttr = EmberHandlebars.helpers['bind-attr'];
+ var originalWarn = Ember.warn;
Ember.warn = function(msg) {
equal(msg, "The 'bindAttr' view helper is deprecated in favor of 'bind-attr'", 'Warning called');
@@ -1911,8 +1912,9 @@ test("should be able to use unbound helper in #each helper (with objects)", func
});
test("should work with precompiled templates", function() {
- var templateString = EmberHandlebars.precompile("{{view.value}}"),
- compiledTemplate = EmberHandlebars.template(eval(templateString));
+ var templateString = EmberHandlebars.precompile("{{view.value}}");
+ var compiledTemplate = EmberHandlebars.template(eval(templateString));
+
view = EmberView.create({
value: "rendered",
template: compiledTemplate | true |
Other | emberjs | ember.js | 984b42329eff7eed66c36a05d0d79fc54000cba7.json | Replace multiline variable assignments.
* ember-handlebars
* ember-extension-support
* ember-debug | packages/ember-handlebars/tests/helpers/debug_test.js | @@ -5,7 +5,8 @@ import EmberView from "ember-views/views/view";
import EmberHandlebars from "ember-handlebars-compiler";
import { logHelper } from "ember-handlebars/helpers/debug";
-var originalLookup = Ember.lookup, lookup;
+var originalLookup = Ember.lookup;
+var lookup;
var originalLog, logCalls;
var originalLogHelper;
var view; | true |
Other | emberjs | ember.js | 984b42329eff7eed66c36a05d0d79fc54000cba7.json | Replace multiline variable assignments.
* ember-handlebars
* ember-extension-support
* ember-debug | packages/ember-handlebars/tests/helpers/each_test.js | @@ -23,7 +23,8 @@ function templateFor(template) {
return EmberHandlebars.compile(template);
}
-var originalLookup = Ember.lookup, lookup;
+var originalLookup = Ember.lookup;
+var lookup;
QUnit.module("the #each helper", {
setup: function() {
@@ -276,8 +277,8 @@ test("itemController specified in template gets a parentController property", fu
controllerName: computed(function() {
return "controller:" + get(this, 'model.name') + ' of ' + get(this, 'parentController.company');
})
- }),
- parentController = {
+ });
+ var parentController = {
container: container,
company: 'Yapp'
};
@@ -304,8 +305,8 @@ test("itemController specified in ArrayController gets a parentController proper
controllerName: computed(function() {
return "controller:" + get(this, 'model.name') + ' of ' + get(this, 'parentController.company');
})
- }),
- PeopleController = ArrayController.extend({
+ });
+ var PeopleController = ArrayController.extend({
model: people,
itemController: 'person',
company: 'Yapp'
@@ -332,16 +333,16 @@ test("itemController's parentController property, when the ArrayController has a
controllerName: computed(function() {
return "controller:" + get(this, 'model.name') + ' of ' + get(this, 'parentController.company');
})
- }),
- PeopleController = ArrayController.extend({
+ });
+ var PeopleController = ArrayController.extend({
model: people,
itemController: 'person',
parentController: computed(function(){
return this.container.lookup('controller:company');
}),
company: 'Yapp'
- }),
- CompanyController = EmberController.extend();
+ });
+ var CompanyController = EmberController.extend();
container.register('controller:company', CompanyController);
container.register('controller:people', PeopleController);
@@ -558,8 +559,8 @@ test("#each accepts a name binding", function() {
test("#each accepts a name binding and does not change the context", function() {
var controller = EmberController.create({
name: 'bob the controller'
- }),
- obj = EmberObject.create({
+ });
+ var obj = EmberObject.create({
name: 'henry the item'
});
@@ -728,14 +729,14 @@ test("itemController specified in ArrayController with name binding does not cha
controllerName: computed(function() {
return "controller:" + get(this, 'model.name') + ' of ' + get(this, 'parentController.company');
})
- }),
- PeopleController = ArrayController.extend({
+ });
+ var PeopleController = ArrayController.extend({
model: people,
itemController: 'person',
company: 'Yapp',
controllerName: 'controller:people'
- }),
- container = new Container();
+ });
+ var container = new Container();
container.register('controller:people', PeopleController);
container.register('controller:person', PersonController); | true |
Other | emberjs | ember.js | 984b42329eff7eed66c36a05d0d79fc54000cba7.json | Replace multiline variable assignments.
* ember-handlebars
* ember-extension-support
* ember-debug | packages/ember-handlebars/tests/helpers/partial_test.js | @@ -8,8 +8,8 @@ import EmberHandlebars from "ember-handlebars-compiler";
var compile = EmberHandlebars.compile;
-var MyApp;
-var originalLookup = Ember.lookup, lookup, TemplateTests, view, container;
+var MyApp, lookup, TemplateTests, view, container;
+var originalLookup = Ember.lookup;
QUnit.module("Support for {{partial}} helper", {
setup: function() { | true |
Other | emberjs | ember.js | 984b42329eff7eed66c36a05d0d79fc54000cba7.json | Replace multiline variable assignments.
* ember-handlebars
* ember-extension-support
* ember-debug | packages/ember-handlebars/tests/helpers/template_test.js | @@ -7,8 +7,8 @@ var trim = jQuery.trim;
import Container from "ember-runtime/system/container";
import EmberHandlebars from "ember-handlebars-compiler";
-var MyApp;
-var originalLookup = Ember.lookup, lookup, TemplateTests, view, container;
+var MyApp, lookup, TemplateTests, view, container;
+var originalLookup = Ember.lookup;
QUnit.module("Support for {{template}} helper", {
setup: function() { | true |
Other | emberjs | ember.js | 984b42329eff7eed66c36a05d0d79fc54000cba7.json | Replace multiline variable assignments.
* ember-handlebars
* ember-extension-support
* ember-debug | packages/ember-handlebars/tests/helpers/unbound_test.js | @@ -17,9 +17,8 @@ function appendView(view) {
run(function() { view.appendTo('#qunit-fixture'); });
}
-var view;
-var originalLookup = Ember.lookup, lookup;
-var container;
+var view, lookup, container;
+var originalLookup = Ember.lookup;
QUnit.module("Handlebars {{#unbound}} helper -- classic single-property usage", {
setup: function() { | true |
Other | emberjs | ember.js | 984b42329eff7eed66c36a05d0d79fc54000cba7.json | Replace multiline variable assignments.
* ember-handlebars
* ember-extension-support
* ember-debug | packages/ember-handlebars/tests/helpers/with_test.js | @@ -15,8 +15,8 @@ function appendView(view) {
run(function() { view.appendTo('#qunit-fixture'); });
}
-var view;
-var originalLookup = Ember.lookup, lookup;
+var view, lookup;
+var originalLookup = Ember.lookup;
QUnit.module("Handlebars {{#with}} helper", {
setup: function() { | true |
Other | emberjs | ember.js | 984b42329eff7eed66c36a05d0d79fc54000cba7.json | Replace multiline variable assignments.
* ember-handlebars
* ember-extension-support
* ember-debug | packages/ember-handlebars/tests/helpers/yield_test.js | @@ -11,7 +11,8 @@ import { A } from "ember-runtime/system/native_array";
import Component from "ember-views/views/component";
import EmberError from "ember-metal/error";
-var originalLookup = Ember.lookup, lookup, TemplateTests, view, container;
+var originalLookup = Ember.lookup;
+var lookup, TemplateTests, view, container;
QUnit.module("Support for {{yield}} helper", {
setup: function() {
@@ -77,7 +78,8 @@ test("templates should yield to block, when the yield is embedded in a hierarchy
layout: EmberHandlebars.compile('<div class="times">{{#each view.index}}{{yield}}{{/each}}</div>'),
n: null,
index: computed(function() {
- var n = get(this, 'n'), indexArray = A();
+ var n = get(this, 'n');
+ var indexArray = A();
for (var i=0; i < n; i++) {
indexArray[i] = i;
} | true |
Other | emberjs | ember.js | 984b42329eff7eed66c36a05d0d79fc54000cba7.json | Replace multiline variable assignments.
* ember-handlebars
* ember-extension-support
* ember-debug | packages/ember-handlebars/tests/loader_test.js | @@ -3,7 +3,8 @@ import run from "ember-metal/run_loop";
import EmberView from "ember-views/views/view";
var trim = jQuery.trim;
-var originalLookup = Ember.lookup, lookup, Tobias, App, view;
+var originalLookup = Ember.lookup;
+var lookup, Tobias, App, view;
QUnit.module("test Ember.Handlebars.bootstrap", {
setup: function() { | true |
Other | emberjs | ember.js | 984b42329eff7eed66c36a05d0d79fc54000cba7.json | Replace multiline variable assignments.
* ember-handlebars
* ember-extension-support
* ember-debug | packages/ember-handlebars/tests/views/collection_view_test.js | @@ -28,7 +28,8 @@ function nthChild(view, nth) {
var firstChild = nthChild;
-var originalLookup = Ember.lookup, lookup, TemplateTests, view;
+var originalLookup = Ember.lookup;
+var lookup, TemplateTests, view;
QUnit.module("ember-handlebars/tests/views/collection_view_test", {
setup: function() { | true |
Other | emberjs | ember.js | 1b1477d47626373a7c35dd6338344f052bb17e0b.json | Remove some multiline var declarations.
Conflicts:
packages/ember-application/lib/ext/controller.js
packages/ember-application/tests/system/initializers_test.js
packages/ember-handlebars-compiler/tests/precompile_type_test.js | packages/container/tests/container_test.js | @@ -165,8 +165,8 @@ test("A container lookup has access to the container", function() {
});
test("Throw exception when trying to inject `type:thing` on all type(s)", function(){
- var container = new Container(),
- PostController = factory();
+ var container = new Container();
+ var PostController = factory();
container.register('controller:post', PostController);
@@ -508,9 +508,9 @@ test("cannot register an `undefined` factory", function(){
});
test("can re-register a factory", function(){
- var container = new Container(),
- FirstApple = factory('first'),
- SecondApple = factory('second');
+ var container = new Container();
+ var FirstApple = factory('first');
+ var SecondApple = factory('second');
container.register('controller:apple', FirstApple);
container.register('controller:apple', SecondApple);
@@ -519,9 +519,9 @@ test("can re-register a factory", function(){
});
test("cannot re-register a factory if has been looked up", function(){
- var container = new Container(),
- FirstApple = factory('first'),
- SecondApple = factory('second');
+ var container = new Container();
+ var FirstApple = factory('first');
+ var SecondApple = factory('second');
container.register('controller:apple', FirstApple);
ok(container.lookup('controller:apple') instanceof FirstApple);
@@ -537,9 +537,9 @@ test("cannot re-register a factory if has been looked up", function(){
test('container.has should not accidentally cause injections on that factory to be run. (Mitigate merely on observing)', function(){
expect(1);
- var container = new Container(),
- FirstApple = factory('first'),
- SecondApple = factory('second');
+ var container = new Container();
+ var FirstApple = factory('first');
+ var SecondApple = factory('second');
SecondApple.extend = function(a,b,c) {
ok(false, 'should not extend or touch the injected model, merely to inspect existence of another');
@@ -573,9 +573,9 @@ test('once resolved, always return the same result', function() {
test('once looked up, assert if an injection is registered for the entry', function() {
expect(1);
- var container = new Container(),
- Apple = factory(),
- Worm = factory();
+ var container = new Container();
+ var Apple = factory();
+ var Worm = factory();
container.register('apple:main', Apple);
container.register('worm:main', Worm);
@@ -588,9 +588,9 @@ test('once looked up, assert if an injection is registered for the entry', funct
test("Once looked up, assert if a factoryInjection is registered for the factory", function() {
expect(1);
- var container = new Container(),
- Apple = factory(),
- Worm = factory();
+ var container = new Container();
+ var Apple = factory();
+ var Worm = factory();
container.register('apple:main', Apple);
container.register('worm:main', Worm); | true |
Other | emberjs | ember.js | 1b1477d47626373a7c35dd6338344f052bb17e0b.json | Remove some multiline var declarations.
Conflicts:
packages/ember-application/lib/ext/controller.js
packages/ember-application/tests/system/initializers_test.js
packages/ember-handlebars-compiler/tests/precompile_type_test.js | packages/ember-application/tests/system/initializers_test.js | @@ -80,39 +80,40 @@ test("initializers can be registered in a specified order", function() {
test("initializers can have multiple dependencies", function () {
var order = [];
var a = {
- name: "a",
- before: "b",
- initialize: function(container) {
- order.push('a');
- }
- };
+ name: "a",
+ before: "b",
+ initialize: function(container) {
+ order.push('a');
+ }
+ };
var b = {
- name: "b",
- initialize: function(container) {
- order.push('b');
- }
- };
+ name: "b",
+ initialize: function(container) {
+ order.push('b');
+ }
+ };
var c = {
- name: "c",
- after: "b",
- initialize: function(container) {
- order.push('c');
- }
- };
+ name: "c",
+ after: "b",
+ initialize: function(container) {
+ order.push('c');
+ }
+ };
var afterB = {
- name: "after b",
- after: "b",
- initialize: function(container) {
- order.push("after b");
- }
- };
+ name: "after b",
+ after: "b",
+ initialize: function(container) {
+ order.push("after b");
+ }
+ };
var afterC = {
- name: "after c",
- after: "c",
- initialize: function(container) {
- order.push("after c");
- }
- };
+ name: "after c",
+ after: "c",
+ initialize: function(container) {
+ order.push("after c");
+ }
+ };
+
Application.initializer(b);
Application.initializer(a);
Application.initializer(afterC); | true |
Other | emberjs | ember.js | 1b1477d47626373a7c35dd6338344f052bb17e0b.json | Remove some multiline var declarations.
Conflicts:
packages/ember-application/lib/ext/controller.js
packages/ember-application/tests/system/initializers_test.js
packages/ember-handlebars-compiler/tests/precompile_type_test.js | packages/ember-extension-support/lib/data_adapter.js | @@ -132,8 +132,10 @@ export default EmberObject.extend({
@return {Function} Method to call to remove all observers
*/
watchModelTypes: function(typesAdded, typesUpdated) {
- var modelTypes = this.getModelTypes(),
- self = this, typesToSend, releaseMethods = emberA();
+ var modelTypes = this.getModelTypes();
+ var self = this;
+ var releaseMethods = emberA();
+ var typesToSend;
typesToSend = modelTypes.map(function(type) {
var klass = type.klass;
@@ -274,7 +276,8 @@ export default EmberObject.extend({
*/
observeModelType: function(type, typesUpdated) {
- var self = this, records = this.getRecords(type);
+ var self = this;
+ var records = this.getRecords(type);
var onChange = function() {
typesUpdated([self.wrapModelType(type)]);
@@ -314,8 +317,9 @@ export default EmberObject.extend({
release: {Function} The function to remove observers
*/
wrapModelType: function(type, name) {
- var release, records = this.getRecords(type),
- typeToSend, self = this;
+ var records = this.getRecords(type);
+ var self = this;
+ var release, typeToSend;
typeToSend = {
name: name || type.toString(),
@@ -337,8 +341,9 @@ export default EmberObject.extend({
@return {Array} Array of model types
*/
getModelTypes: function() {
- var types, self = this,
- containerDebugAdapter = this.get('containerDebugAdapter');
+ var self = this;
+ var containerDebugAdapter = this.get('containerDebugAdapter');
+ var types;
if (containerDebugAdapter.canCatalogEntriesByType('model')) {
types = containerDebugAdapter.catalogEntriesByType('model');
@@ -369,9 +374,9 @@ export default EmberObject.extend({
@return {Array} Array of model type strings
*/
_getObjectsOnNamespaces: function() {
- var namespaces = emberA(Namespace.NAMESPACES),
- types = emberA(),
- self = this;
+ var namespaces = emberA(Namespace.NAMESPACES);
+ var types = emberA();
+ var self = this;
namespaces.forEach(function(namespace) {
for (var key in namespace) {
@@ -414,7 +419,9 @@ export default EmberObject.extend({
searchKeywords: {Array}
*/
wrapRecord: function(record) {
- var recordToSend = { object: record }, columnValues = {}, self = this;
+ var recordToSend = { object: record };
+ var columnValues = {};
+ var self = this;
recordToSend.columnValues = this.getRecordColumnValues(record);
recordToSend.searchKeywords = this.getRecordKeywords(record); | true |
Other | emberjs | ember.js | 1b1477d47626373a7c35dd6338344f052bb17e0b.json | Remove some multiline var declarations.
Conflicts:
packages/ember-application/lib/ext/controller.js
packages/ember-application/tests/system/initializers_test.js
packages/ember-handlebars-compiler/tests/precompile_type_test.js | packages/ember-extension-support/tests/data_adapter_test.js | @@ -66,15 +66,15 @@ test("Model types added with DefaultResolver", function() {
});
test("Model types added with custom container-debug-adapter", function() {
- var PostClass = Model.extend() ,
- StubContainerDebugAdapter = DefaultResolver.extend({
- canCatalogEntriesByType: function(type){
- return true;
- },
- catalogEntriesByType: function(type){
- return [PostClass];
- }
- });
+ var PostClass = Model.extend();
+ var StubContainerDebugAdapter = DefaultResolver.extend({
+ canCatalogEntriesByType: function(type){
+ return true;
+ },
+ catalogEntriesByType: function(type){
+ return [PostClass];
+ }
+ });
App.__container__.register('container-debug-adapter:main', StubContainerDebugAdapter);
adapter = App.__container__.lookup('data-adapter:main'); | true |
Other | emberjs | ember.js | 1b1477d47626373a7c35dd6338344f052bb17e0b.json | Remove some multiline var declarations.
Conflicts:
packages/ember-application/lib/ext/controller.js
packages/ember-application/tests/system/initializers_test.js
packages/ember-handlebars-compiler/tests/precompile_type_test.js | packages/ember-handlebars-compiler/lib/main.js | @@ -206,14 +206,14 @@ EmberHandlebars.JavaScriptCompiler.prototype.appendToBuffer = function(string) {
// This can go away once the following is closed:
// https://github.com/wycats/handlebars.js/issues/634
-var DOT_LOOKUP_REGEX = /helpers\.(.*?)\)/,
- BRACKET_STRING_LOOKUP_REGEX = /helpers\['(.*?)'/,
- INVOCATION_SPLITTING_REGEX = /(.*blockHelperMissing\.call\(.*)(stack[0-9]+)(,.*)/;
+var DOT_LOOKUP_REGEX = /helpers\.(.*?)\)/;
+var BRACKET_STRING_LOOKUP_REGEX = /helpers\['(.*?)'/;
+var INVOCATION_SPLITTING_REGEX = /(.*blockHelperMissing\.call\(.*)(stack[0-9]+)(,.*)/;
EmberHandlebars.JavaScriptCompiler.stringifyLastBlockHelperMissingInvocation = function(source) {
- var helperInvocation = source[source.length - 1],
- helperName = (DOT_LOOKUP_REGEX.exec(helperInvocation) || BRACKET_STRING_LOOKUP_REGEX.exec(helperInvocation))[1],
- matches = INVOCATION_SPLITTING_REGEX.exec(helperInvocation);
+ var helperInvocation = source[source.length - 1];
+ var helperName = (DOT_LOOKUP_REGEX.exec(helperInvocation) || BRACKET_STRING_LOOKUP_REGEX.exec(helperInvocation))[1];
+ var matches = INVOCATION_SPLITTING_REGEX.exec(helperInvocation);
source[source.length - 1] = matches[1] + "'" + helperName + "'" + matches[3];
}; | true |
Other | emberjs | ember.js | 1b1477d47626373a7c35dd6338344f052bb17e0b.json | Remove some multiline var declarations.
Conflicts:
packages/ember-application/lib/ext/controller.js
packages/ember-application/tests/system/initializers_test.js
packages/ember-handlebars-compiler/tests/precompile_type_test.js | packages/ember-handlebars-compiler/tests/block_helper_missing_test.js | @@ -1,7 +1,7 @@
import EmberHandlebars from "ember-handlebars-compiler";
-var stringify = EmberHandlebars.JavaScriptCompiler.stringifyLastBlockHelperMissingInvocation,
- s;
+var stringify = EmberHandlebars.JavaScriptCompiler.stringifyLastBlockHelperMissingInvocation;
+var s;
QUnit.module("stringifyLastBlockHelperMissingInvocation", {
setup: function() { | true |
Other | emberjs | ember.js | 1b1477d47626373a7c35dd6338344f052bb17e0b.json | Remove some multiline var declarations.
Conflicts:
packages/ember-application/lib/ext/controller.js
packages/ember-application/tests/system/initializers_test.js
packages/ember-handlebars-compiler/tests/precompile_type_test.js | packages/ember-handlebars-compiler/tests/precompile_type_test.js | @@ -1,8 +1,8 @@
import EmberHandlebars from "ember-handlebars-compiler";
-var precompile = EmberHandlebars.precompile,
- parse = EmberHandlebars.parse,
- template = 'Hello World',
- result;
+var precompile = EmberHandlebars.precompile;
+var parse = EmberHandlebars.parse;
+var template = 'Hello World';
+var result;
QUnit.module("Ember.Handlebars.precompileType");
| true |
Other | emberjs | ember.js | 1b1477d47626373a7c35dd6338344f052bb17e0b.json | Remove some multiline var declarations.
Conflicts:
packages/ember-application/lib/ext/controller.js
packages/ember-application/tests/system/initializers_test.js
packages/ember-handlebars-compiler/tests/precompile_type_test.js | packages/ember-handlebars/lib/component_lookup.js | @@ -5,9 +5,9 @@ var ComponentLookup = EmberObject.extend({
container = container || this.container;
- var fullName = 'component:' + name,
- templateFullName = 'template:components/' + name,
- templateRegistered = container && container.has(templateFullName);
+ var fullName = 'component:' + name;
+ var templateFullName = 'template:components/' + name;
+ var templateRegistered = container && container.has(templateFullName);
if (templateRegistered) {
container.injection(fullName, 'layout', templateFullName); | true |
Other | emberjs | ember.js | 1b1477d47626373a7c35dd6338344f052bb17e0b.json | Remove some multiline var declarations.
Conflicts:
packages/ember-application/lib/ext/controller.js
packages/ember-application/tests/system/initializers_test.js
packages/ember-handlebars-compiler/tests/precompile_type_test.js | packages/ember-handlebars/lib/controls.js | @@ -199,10 +199,10 @@ function _resolveOption(context, options, key) {
export function inputHelper(options) {
Ember.assert('You can only pass attributes to the `input` helper, not arguments', arguments.length < 2);
- var hash = options.hash,
- types = options.hashTypes,
- inputType = _resolveOption(this, options, 'type'),
- onEvent = hash.on;
+ var hash = options.hash;
+ var types = options.hashTypes;
+ var inputType = _resolveOption(this, options, 'type');
+ var onEvent = hash.on;
delete hash.type;
delete hash.on;
@@ -405,8 +405,8 @@ export function inputHelper(options) {
export function textareaHelper(options) {
Ember.assert('You can only pass attributes to the `textarea` helper, not arguments', arguments.length < 2);
- var hash = options.hash,
- types = options.hashTypes;
+ var hash = options.hash;
+ var types = options.hashTypes;
return helpers.view.call(this, TextArea, options);
} | true |
Other | emberjs | ember.js | 1b1477d47626373a7c35dd6338344f052bb17e0b.json | Remove some multiline var declarations.
Conflicts:
packages/ember-application/lib/ext/controller.js
packages/ember-application/tests/system/initializers_test.js
packages/ember-handlebars-compiler/tests/precompile_type_test.js | packages/ember-handlebars/lib/controls/select.js | @@ -44,8 +44,8 @@ var SelectOption = View.extend({
},
selected: computed(function() {
- var content = get(this, 'content'),
- selection = get(this, 'parentView.selection');
+ var content = get(this, 'content');
+ var selection = get(this, 'parentView.selection');
if (get(this, 'parentView.multiple')) {
return selection && indexOf(selection, content.valueOf()) > -1;
} else {
@@ -534,11 +534,11 @@ var Select = View.extend({
}),
valueDidChange: observer('value', function() {
- var content = get(this, 'content'),
- value = get(this, 'value'),
- valuePath = get(this, 'optionValuePath').replace(/^content\.?/, ''),
- selectedValue = (valuePath ? get(this, 'selection.' + valuePath) : get(this, 'selection')),
- selection;
+ var content = get(this, 'content');
+ var value = get(this, 'value');
+ var valuePath = get(this, 'optionValuePath').replace(/^content\.?/, '');
+ var selectedValue = (valuePath ? get(this, 'selection.' + valuePath) : get(this, 'selection'));
+ var selection;
if (value !== selectedValue) {
selection = content ? content.find(function(obj) {
@@ -561,9 +561,9 @@ var Select = View.extend({
},
_changeSingle: function() {
- var selectedIndex = this.$()[0].selectedIndex,
- content = get(this, 'content'),
- prompt = get(this, 'prompt');
+ var selectedIndex = this.$()[0].selectedIndex;
+ var content = get(this, 'content');
+ var prompt = get(this, 'prompt');
if (!content || !get(content, 'length')) { return; }
if (prompt && selectedIndex === 0) { set(this, 'selection', null); return; }
@@ -574,11 +574,11 @@ var Select = View.extend({
_changeMultiple: function() {
- var options = this.$('option:selected'),
- prompt = get(this, 'prompt'),
- offset = prompt ? 1 : 0,
- content = get(this, 'content'),
- selection = get(this, 'selection');
+ var options = this.$('option:selected');
+ var prompt = get(this, 'prompt');
+ var offset = prompt ? 1 : 0;
+ var content = get(this, 'content');
+ var selection = get(this, 'selection');
if (!content) { return; }
if (options) {
@@ -599,23 +599,23 @@ var Select = View.extend({
var el = this.get('element');
if (!el) { return; }
- var content = get(this, 'content'),
- selection = get(this, 'selection'),
- selectionIndex = content ? indexOf(content, selection) : -1,
- prompt = get(this, 'prompt');
+ var content = get(this, 'content');
+ var selection = get(this, 'selection');
+ var selectionIndex = content ? indexOf(content, selection) : -1;
+ var prompt = get(this, 'prompt');
if (prompt) { selectionIndex += 1; }
if (el) { el.selectedIndex = selectionIndex; }
},
_selectionDidChangeMultiple: function() {
- var content = get(this, 'content'),
- selection = get(this, 'selection'),
- selectedIndexes = content ? indexesOf(content, selection) : [-1],
- prompt = get(this, 'prompt'),
- offset = prompt ? 1 : 0,
- options = this.$('option'),
- adjusted;
+ var content = get(this, 'content');
+ var selection = get(this, 'selection');
+ var selectedIndexes = content ? indexesOf(content, selection) : [-1];
+ var prompt = get(this, 'prompt');
+ var offset = prompt ? 1 : 0;
+ var options = this.$('option');
+ var adjusted;
if (options) {
options.each(function() { | true |
Other | emberjs | ember.js | 1b1477d47626373a7c35dd6338344f052bb17e0b.json | Remove some multiline var declarations.
Conflicts:
packages/ember-application/lib/ext/controller.js
packages/ember-application/tests/system/initializers_test.js
packages/ember-handlebars-compiler/tests/precompile_type_test.js | packages/ember-handlebars/lib/controls/text_area.js | @@ -37,8 +37,8 @@ export default Component.extend(TextSupport, {
_updateElementValue: observer('value', function() {
// We do this check so cursor position doesn't get affected in IE
- var value = get(this, 'value'),
- $el = this.$();
+ var value = get(this, 'value');
+ var $el = this.$();
if ($el && value !== $el.val()) {
$el.val(value);
} | true |
Other | emberjs | ember.js | 1b1477d47626373a7c35dd6338344f052bb17e0b.json | Remove some multiline var declarations.
Conflicts:
packages/ember-application/lib/ext/controller.js
packages/ember-application/tests/system/initializers_test.js
packages/ember-handlebars-compiler/tests/precompile_type_test.js | packages/ember-handlebars/lib/controls/text_support.js | @@ -133,7 +133,7 @@ var TextSupport = Mixin.create(TargetActionSupport, {
},
/**
- Called when the text area is blurred.
+ Called when the text area is blurred.
Uses sendAction to send the `focus-out` action.
@@ -168,9 +168,9 @@ TextSupport.KEY_EVENTS = {
// sendAction semantics for TextField are different from
// the component semantics so this method normalizes them.
function sendAction(eventName, view, event) {
- var action = get(view, eventName),
- on = get(view, 'onEvent'),
- value = get(view, 'value');
+ var action = get(view, eventName);
+ var on = get(view, 'onEvent');
+ var value = get(view, 'value');
// back-compat support for keyPress as an event name even though
// it's also a method name that consumes the event (and therefore | true |
Other | emberjs | ember.js | 1b1477d47626373a7c35dd6338344f052bb17e0b.json | Remove some multiline var declarations.
Conflicts:
packages/ember-application/lib/ext/controller.js
packages/ember-application/tests/system/initializers_test.js
packages/ember-handlebars-compiler/tests/precompile_type_test.js | packages/ember-handlebars/lib/helpers/binding.js | @@ -757,8 +757,8 @@ function bindAttrHelper(options) {
// For each attribute passed, create an observer and emit the
// current value of the property as an attribute.
forEach.call(attrKeys, function(attr) {
- var path = attrs[attr],
- normalized;
+ var path = attrs[attr];
+ var normalized;
Ember.assert(fmt("You must provide an expression as the value of bound attribute. You specified: %@=%@", [attr, path]), typeof path === 'string');
| true |
Other | emberjs | ember.js | 1b1477d47626373a7c35dd6338344f052bb17e0b.json | Remove some multiline var declarations.
Conflicts:
packages/ember-application/lib/ext/controller.js
packages/ember-application/tests/system/initializers_test.js
packages/ember-handlebars-compiler/tests/precompile_type_test.js | packages/ember-handlebars/lib/helpers/debug.js | @@ -29,18 +29,18 @@ var a_slice = [].slice;
@param {String} property
*/
function logHelper() {
- var params = a_slice.call(arguments, 0, -1),
- options = arguments[arguments.length - 1],
- logger = Logger.log,
- values = [],
- allowPrimitives = true;
+ var params = a_slice.call(arguments, 0, -1);
+ var options = arguments[arguments.length - 1];
+ var logger = Logger.log;
+ var values = [];
+ var allowPrimitives = true;
for (var i = 0; i < params.length; i++) {
var type = options.types[i];
if (type === 'ID' || !allowPrimitives) {
- var context = (options.contexts && options.contexts[i]) || this,
- normalized = normalizePath(context, params[i], options.data);
+ var context = (options.contexts && options.contexts[i]) || this;
+ var normalized = normalizePath(context, params[i], options.data);
if (normalized.path === 'this') {
values.push(normalized.root); | true |
Other | emberjs | ember.js | 1b1477d47626373a7c35dd6338344f052bb17e0b.json | Remove some multiline var declarations.
Conflicts:
packages/ember-application/lib/ext/controller.js
packages/ember-application/tests/system/initializers_test.js
packages/ember-handlebars-compiler/tests/precompile_type_test.js | packages/ember-handlebars/lib/helpers/each.js | @@ -4,7 +4,6 @@
@submodule ember-handlebars
*/
import Ember from "ember-metal/core"; // Ember.assert;, Ember.K
-// var emberAssert = Ember.assert,
var K = Ember.K;
import EmberHandlebars from "ember-handlebars-compiler";
@@ -155,8 +154,8 @@ runInDebug( function() {
});
var GroupedEach = EmberHandlebars.GroupedEach = function(context, path, options) {
- var self = this,
- normalized = EmberHandlebars.normalizePath(context, path, options.data);
+ var self = this;
+ var normalized = EmberHandlebars.normalizePath(context, path, options.data);
this.context = context;
this.path = path;
@@ -227,11 +226,11 @@ GroupedEach.prototype = {
render: function() {
if (!this.content) { return; }
- var content = this.content,
- contentLength = get(content, 'length'),
- options = this.options,
- data = options.data,
- template = this.template;
+ var content = this.content;
+ var contentLength = get(content, 'length');
+ var options = this.options;
+ var data = options.data;
+ var template = this.template;
data.insideEach = true;
for (var i = 0; i < contentLength; i++) { | true |
Other | emberjs | ember.js | 4011c54de066748eca84c47c6bb5fb8548c61847.json | Add missing tests for Ember.DAG
I am not sure sure hoy to tag fixing the absence of tests. | packages/ember-application/tests/system/dag_test.js | @@ -0,0 +1,73 @@
+import DAG from "ember-application/system/dag";
+import EmberError from "ember-metal/error";
+
+QUnit.module("Ember.DAG");
+
+test("detects circular dependencies when added", function(){
+ var graph = new DAG();
+ graph.addEdges("eat omelette", 1);
+ graph.addEdges("buy eggs", 2) ;
+ graph.addEdges("fry omelette", 3, "eat omelette", "shake eggs");
+ graph.addEdges("shake eggs", 4, undefined, "buy eggs");
+ graph.addEdges("buy oil", 5, "fry omelette");
+ graph.addEdges("warm oil", 6, "fry omelette", "buy oil");
+ graph.addEdges("prepare salad", 7);
+ graph.addEdges("prepare the table", 8, "eat omelette");
+ graph.addEdges("clear the table", 9, undefined, "eat omelette");
+ graph.addEdges("say grace", 10, "eat omelette", "prepare the table");
+
+ raises(function(){
+ graph.addEdges("imposible", 11, "shake eggs", "eat omelette");
+ }, EmberError, "raises an error when a circular dependency is added");
+});
+
+test("#topsort iterates over the edges respecting precedence order", function(){
+ var graph = new DAG(),
+ names = [],
+ index = 0;
+
+ graph.addEdges("eat omelette", 1);
+ graph.addEdges("buy eggs", 2) ;
+ graph.addEdges("fry omelette", 3, "eat omelette", "shake eggs");
+ graph.addEdges("shake eggs", 4, undefined, "buy eggs");
+ graph.addEdges("buy oil", 5, "fry omelette");
+ graph.addEdges("warm oil", 6, "fry omelette", "buy oil");
+ graph.addEdges("prepare salad", 7);
+ graph.addEdges("prepare the table", 8, "eat omelette");
+ graph.addEdges("clear the table", 9, undefined, "eat omelette");
+ graph.addEdges("say grace", 10, "eat omelette", "prepare the table");
+
+
+ graph.topsort(function(vertex, path){
+ names[index] = vertex.name;
+ index++;
+ });
+
+ ok(names.indexOf("buy eggs") < names.indexOf("shake eggs"), "you need eggs to shake them");
+ ok(names.indexOf("buy oil") < names.indexOf("warm oil"), "you need oil to warm it");
+ ok(names.indexOf("eat omelette") < names.indexOf("clear the table"), "you clear the table after eat");
+ ok(names.indexOf("fry omelette") < names.indexOf("eat omelette"), "cook before eat");
+ ok(names.indexOf("shake eggs") < names.indexOf("fry omelette"), "shake before put into the pan");
+ ok(names.indexOf("prepare salad") > -1, "we don't know when we prepare the salad, but we do");
+});
+
+test("#addEdged supports both strings and arrays to specify precedences", function(){
+ var graph = new DAG(),
+ names = [],
+ index = 0;
+
+ graph.addEdges("eat omelette", 1);
+ graph.addEdges("buy eggs", 2) ;
+ graph.addEdges("fry omelette", 3, "eat omelette", "shake eggs");
+ graph.addEdges("shake eggs", 4, undefined, "buy eggs");
+ graph.addEdges("buy oil", 5, ["fry omelette", "shake eggs", "prepare the table"], ["warm oil"]);
+ graph.addEdges("prepare the table", 5, undefined, ["fry omelette"]);
+
+ graph.topsort(function(vertex, path){
+ names[index] = vertex.name;
+ index++;
+ });
+
+ deepEqual(names, ["buy eggs", "warm oil", "buy oil", "shake eggs", "fry omelette", "eat omelette", "prepare the table"]);
+});
+ | false |
Other | emberjs | ember.js | 951920f5655280b5dbaf4ceae7e9baf4672a7933.json | Use one variable assignment per declaration. | packages/ember-metal/lib/array.js | @@ -89,10 +89,9 @@ var lastIndexOf = defineNativeShim(ArrayPrototype.lastIndexOf, function(obj, fro
});
var filter = defineNativeShim(ArrayPrototype.filter, function (fn, context) {
- var i,
- value,
- result = [],
- length = this.length;
+ var i, value;
+ var result = [];
+ var length = this.length;
for (i = 0; i < length; i++) {
if (this.hasOwnProperty(i)) { | true |
Other | emberjs | ember.js | 951920f5655280b5dbaf4ceae7e9baf4672a7933.json | Use one variable assignment per declaration. | packages/ember-metal/lib/binding.js | @@ -160,7 +160,8 @@ Binding.prototype = {
connect: function(obj) {
Ember.assert('Must pass a valid object to Ember.Binding.connect()', !!obj);
- var fromPath = this._from, toPath = this._to;
+ var fromPath = this._from;
+ var toPath = this._to;
trySet(obj, toPath, getWithGlobals(obj, fromPath));
// add an observer on the object to be notified when the binding should be updated
@@ -240,7 +241,8 @@ Binding.prototype = {
var directionMap = this._directionMap;
var direction = directionMap.get(obj);
- var fromPath = this._from, toPath = this._to;
+ var fromPath = this._from;
+ var toPath = this._to;
directionMap.remove(obj);
@@ -288,7 +290,8 @@ mixinProperties(Binding, {
@static
*/
from: function() {
- var C = this, binding = new C();
+ var C = this;
+ var binding = new C();
return binding.from.apply(binding, arguments);
},
@@ -299,7 +302,8 @@ mixinProperties(Binding, {
@static
*/
to: function() {
- var C = this, binding = new C();
+ var C = this;
+ var binding = new C();
return binding.to.apply(binding, arguments);
},
@@ -320,7 +324,8 @@ mixinProperties(Binding, {
@return {Ember.Binding} `this`
*/
oneWay: function(from, flag) {
- var C = this, binding = new C(null, from);
+ var C = this;
+ var binding = new C(null, from);
return binding.oneWay(flag);
}
| true |
Other | emberjs | ember.js | 951920f5655280b5dbaf4ceae7e9baf4672a7933.json | Use one variable assignment per declaration. | packages/ember-metal/lib/chains.js | @@ -4,9 +4,9 @@ import {meta} from "ember-metal/utils";
import {forEach} from "ember-metal/array";
import {watchKey, unwatchKey} from "ember-metal/watch_key";
-var metaFor = meta,
- warn = Ember.warn,
- FIRST_KEY = /^([^\.]+)/;
+var metaFor = meta;
+var warn = Ember.warn;
+var FIRST_KEY = /^([^\.]+)/;
function firstKey(path) {
return path.match(FIRST_KEY)[0];
@@ -31,7 +31,8 @@ export function flushPendingChains() {
function addChainWatcher(obj, keyName, node) {
if (!obj || ('object' !== typeof obj)) { return; } // nothing to do
- var m = metaFor(obj), nodes = m.chainWatchers;
+ var m = metaFor(obj);
+ var nodes = m.chainWatchers;
if (!m.hasOwnProperty('chainWatchers')) {
nodes = m.chainWatchers = {};
@@ -136,8 +137,10 @@ ChainNodePrototype.destroy = function() {
// copies a top level object only
ChainNodePrototype.copy = function(obj) {
- var ret = new ChainNode(null, null, obj),
- paths = this._paths, path;
+ var ret = new ChainNode(null, null, obj);
+ var paths = this._paths;
+ var path;
+
for (path in paths) {
if (paths[path] <= 0) { continue; } // this check will also catch non-number vals.
ret.add(path);
@@ -223,7 +226,8 @@ ChainNodePrototype.chain = function(key, path, src) {
};
ChainNodePrototype.unchain = function(key, path) {
- var chains = this._chains, node = chains[key];
+ var chains = this._chains;
+ var node = chains[key];
// unchain rest of path first...
if (path && path.length>1) { | true |
Other | emberjs | ember.js | 951920f5655280b5dbaf4ceae7e9baf4672a7933.json | Use one variable assignment per declaration. | packages/ember-metal/lib/computed.js | @@ -27,8 +27,8 @@ import {
Ember.warn("The CP_DEFAULT_CACHEABLE flag has been removed and computed properties are always cached by default. Use `volatile` if you don't want caching.", Ember.ENV.CP_DEFAULT_CACHEABLE !== false);
-var metaFor = meta,
- a_slice = [].slice;
+var metaFor = meta;
+var a_slice = [].slice;
function UNDEFINED() { }
| true |
Other | emberjs | ember.js | 951920f5655280b5dbaf4ceae7e9baf4672a7933.json | Use one variable assignment per declaration. | packages/ember-metal/lib/events.js | @@ -10,10 +10,12 @@ import {
} from "ember-metal/utils";
import { create } from "ember-metal/platform";
-var a_slice = [].slice,
- metaFor = meta,
- /* listener flags */
- ONCE = 1, SUSPENDED = 2;
+var a_slice = [].slice;
+var metaFor = meta;
+
+/* listener flags */
+var ONCE = 1;
+var SUSPENDED = 2;
/*
@@ -71,15 +73,15 @@ function actionsFor(obj, eventName) {
}
export function listenersUnion(obj, eventName, otherActions) {
- var meta = obj['__ember_meta__'],
- actions = meta && meta.listeners && meta.listeners[eventName];
+ var meta = obj['__ember_meta__'];
+ var actions = meta && meta.listeners && meta.listeners[eventName];
if (!actions) { return; }
for (var i = actions.length - 3; i >= 0; i -= 3) {
- var target = actions[i],
- method = actions[i+1],
- flags = actions[i+2],
- actionIndex = indexOf(otherActions, target, method);
+ var target = actions[i];
+ var method = actions[i+1];
+ var flags = actions[i+2];
+ var actionIndex = indexOf(otherActions, target, method);
if (actionIndex === -1) {
otherActions.push(target, method, flags);
@@ -94,10 +96,10 @@ export function listenersDiff(obj, eventName, otherActions) {
if (!actions) { return; }
for (var i = actions.length - 3; i >= 0; i -= 3) {
- var target = actions[i],
- method = actions[i+1],
- flags = actions[i+2],
- actionIndex = indexOf(otherActions, target, method);
+ var target = actions[i];
+ var method = actions[i+1];
+ var flags = actions[i+2];
+ var actionIndex = indexOf(otherActions, target, method);
if (actionIndex !== -1) { continue; }
@@ -127,9 +129,9 @@ export function addListener(obj, eventName, target, method, once) {
target = null;
}
- var actions = actionsFor(obj, eventName),
- actionIndex = indexOf(actions, target, method),
- flags = 0;
+ var actions = actionsFor(obj, eventName);
+ var actionIndex = indexOf(actions, target, method);
+ var flags = 0;
if (once) flags |= ONCE;
@@ -163,8 +165,8 @@ function removeListener(obj, eventName, target, method) {
}
function _removeListener(target, method) {
- var actions = actionsFor(obj, eventName),
- actionIndex = indexOf(actions, target, method);
+ var actions = actionsFor(obj, eventName);
+ var actionIndex = indexOf(actions, target, method);
// action doesn't exist, give up silently
if (actionIndex === -1) { return; }
@@ -179,8 +181,8 @@ function removeListener(obj, eventName, target, method) {
if (method) {
_removeListener(target, method);
} else {
- var meta = obj['__ember_meta__'],
- actions = meta && meta.listeners && meta.listeners[eventName];
+ var meta = obj['__ember_meta__'];
+ var actions = meta && meta.listeners && meta.listeners[eventName];
if (!actions) { return; }
for (var i = actions.length - 3; i >= 0; i -= 3) {
@@ -213,8 +215,8 @@ export function suspendListener(obj, eventName, target, method, callback) {
target = null;
}
- var actions = actionsFor(obj, eventName),
- actionIndex = indexOf(actions, target, method);
+ var actions = actionsFor(obj, eventName);
+ var actionIndex = indexOf(actions, target, method);
if (actionIndex !== -1) {
actions[actionIndex+2] |= SUSPENDED; // mark the action as suspended | true |
Other | emberjs | ember.js | 951920f5655280b5dbaf4ceae7e9baf4672a7933.json | Use one variable assignment per declaration. | packages/ember-metal/lib/expand_properties.js | @@ -6,8 +6,8 @@ import { forEach } from 'ember-metal/enumerable_utils';
@module ember-metal
*/
-var BRACE_EXPANSION = /^((?:[^\.]*\.)*)\{(.*)\}$/,
- SPLIT_REGEX = /\{|\}/;
+var BRACE_EXPANSION = /^((?:[^\.]*\.)*)\{(.*)\}$/;
+var SPLIT_REGEX = /\{|\}/;
/**
Expands `pattern`, invoking `callback` for each expansion.
@@ -62,8 +62,8 @@ function oldExpandProperties(pattern, callback) {
function newExpandProperties(pattern, callback) {
if ('string' === Ember.typeOf(pattern)) {
- var parts = pattern.split(SPLIT_REGEX),
- properties = [parts];
+ var parts = pattern.split(SPLIT_REGEX);
+ var properties = [parts];
forEach(parts, function(part, index) {
if (part.indexOf(',') >= 0) { | true |
Other | emberjs | ember.js | 951920f5655280b5dbaf4ceae7e9baf4672a7933.json | Use one variable assignment per declaration. | packages/ember-metal/lib/instrumentation.js | @@ -47,7 +47,8 @@ import { tryCatchFinally } from "ember-metal/utils";
@namespace Ember
@static
*/
-var subscribers = [], cache = {};
+var subscribers = [];
+var cache = {};
var populateListeners = function(name) {
var listeners = [], subscriber; | true |
Other | emberjs | ember.js | 951920f5655280b5dbaf4ceae7e9baf4672a7933.json | Use one variable assignment per declaration. | packages/ember-metal/lib/mixin.js | @@ -36,13 +36,13 @@ import {
removeListener
} from "ember-metal/events";
-var REQUIRED,
- a_map = map,
- a_indexOf = indexOf,
- a_forEach = forEach,
- a_slice = [].slice,
- o_create = create,
- metaFor = meta;
+var REQUIRED;
+var a_map = map;
+var a_indexOf = indexOf;
+var a_forEach = forEach;
+var a_slice = [].slice;
+var o_create = create;
+var metaFor = meta;
function superFunction(){
var ret, func = this.__nextSuper;
@@ -55,7 +55,8 @@ function superFunction(){
}
function mixinsMeta(obj) {
- var m = metaFor(obj, true), ret = m.mixins;
+ var m = metaFor(obj, true);
+ var ret = m.mixins;
if (!ret) {
ret = m.mixins = {};
} else if (!m.hasOwnProperty('mixins')) {
@@ -179,8 +180,8 @@ function applyMergedProperties(obj, key, value, values) {
if (!baseValue) { return value; }
- var newBase = merge({}, baseValue),
- hasFunction = false;
+ var newBase = merge({}, baseValue);
+ var hasFunction = false;
for (var prop in value) {
if (!value.hasOwnProperty(prop)) { continue; }
@@ -352,8 +353,11 @@ function replaceObserversAndListeners(obj, key, observerOrListener) {
}
function applyMixin(obj, mixins, partial) {
- var descs = {}, values = {}, m = metaFor(obj),
- key, value, desc, keys = [];
+ var descs = {};
+ var values = {};
+ var m = metaFor(obj);
+ var keys = [];
+ var key, value, desc;
obj._super = superFunction;
@@ -512,7 +516,8 @@ MixinPrototype.reopen = function() {
this.mixins = [];
}
- var len = arguments.length, mixins = this.mixins, idx;
+ var len = arguments.length;
+ var mixins = this.mixins, idx;
for(idx=0; idx < len; idx++) {
mixin = arguments[idx];
@@ -551,7 +556,8 @@ function _detect(curMixin, targetMixin, seen) {
seen[guid] = true;
if (curMixin === targetMixin) { return true; }
- var mixins = curMixin.mixins, loc = mixins ? mixins.length : 0;
+ var mixins = curMixin.mixins;
+ var loc = mixins ? mixins.length : 0;
while (--loc >= 0) {
if (_detect(mixins[loc], targetMixin, seen)) { return true; }
}
@@ -566,8 +572,8 @@ function _detect(curMixin, targetMixin, seen) {
MixinPrototype.detect = function(obj) {
if (!obj) { return false; }
if (obj instanceof Mixin) { return _detect(obj, this, {}); }
- var m = obj['__ember_meta__'],
- mixins = m && m.mixins;
+ var m = obj['__ember_meta__'];
+ var mixins = m && m.mixins;
if (mixins) {
return !!mixins[guidFor(this)];
}
@@ -595,7 +601,9 @@ function _keys(ret, mixin, seen) {
}
MixinPrototype.keys = function() {
- var keys = {}, seen = {}, ret = [];
+ var keys = {};
+ var seen = {};
+ var ret = [];
_keys(keys, this, seen);
for(var key in keys) {
if (keys.hasOwnProperty(key)) { ret.push(key); }
@@ -606,8 +614,9 @@ MixinPrototype.keys = function() {
// returns the mixins currently applied to the specified object
// TODO: Make Ember.mixin
Mixin.mixins = function(obj) {
- var m = obj['__ember_meta__'],
- mixins = m && m.mixins, ret = [];
+ var m = obj['__ember_meta__'];
+ var mixins = m && m.mixins;
+ var ret = [];
if (!mixins) { return ret; }
| true |
Other | emberjs | ember.js | 951920f5655280b5dbaf4ceae7e9baf4672a7933.json | Use one variable assignment per declaration. | packages/ember-metal/lib/observer_set.js | @@ -26,11 +26,11 @@ function ObserverSet() {
ObserverSet.prototype.add = function(sender, keyName, eventName) {
- var observerSet = this.observerSet,
- observers = this.observers,
- senderGuid = guidFor(sender),
- keySet = observerSet[senderGuid],
- index;
+ var observerSet = this.observerSet;
+ var observers = this.observers;
+ var senderGuid = guidFor(sender);
+ var keySet = observerSet[senderGuid];
+ var index;
if (!keySet) {
observerSet[senderGuid] = keySet = {}; | true |
Other | emberjs | ember.js | 951920f5655280b5dbaf4ceae7e9baf4672a7933.json | Use one variable assignment per declaration. | packages/ember-metal/lib/property_events.js | @@ -88,7 +88,8 @@ function dependentKeysWillChange(obj, depKey, meta) {
var deps;
if (meta && meta.deps && (deps = meta.deps[depKey])) {
- var seen = WILL_SEEN, top = !seen;
+ var seen = WILL_SEEN;
+ var top = !seen;
if (top) { seen = WILL_SEEN = {}; }
iterDeps(propertyWillChange, obj, deps, depKey, seen, meta);
if (top) { WILL_SEEN = null; }
@@ -101,7 +102,8 @@ function dependentKeysDidChange(obj, depKey, meta) {
var deps;
if (meta && meta.deps && (deps = meta.deps[depKey])) {
- var seen = DID_SEEN, top = !seen;
+ var seen = DID_SEEN;
+ var top = !seen;
if (top) { seen = DID_SEEN = {}; }
iterDeps(propertyDidChange, obj, deps, depKey, seen, meta);
if (top) { DID_SEEN = null; } | true |
Other | emberjs | ember.js | 951920f5655280b5dbaf4ceae7e9baf4672a7933.json | Use one variable assignment per declaration. | packages/ember-metal/lib/property_get.js | @@ -67,7 +67,8 @@ var get = function get(obj, keyName) {
return value;
}
- var meta = obj['__ember_meta__'], desc = meta && meta.descs[keyName], ret;
+ var meta = obj['__ember_meta__'];
+ var desc = meta && meta.descs[keyName], ret;
if (desc === undefined && isPath(keyName)) {
return _getPath(obj, keyName); | true |
Other | emberjs | ember.js | 951920f5655280b5dbaf4ceae7e9baf4672a7933.json | Use one variable assignment per declaration. | packages/ember-metal/lib/property_set.js | @@ -41,7 +41,8 @@ var set = function set(obj, keyName, value, tolerant) {
return setPath(obj, keyName, value, tolerant);
}
- var meta = obj['__ember_meta__'], desc = meta && meta.descs[keyName],
+ var meta = obj['__ember_meta__'];
+ var desc = meta && meta.descs[keyName],
isUnknown, currentValue;
if (desc === undefined && isPath(keyName)) { | true |
Other | emberjs | ember.js | 951920f5655280b5dbaf4ceae7e9baf4672a7933.json | Use one variable assignment per declaration. | packages/ember-metal/lib/watch_path.js | @@ -10,7 +10,8 @@ var metaFor = meta;
// chains inherited from the proto they will be cloned and reconfigured for
// the current object.
function chainsFor(obj, meta) {
- var m = meta || metaFor(obj), ret = m.chains;
+ var m = meta || metaFor(obj);
+ var ret = m.chains;
if (!ret) {
ret = m.chains = new ChainNode(null, null, obj);
} else if (ret.value() !== obj) {
@@ -23,7 +24,8 @@ export function watchPath(obj, keyPath, meta) {
// can't watch length on Array - it is special...
if (keyPath === 'length' && typeOf(obj) === 'array') { return; }
- var m = meta || metaFor(obj), watching = m.watching;
+ var m = meta || metaFor(obj);
+ var watching = m.watching;
if (!watching[keyPath]) { // activate watching first time
watching[keyPath] = 1;
@@ -34,7 +36,8 @@ export function watchPath(obj, keyPath, meta) {
}
export function unwatchPath(obj, keyPath, meta) {
- var m = meta || metaFor(obj), watching = m.watching;
+ var m = meta || metaFor(obj);
+ var watching = m.watching;
if (watching[keyPath] === 1) {
watching[keyPath] = 0; | true |
Other | emberjs | ember.js | 951920f5655280b5dbaf4ceae7e9baf4672a7933.json | Use one variable assignment per declaration. | packages/ember-metal/tests/binding/sync_test.js | @@ -14,7 +14,9 @@ import { defineProperty } from "ember-metal/properties";
QUnit.module("system/binding/sync_test.js");
testBoth("bindings should not sync twice in a single run loop", function(get, set) {
- var a, b, setValue, setCalled=0, getCalled=0;
+ var a, b, setValue;
+ var setCalled=0;
+ var getCalled=0;
run(function() {
a = {}; | true |
Other | emberjs | ember.js | 951920f5655280b5dbaf4ceae7e9baf4672a7933.json | Use one variable assignment per declaration. | packages/ember-metal/tests/computed_test.js | @@ -610,7 +610,8 @@ test('adding a computed property should show up in key iteration',function() {
});
testBoth("when setting a value after it had been retrieved empty don't pass function UNDEFINED as oldValue", function(get, set) {
- var obj = {}, oldValueIsNoFunction = true;
+ var obj = {};
+ var oldValueIsNoFunction = true;
defineProperty(obj, 'foo', computed(function(key, value, oldValue) {
if(typeof oldValue === 'function') {
@@ -644,12 +645,12 @@ testBoth('setting a watched computed property', function(get, set) {
return get(this, 'firstName') + ' ' + get(this, 'lastName');
}).property('firstName', 'lastName')
);
- var fullNameWillChange = 0,
- fullNameDidChange = 0,
- firstNameWillChange = 0,
- firstNameDidChange = 0,
- lastNameWillChange = 0,
- lastNameDidChange = 0;
+ var fullNameWillChange = 0;
+ var fullNameDidChange = 0;
+ var firstNameWillChange = 0;
+ var firstNameDidChange = 0;
+ var lastNameWillChange = 0;
+ var lastNameDidChange = 0;
addBeforeObserver(obj, 'fullName', function () {
fullNameWillChange++;
});
@@ -700,8 +701,8 @@ testBoth('setting a cached computed property that modifies the value you give it
return get(this, 'foo') + 1;
}).property('foo')
);
- var plusOneWillChange = 0,
- plusOneDidChange = 0;
+ var plusOneWillChange = 0;
+ var plusOneDidChange = 0;
addBeforeObserver(obj, 'plusOne', function () {
plusOneWillChange++;
});
@@ -728,7 +729,8 @@ testBoth('setting a cached computed property that modifies the value you give it
QUnit.module('computed - default setter');
testBoth("when setting a value on a computed property that doesn't handle sets", function(get, set) {
- var obj = {}, observerFired = false;
+ var obj = {};
+ var observerFired = false;
defineProperty(obj, 'foo', computed(function() {
return 'foo'; | true |
Other | emberjs | ember.js | 951920f5655280b5dbaf4ceae7e9baf4672a7933.json | Use one variable assignment per declaration. | packages/ember-metal/tests/enumerable_utils_test.js | @@ -3,7 +3,8 @@ import EnumerableUtils from 'ember-metal/enumerable_utils';
QUnit.module('Ember.EnumerableUtils.intersection');
test('returns an array of objects that appear in both enumerables', function() {
- var a = [1,2,3], b = [2,3,4], result;
+ var a = [1,2,3];
+ var b = [2,3,4], result;
result = EnumerableUtils.intersection(a, b);
| true |
Other | emberjs | ember.js | 951920f5655280b5dbaf4ceae7e9baf4672a7933.json | Use one variable assignment per declaration. | packages/ember-metal/tests/events_test.js | @@ -19,7 +19,8 @@ import {
QUnit.module('system/props/events_test');
test('listener should receive event - removing should remove', function() {
- var obj = {}, count = 0;
+ var obj = {};
+ var count = 0;
var F = function() { count++; };
addListener(obj, 'event!', F);
@@ -36,7 +37,8 @@ test('listener should receive event - removing should remove', function() {
});
test('listeners should be inherited', function() {
- var obj = {}, count = 0;
+ var obj = {};
+ var count = 0;
var F = function() { count++; };
addListener(obj, 'event!', F);
@@ -62,7 +64,8 @@ test('listeners should be inherited', function() {
test('adding a listener more than once should only invoke once', function() {
- var obj = {}, count = 0;
+ var obj = {};
+ var count = 0;
var F = function() { count++; };
addListener(obj, 'event!', F);
addListener(obj, 'event!', F);
@@ -138,7 +141,8 @@ test('adding a listener with string method should lookup method on event deliver
test('calling sendEvent with extra params should be passed to listeners', function() {
- var obj = {}, params = null;
+ var obj = {};
+ var params = null;
addListener(obj, 'event!', function() {
params = Array.prototype.slice.call(arguments);
});
@@ -166,7 +170,9 @@ test('implementing sendEvent on object should invoke', function() {
test('hasListeners tells you if there are listeners for a given event', function() {
- var obj = {}, F = function() {}, F2 = function() {};
+ var obj = {};
+ var F = function() {};
+ var F2 = function() {};
equal(hasListeners(obj, 'event!'), false, 'no listeners at first');
@@ -186,7 +192,9 @@ test('hasListeners tells you if there are listeners for a given event', function
});
test('calling removeListener without method should remove all listeners', function() {
- var obj = {}, F = function() {}, F2 = function() {};
+ var obj = {};
+ var F = function() {};
+ var F2 = function() {};
equal(hasListeners(obj, 'event!'), false, 'no listeners at first');
| true |
Other | emberjs | ember.js | 951920f5655280b5dbaf4ceae7e9baf4672a7933.json | Use one variable assignment per declaration. | packages/ember-metal/tests/instrumentation_test.js | @@ -17,7 +17,8 @@ QUnit.module("Ember Instrumentation", {
test("subscribing to a simple path receives the listener", function() {
expect(12);
- var sentPayload = {}, count = 0;
+ var sentPayload = {};
+ var count = 0;
subscribe("render", {
before: function(name, timestamp, payload) {
@@ -57,7 +58,8 @@ test("subscribing to a simple path receives the listener", function() {
test("returning a value from the before callback passes it to the after callback", function() {
expect(2);
- var passthru1 = {}, passthru2 = {};
+ var passthru1 = {};
+ var passthru2 = {};
subscribe("render", {
before: function(name, timestamp, payload) { | true |
Other | emberjs | ember.js | 951920f5655280b5dbaf4ceae7e9baf4672a7933.json | Use one variable assignment per declaration. | packages/ember-metal/tests/is_blank_test.js | @@ -3,8 +3,9 @@ import isBlank from 'ember-metal/is_blank';
QUnit.module("Ember.isBlank");
test("Ember.isBlank", function() {
- var string = "string", fn = function() {},
- object = {length: 0};
+ var string = "string";
+ var fn = function() {};
+ var object = {length: 0};
equal(true, isBlank(null), "for null");
equal(true, isBlank(undefined), "for undefined"); | true |
Other | emberjs | ember.js | 951920f5655280b5dbaf4ceae7e9baf4672a7933.json | Use one variable assignment per declaration. | packages/ember-metal/tests/is_empty_test.js | @@ -3,8 +3,9 @@ import isEmpty from 'ember-metal/is_empty';
QUnit.module("Ember.isEmpty");
test("Ember.isEmpty", function() {
- var string = "string", fn = function() {},
- object = {length: 0};
+ var string = "string";
+ var fn = function() {};
+ var object = {length: 0};
equal(true, isEmpty(null), "for null");
equal(true, isEmpty(undefined), "for undefined"); | true |
Other | emberjs | ember.js | 951920f5655280b5dbaf4ceae7e9baf4672a7933.json | Use one variable assignment per declaration. | packages/ember-metal/tests/is_none_test.js | @@ -3,7 +3,8 @@ import isNone from 'ember-metal/is_none';
QUnit.module("Ember.isNone");
test("Ember.isNone", function() {
- var string = "string", fn = function() {};
+ var string = "string";
+ var fn = function() {};
equal(true, isNone(null), "for null");
equal(true, isNone(undefined), "for undefined"); | true |
Other | emberjs | ember.js | 951920f5655280b5dbaf4ceae7e9baf4672a7933.json | Use one variable assignment per declaration. | packages/ember-metal/tests/is_present_test.js | @@ -4,8 +4,9 @@ if (Ember.FEATURES.isEnabled('ember-metal-is-present')) {
QUnit.module("Ember.isPresent");
test("Ember.isPresent", function() {
- var string = "string", fn = function() {},
- object = {length: 0};
+ var string = "string";
+ var fn = function() {};
+ var object = {length: 0};
equal(false, isPresent(), "for no params");
equal(false, isPresent(null), "for null"); | true |
Other | emberjs | ember.js | 951920f5655280b5dbaf4ceae7e9baf4672a7933.json | Use one variable assignment per declaration. | packages/ember-metal/tests/mixin/computed_test.js | @@ -61,8 +61,8 @@ test('calling set on overridden computed properties', function() {
var SuperMixin, SubMixin;
var obj;
- var superGetOccurred = false,
- superSetOccurred = false;
+ var superGetOccurred = false;
+ var superSetOccurred = false;
SuperMixin = Mixin.create({
aProp: computed(function(key, val) { | true |
Other | emberjs | ember.js | 951920f5655280b5dbaf4ceae7e9baf4672a7933.json | Use one variable assignment per declaration. | packages/ember-metal/tests/observer_test.js | @@ -75,7 +75,8 @@ testBoth('observer should fire when dependent property is modified', function(ge
});
testBoth('observer should continue to fire after dependent properties are accessed', function(get, set) {
- var observerCount = 0, obj = {};
+ var observerCount = 0;
+ var obj = {};
defineProperty(obj, 'prop', Ember.computed(function () { return Math.random(); }));
defineProperty(obj, 'anotherProp', Ember.computed('prop', function () { return get(this, 'prop') + Math.random(); }));
@@ -190,7 +191,8 @@ testBoth('observers watching multiple properties via brace expansion should fire
testBoth('nested observers should fire in order', function(get,set) {
var obj = { foo: 'foo', bar: 'bar' };
- var fooCount = 0, barCount = 0;
+ var fooCount = 0;
+ var barCount = 0;
addObserver(obj, 'foo' ,function() { fooCount++; });
addObserver(obj, 'bar', function() {
@@ -206,9 +208,16 @@ testBoth('nested observers should fire in order', function(get,set) {
});
testBoth('removing an chain observer on change should not fail', function(get,set) {
- var foo = { bar: 'bar' },
- obj1 = { foo: foo }, obj2 = { foo: foo }, obj3 = { foo: foo }, obj4 = { foo: foo },
- count1=0, count2=0, count3=0, count4=0;
+ var foo = { bar: 'bar' };
+ var obj1 = { foo: foo };
+ var obj2 = { foo: foo };
+ var obj3 = { foo: foo };
+ var obj4 = { foo: foo };
+ var count1=0;
+ var count2=0;
+ var count3=0;
+ var count4=0;
+
function observer1() { count1++; }
function observer2() { count2++; }
function observer3() {
@@ -233,9 +242,16 @@ testBoth('removing an chain observer on change should not fail', function(get,se
});
testBoth('removing an chain before observer on change should not fail', function(get,set) {
- var foo = { bar: 'bar' },
- obj1 = { foo: foo }, obj2 = { foo: foo }, obj3 = { foo: foo }, obj4 = { foo: foo },
- count1=0, count2=0, count3=0, count4=0;
+ var foo = { bar: 'bar' };
+ var obj1 = { foo: foo };
+ var obj2 = { foo: foo };
+ var obj3 = { foo: foo };
+ var obj4 = { foo: foo };
+ var count1=0;
+ var count2=0;
+ var count3=0;
+ var count4=0;
+
function observer1() { count1++; }
function observer2() { count2++; }
function observer3() {
@@ -464,7 +480,8 @@ testBoth('deferring property change notifications will not defer before observer
});
testBoth('implementing sendEvent on object should invoke when deferring property change notifications ends', function(get, set) {
- var count = 0, events = [];
+ var count = 0;
+ var events = [];
var obj = {
sendEvent: function(eventName) {
events.push(eventName);
@@ -1032,9 +1049,8 @@ testBoth('setting a cached computed property whose value has changed should trig
QUnit.module("Ember.immediateObserver");
testBoth("immediate observers should fire synchronously", function(get, set) {
- var obj = {},
- observerCalled = 0,
- mixin;
+ var obj = {};
+ var observerCalled = 0, mixin;
// explicitly create a run loop so we do not inadvertently
// trigger deferred behavior
@@ -1067,9 +1083,8 @@ testBoth("immediate observers should fire synchronously", function(get, set) {
if (Ember.EXTEND_PROTOTYPES) {
testBoth('immediate observers added declaratively via brace expansion fire synchronously', function (get, set) {
- var obj = {},
- observerCalled = 0,
- mixin;
+ var obj = {};
+ var observerCalled = 0, mixin;
// explicitly create a run loop so we do not inadvertently
// trigger deferred behavior
@@ -1101,9 +1116,8 @@ if (Ember.EXTEND_PROTOTYPES) {
}
testBoth('immediate observers watching multiple properties via brace expansion fire synchronously', function (get, set) {
- var obj = {},
- observerCalled = 0,
- mixin;
+ var obj = {};
+ var observerCalled = 0, mixin;
// explicitly create a run loop so we do not inadvertently
// trigger deferred behavior | true |
Other | emberjs | ember.js | 951920f5655280b5dbaf4ceae7e9baf4672a7933.json | Use one variable assignment per declaration. | packages/ember-metal/tests/performance_test.js | @@ -20,7 +20,8 @@ QUnit.module("Computed Properties - Number of times evaluated");
test("computed properties that depend on multiple properties should run only once per run loop", function() {
var obj = {a: 'a', b: 'b', c: 'c'};
- var cpCount = 0, obsCount = 0;
+ var cpCount = 0;
+ var obsCount = 0;
defineProperty(obj, 'abc', computed(function(key) {
cpCount++; | true |
Other | emberjs | ember.js | 951920f5655280b5dbaf4ceae7e9baf4672a7933.json | Use one variable assignment per declaration. | packages/ember-metal/tests/platform/defineProperty_test.js | @@ -71,7 +71,10 @@ test('defining a non enumerable property', function() {
// and setters don't do anything
if (platform.hasPropertyAccessors) {
test('defining a getter/setter', function() {
- var obj = {}, getCnt = 0, setCnt = 0, v = 'FOO';
+ var obj = {};
+ var getCnt = 0;
+ var setCnt = 0;
+ var v = 'FOO';
var desc = {
enumerable: true, | true |
Other | emberjs | ember.js | 951920f5655280b5dbaf4ceae7e9baf4672a7933.json | Use one variable assignment per declaration. | packages/ember-metal/tests/run_loop/once_test.js | @@ -17,7 +17,8 @@ test('calling invokeOnce more than once invokes only once', function() {
test('should differentiate based on target', function() {
- var A = { count: 0 }, B = { count: 0 };
+ var A = { count: 0 };
+ var B = { count: 0 };
run(function() {
var F = function() { this.count++; };
run.once(A, F);
@@ -33,7 +34,8 @@ test('should differentiate based on target', function() {
test('should ignore other arguments - replacing previous ones', function() {
- var A = { count: 0 }, B = { count: 0 };
+ var A = { count: 0 };
+ var B = { count: 0 };
run(function() {
var F = function(amt) { this.count += amt; };
run.once(A, F, 10); | true |
Other | emberjs | ember.js | 951920f5655280b5dbaf4ceae7e9baf4672a7933.json | Use one variable assignment per declaration. | packages/ember-metal/tests/utils/guidFor_test.js | @@ -20,7 +20,8 @@ var nanGuid = function(obj) {
};
test("Object", function() {
- var a = {}, b = {};
+ var a = {};
+ var b = {};
sameGuid( a, a, "same object always yields same guid" );
diffGuid( a, b, "different objects yield different guids" );
@@ -44,7 +45,9 @@ test("Object with prototype", function() {
});
test("strings", function() {
- var a = "string A", aprime = "string A", b = "String B";
+ var a = "string A";
+ var aprime = "string A";
+ var b = "String B";
sameGuid( a, a, "same string always yields same guid" );
sameGuid( a, aprime, "identical strings always yield the same guid" );
@@ -53,7 +56,9 @@ test("strings", function() {
});
test("numbers", function() {
- var a = 23, aprime = 23, b = 34;
+ var a = 23;
+ var aprime = 23;
+ var b = 34;
sameGuid( a, a, "same numbers always yields same guid" );
sameGuid( a, aprime, "identical numbers always yield the same guid" );
@@ -62,7 +67,9 @@ test("numbers", function() {
});
test("numbers", function() {
- var a = true, aprime = true, b = false;
+ var a = true;
+ var aprime = true;
+ var b = false;
sameGuid( a, a, "same booleans always yields same guid" );
sameGuid( a, aprime, "identical booleans always yield the same guid" );
@@ -72,7 +79,9 @@ test("numbers", function() {
});
test("null and undefined", function() {
- var a = null, aprime = null, b;
+ var a = null;
+ var aprime = null;
+ var b;
sameGuid( a, a, "null always returns the same guid" );
sameGuid( b, b, "undefined always returns the same guid" );
@@ -83,7 +92,9 @@ test("null and undefined", function() {
});
test("arrays", function() {
- var a = ["a", "b", "c"], aprime = ["a", "b", "c"], b = ["1", "2", "3"];
+ var a = ["a", "b", "c"];
+ var aprime = ["a", "b", "c"];
+ var b = ["1", "2", "3"];
sameGuid( a, a, "same instance always yields same guid" );
diffGuid( a, aprime, "identical arrays always yield the same guid" ); | true |
Other | emberjs | ember.js | 951920f5655280b5dbaf4ceae7e9baf4672a7933.json | Use one variable assignment per declaration. | packages/ember-metal/tests/utils/is_array_test.js | @@ -4,13 +4,13 @@ QUnit.module("Ember Type Checking");
var global = this;
test("Ember.isArray" ,function() {
- var numarray = [1,2,3],
- number = 23,
- strarray = ["Hello", "Hi"],
- string = "Hello",
- object = {},
- length = {length: 12},
- fn = function() {};
+ var numarray = [1,2,3];
+ var number = 23;
+ var strarray = ["Hello", "Hi"];
+ var string = "Hello";
+ var object = {};
+ var length = {length: 12};
+ var fn = function() {};
equal( isArray(numarray), true, "[1,2,3]" );
equal( isArray(number), false, "23" ); | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.