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
1b34a2a115fa7fbc65de37f867ab8e4db410c5d1.json
Use rsvp.js in Deferred mixin
packages/ember-runtime/lib/mixins/deferred.js
@@ -1,50 +1,12 @@ +require("rsvp"); + /** @module ember @submodule ember-runtime */ -var get = Ember.get, set = Ember.set, - slice = Array.prototype.slice, - forEach = Ember.ArrayPolyfills.forEach; - -var Callbacks = function(target, once) { - this.target = target; - this.once = once || false; - this.list = []; - this.fired = false; - this.off = false; -}; - -Callbacks.prototype = { - add: function(callback) { - if (this.off) { return; } - - this.list.push(callback); - - if (this.fired) { this.flush(); } - }, - - fire: function() { - if (this.off || this.once && this.fired) { return; } - if (!this.fired) { this.fired = true; } - - this.args = slice.call(arguments); - - if (this.list.length > 0) { this.flush(); } - }, - - flush: function() { - Ember.run.once(this, 'flushCallbacks'); - }, - - flushCallbacks: function() { - forEach.call(this.list, function(callback) { - callback.apply(this.target, this.args); - }, this); - if (this.once) { this.list = []; } - } -}; - +var get = Ember.get, + slice = Array.prototype.slice; /** @class Deferred @@ -59,71 +21,30 @@ Ember.Deferred = Ember.Mixin.create({ @method then @param {Function} doneCallback a callback function to be called when done @param {Function} failCallback a callback function to be called when failed - @param {Function} progressCallback a callback function to be called when progressed - */ - then: function(doneCallback, failCallback, progressCallback) { - if (doneCallback) { - get(this, 'deferredDone').add(doneCallback); - } - if (failCallback) { - get(this, 'deferredFail').add(failCallback); - } - if (progressCallback) { - get(this, 'deferredProgress').add(progressCallback); - } - - return this; - }, - - /** - Call the progressCallbacks on a Deferred object with the given args. - - @method notify */ - notify: function() { - var callbacks = get(this, 'deferredProgress'); - callbacks.fire.apply(callbacks, slice.call(arguments)); - - return this; + then: function(doneCallback, failCallback) { + return get(this, 'promise').then(doneCallback, failCallback); }, /** Resolve a Deferred object and call any doneCallbacks with the given args. @method resolve */ - resolve: function() { - var callbacks = get(this, 'deferredDone'); - callbacks.fire.apply(callbacks, slice.call(arguments)); - set(this, 'deferredProgress.off', true); - set(this, 'deferredFail.off', true); - - return this; + resolve: function(value) { + get(this, 'promise').resolve(value); }, /** Reject a Deferred object and call any failCallbacks with the given args. @method reject */ - reject: function() { - var callbacks = get(this, 'deferredFail'); - callbacks.fire.apply(callbacks, slice.call(arguments)); - set(this, 'deferredProgress.off', true); - set(this, 'deferredDone.off', true); - - return this; + reject: function(value) { + get(this, 'promise').reject(value); }, - deferredDone: Ember.computed(function() { - return new Callbacks(this, true); - }).cacheable(), - - deferredFail: Ember.computed(function() { - return new Callbacks(this, true); - }).cacheable(), - - deferredProgress: Ember.computed(function() { - return new Callbacks(this); + promise: Ember.computed(function() { + return new RSVP.Promise(); }).cacheable() });
true
Other
emberjs
ember.js
1b34a2a115fa7fbc65de37f867ab8e4db410c5d1.json
Use rsvp.js in Deferred mixin
packages/ember-runtime/tests/mixins/deferred_test.js
@@ -123,43 +123,7 @@ test("can call resolve multiple times", function() { }, 20); }); -test("deferred has progress", function() { - - var deferred, count = 0; - - Ember.run(function() { - deferred = Ember.Object.create(Ember.Deferred); - }); - - deferred.then(function() {}, function() {}, function() { - count++; - }); - - stop(); - Ember.run(function() { - deferred.notify(); - deferred.notify(); - deferred.notify(); - }); - Ember.run(function() { - deferred.notify(); - }); - Ember.run(function() { - deferred.notify(); - deferred.resolve(); - deferred.notify(); - }); - Ember.run(function() { - deferred.notify(); - }); - - setTimeout(function() { - start(); - equal(count, 3, "progress called three times"); - }, 20); -}); - -test("resolve prevent reject and stop progress", function() { +test("resolve prevent reject", function() { var deferred, resolved = false, rejected = false, progress = 0; Ember.run(function() { @@ -170,33 +134,24 @@ test("resolve prevent reject and stop progress", function() { resolved = true; }, function() { rejected = true; - }, function() { - progress++; }); stop(); - Ember.run(function() { - deferred.notify(); - }); Ember.run(function() { deferred.resolve(); }); Ember.run(function() { deferred.reject(); }); - Ember.run(function() { - deferred.notify(); - }); setTimeout(function() { start(); equal(resolved, true, "is resolved"); equal(rejected, false, "is not rejected"); - equal(progress, 1, "progress called once"); }, 20); }); -test("reject prevent resolve and stop progress", function() { +test("reject prevent resolve", function() { var deferred, resolved = false, rejected = false, progress = 0; Ember.run(function() { @@ -207,29 +162,20 @@ test("reject prevent resolve and stop progress", function() { resolved = true; }, function() { rejected = true; - }, function() { - progress++; }); stop(); - Ember.run(function() { - deferred.notify(); - }); Ember.run(function() { deferred.reject(); }); Ember.run(function() { deferred.resolve(); }); - Ember.run(function() { - deferred.notify(); - }); setTimeout(function() { start(); equal(resolved, false, "is not resolved"); equal(rejected, true, "is rejected"); - equal(progress, 1, "progress called once"); }, 20); });
true
Other
emberjs
ember.js
1b34a2a115fa7fbc65de37f867ab8e4db410c5d1.json
Use rsvp.js in Deferred mixin
packages/rsvp/lib/main.js
@@ -0,0 +1,208 @@ +(function(exports) { "use strict"; + +var browserGlobal = (typeof window !== 'undefined') ? window : {}; + +var MutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; +var async; + +if (typeof process !== 'undefined') { + async = function(callback, binding) { + process.nextTick(function() { + callback.call(binding); + }); + }; +} else if (MutationObserver) { + var queue = []; + + var observer = new MutationObserver(function() { + var toProcess = queue.slice(); + queue = []; + + toProcess.forEach(function(tuple) { + var callback = tuple[0], binding = tuple[1]; + callback.call(binding); + }); + }); + + var element = document.createElement('div'); + observer.observe(element, { attributes: true }); + + async = function(callback, binding) { + queue.push([callback, binding]); + element.setAttribute('drainQueue', 'drainQueue'); + }; +} else { + async = function(callback, binding) { + setTimeout(function() { + callback.call(binding); + }, 1); + }; +} + +exports.async = async; + +var Event = exports.Event = function(type, options) { + this.type = type; + + for (var option in options) { + if (!options.hasOwnProperty(option)) { continue; } + + this[option] = options[option]; + } +}; + +var indexOf = function(callbacks, callback) { + for (var i=0, l=callbacks.length; i<l; i++) { + if (callbacks[i][0] === callback) { return i; } + } + + return -1; +}; + +var callbacksFor = function(object) { + var callbacks = object._promiseCallbacks; + + if (!callbacks) { + callbacks = object._promiseCallbacks = {}; + } + + return callbacks; +}; + +var EventTarget = exports.EventTarget = { + mixin: function(object) { + object.on = this.on; + object.off = this.off; + object.trigger = this.trigger; + return object; + }, + + on: function(eventName, callback, binding) { + var allCallbacks = callbacksFor(this), callbacks; + binding = binding || this; + + callbacks = allCallbacks[eventName]; + + if (!callbacks) { + callbacks = allCallbacks[eventName] = []; + } + + if (indexOf(callbacks, callback) === -1) { + callbacks.push([callback, binding]); + } + }, + + off: function(eventName, callback) { + var allCallbacks = callbacksFor(this), callbacks; + + if (!callback) { + allCallbacks[eventName] = []; + return; + } + + callbacks = allCallbacks[eventName]; + + var index = indexOf(callbacks, callback); + + if (index !== -1) { callbacks.splice(index, 1); } + }, + + trigger: function(eventName, options) { + var allCallbacks = callbacksFor(this), + callbacks, callbackTuple, callback, binding, event; + + if (callbacks = allCallbacks[eventName]) { + for (var i=0, l=callbacks.length; i<l; i++) { + callbackTuple = callbacks[i]; + callback = callbackTuple[0]; + binding = callbackTuple[1]; + + if (typeof options !== 'object') { + options = { detail: options }; + } + + event = new Event(eventName, options); + callback.call(binding, event); + } + } + } +}; + +var Promise = exports.Promise = function() { + this.on('promise:resolved', function(event) { + this.trigger('success', { detail: event.detail }); + }, this); + + this.on('promise:failed', function(event) { + this.trigger('error', { detail: event.detail }); + }, this); +}; + +var noop = function() {}; + +var invokeCallback = function(type, promise, callback, event) { + var value, error; + + if (callback) { + try { + value = callback(event.detail); + } catch(e) { + error = e; + } + } else { + value = event.detail; + } + + if (value instanceof Promise) { + value.then(function(value) { + promise.resolve(value); + }, function(error) { + promise.reject(error); + }); + } else if (callback && value) { + promise.resolve(value); + } else if (error) { + promise.reject(error); + } else { + promise[type](value); + } +}; + +Promise.prototype = { + then: function(done, fail) { + var thenPromise = new Promise(); + + this.on('promise:resolved', function(event) { + invokeCallback('resolve', thenPromise, done, event); + }); + + this.on('promise:failed', function(event) { + invokeCallback('reject', thenPromise, fail, event); + }); + + return thenPromise; + }, + + resolve: function(value) { + exports.async(function() { + this.trigger('promise:resolved', { detail: value }); + this.isResolved = value; + }, this); + + this.resolve = noop; + this.reject = noop; + }, + + reject: function(value) { + exports.async(function() { + this.trigger('promise:failed', { detail: value }); + this.isRejected = value; + }, this); + + this.resolve = noop; + this.reject = noop; + } +}; + +EventTarget.mixin(Promise.prototype); + })(window.RSVP = {});
true
Other
emberjs
ember.js
1b34a2a115fa7fbc65de37f867ab8e4db410c5d1.json
Use rsvp.js in Deferred mixin
packages/rsvp/package.json
@@ -0,0 +1,29 @@ +{ + "name": "rsvp", + "summary": "Promises-A implementation", + "description": "A lightweight library that provides tools for organizing asynchronous code", + "homepage": "https://github.com/tildeio/rsvp.js", + "authors": ["Yehuda Katz", "Tom Dale"], + "version": "1.0.0", + + "dependencies": { + "spade": "~> 1.0.0" + }, + + "directories": { + "lib": "lib" + }, + + "bpm:build": { + "bpm_libs.js": { + "files": ["lib"], + "modes": "*" + }, + + "handlebars/bpm_tests.js": { + "files": ["tests"], + "modes": ["debug"] + } + } +} +
true
Other
emberjs
ember.js
134fc61b764ef5b464ab3ebef968716b7df5c50c.json
Add a basic instrumentation API
packages/ember-metal/lib/instrumentation.js
@@ -0,0 +1,133 @@ +/** + @class Ember.Instrumentation + + The purpose of the Ember Instrumentation module is + to provide efficient, general-purpose instrumentation + for Ember. + + Subscribe to a listener by using `Ember.subscribe`: + + Ember.subscribe("render", { + before: function(name, timestamp, payload) { + + }, + + after: function(name, timestamp, payload) { + + } + }); + + If you return a value from the `before` callback, that same + value will be passed as a fourth parameter to the `after` + callback. + + Instrument a block of code by using `Ember.instrument`: + + Ember.instrument("render.handlebars", payload, function() { + // rendering logic + }, binding); + + Event names passed to `Ember.instrument` are namespaced + by periods, from more general to more specific. Subscribers + can listen for events by whatever level of granularity they + are interested in. + + In the above example, the event is `render.handlebars`, + and the subscriber listened for all events beginning with + `render`. It would receive callbacks for events named + `render`, `render.handlebars`, `render.container`, or + even `render.handlebars.layout`. +*/ +Ember.Instrumentation = {}; + +var subscribers = [], cache = {}; + +var populateListeners = function(name) { + var listeners = [], subscriber; + + for (var i=0, l=subscribers.length; i<l; i++) { + subscriber = subscribers[i]; + if (subscriber.regex.test(name)) { + listeners.push(subscriber.object); + } + } + + cache[name] = listeners; + return listeners; +}; + +Ember.Instrumentation.instrument = function(name, payload, callback, binding) { + var listeners = cache[name]; + + if (!listeners) { + listeners = populateListeners(name); + } + + if (listeners.length === 0) { return; } + + var beforeValues = [], listener, i, l; + + try { + for (i=0, l=listeners.length; i<l; i++) { + listener = listeners[i]; + beforeValues[i] = listener.before(name, new Date(), payload); + } + + callback.call(binding); + } catch(e) { + payload = payload || {}; + payload.exception = e; + } finally { + for (i=0, l=listeners.length; i<l; i++) { + listener = listeners[i]; + listener.after(name, new Date(), payload, beforeValues[i]); + } + } +}; + +Ember.Instrumentation.subscribe = function(pattern, object) { + var paths = pattern.split("."), path, regex = "^"; + + for (var i=0, l=paths.length; i<l; i++) { + path = paths[i]; + if (path === "*") { + regex = regex + "[^\\.]*"; + } else { + regex = regex + path; + } + } + + regex = regex + "(\\..*)?"; + + var subscriber = { + pattern: pattern, + regex: new RegExp(regex + "$"), + object: object + }; + + subscribers.push(subscriber); + cache = {}; + + return subscriber; +}; + +Ember.Instrumentation.unsubscribe = function(subscriber) { + var index; + + for (var i=0, l=subscribers.length; i<l; i++) { + if (subscribers[i] === subscriber) { + index = i; + } + } + + subscribers.splice(index, 1); + cache = {}; +}; + +Ember.Instrumentation.reset = function() { + subscribers = []; + cache = {}; +}; + +Ember.instrument = Ember.Instrumentation.instrument; +Ember.subscribe = Ember.Instrumentation.subscribe;
true
Other
emberjs
ember.js
134fc61b764ef5b464ab3ebef968716b7df5c50c.json
Add a basic instrumentation API
packages/ember-metal/lib/main.js
@@ -5,6 +5,7 @@ Ember Metal @submodule ember-metal */ +require('ember-metal/instrumentation'); require('ember-metal/core'); require('ember-metal/map'); require('ember-metal/platform');
true
Other
emberjs
ember.js
134fc61b764ef5b464ab3ebef968716b7df5c50c.json
Add a basic instrumentation API
packages/ember-metal/tests/instrumentation_test.js
@@ -0,0 +1,139 @@ +var instrument = Ember.Instrumentation; + +module("Ember Instrumentation", { + setup: function() { + + }, + teardown: function() { + instrument.reset(); + } +}); + +test("subscribing to a simple path receives the listener", function() { + expect(12); + + var sentPayload = {}, count = 0; + + instrument.subscribe("render", { + before: function(name, timestamp, payload) { + if (count === 0) { + strictEqual(name, "render"); + } else { + strictEqual(name, "render.handlebars"); + } + + ok(timestamp instanceof Date); + strictEqual(payload, sentPayload); + }, + + after: function(name, timestamp, payload) { + if (count === 0) { + strictEqual(name, "render"); + } else { + strictEqual(name, "render.handlebars"); + } + + ok(timestamp instanceof Date); + strictEqual(payload, sentPayload); + + count++; + } + }); + + instrument.instrument("render", sentPayload, function() { + + }); + + instrument.instrument("render.handlebars", sentPayload, function() { + + }); +}); + +test("returning a value from the before callback passes it to the after callback", function() { + expect(2); + + var passthru1 = {}, passthru2 = {}; + + instrument.subscribe("render", { + before: function(name, timestamp, payload) { + return passthru1; + }, + after: function(name, timestamp, payload, beforeValue) { + strictEqual(beforeValue, passthru1); + } + }); + + instrument.subscribe("render", { + before: function(name, timestamp, payload) { + return passthru2; + }, + after: function(name, timestamp, payload, beforeValue) { + strictEqual(beforeValue, passthru2); + } + }); + + instrument.instrument("render", null, function() {}); +}); + +test("raising an exception in the instrumentation attaches it to the payload", function() { + expect(2); + + var error = new Error("Instrumentation"); + + instrument.subscribe("render", { + before: function() {}, + after: function(name, timestamp, payload) { + strictEqual(payload.exception, error); + } + }); + + instrument.subscribe("render", { + before: function() {}, + after: function(name, timestamp, payload) { + strictEqual(payload.exception, error); + } + }); + + instrument.instrument("render.handlebars", null, function() { + throw error; + }); +}); + +test("it is possible to add a new subscriber after the first instrument", function() { + instrument.instrument("render.handlebars", null, function() {}); + + instrument.subscribe("render", { + before: function() { + ok(true, "Before callback was called"); + }, + after: function() { + ok(true, "After callback was called"); + } + }); + + instrument.instrument("render.handlebars", function() {}); +}); + +test("it is possible to remove a subscriber", function() { + expect(4); + + var count = 0; + + var subscriber = instrument.subscribe("render", { + before: function() { + equal(count, 0); + ok(true, "Before callback was called"); + }, + after: function() { + equal(count, 0); + ok(true, "After callback was called"); + count++; + } + }); + + instrument.instrument("render.handlebars", function() {}); + + instrument.unsubscribe(subscriber); + + instrument.instrument("render.handlebars", function() {}); +});
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-application/tests/system/application_test.js
@@ -70,16 +70,21 @@ test("you cannot make two default applications without a rootElement error", fun }); test("acts like a namespace", function() { - var app; - Ember.run(function() { - app = window.TestApp = Ember.Application.create({rootElement: '#two'}); - }); - app.Foo = Ember.Object.extend(); - equal(app.Foo.toString(), "TestApp.Foo", "Classes pick up their parent namespace"); - Ember.run(function() { - app.destroy(); - }); - window.TestApp = undefined; + var originalLookup = Ember.lookup; + + try { + var lookup = Ember.lookup = {}, app; + Ember.run(function() { + app = lookup.TestApp = Ember.Application.create({rootElement: '#two'}); + }); + app.Foo = Ember.Object.extend(); + equal(app.Foo.toString(), "TestApp.Foo", "Classes pick up their parent namespace"); + Ember.run(function() { + app.destroy(); + }); + } finally { + Ember.lookup = originalLookup; + } }); var app; @@ -334,4 +339,4 @@ test("Minimal Application initialized with an application template and injection }); equal(Ember.$('#qunit-fixture').text(), 'Hello Kris!'); -}); \ No newline at end of file +});
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-handlebars/lib/ext.js
@@ -1,5 +1,3 @@ -/*globals Handlebars */ - require("ember-views/system/render_buffer"); /** @@ -9,8 +7,8 @@ require("ember-views/system/render_buffer"); var objectCreate = Ember.create; - -Ember.assert("Ember Handlebars requires Handlebars 1.0.beta.5 or greater", window.Handlebars && window.Handlebars.VERSION.match(/^1\.0\.beta\.[56789]$|^1\.0\.rc\.[123456789]+/)); +var Handlebars = Ember.imports.Handlebars; +Ember.assert("Ember Handlebars requires Handlebars 1.0.beta.5 or greater", Handlebars && Handlebars.VERSION.match(/^1\.0\.beta\.[56789]$|^1\.0\.rc\.[123456789]+/)); /** Prepares the Handlebars templating library for use inside Ember's view @@ -234,8 +232,10 @@ Ember.Handlebars.getPath = function(root, path, options) { value = Ember.get(root, path); - if (value === undefined && root !== window && Ember.isGlobalPath(path)) { - value = Ember.get(window, path); + // If the path starts with a capital letter, look it up on Ember.lookup, + // which defaults to the `window` object in browsers. + if (value === undefined && root !== Ember.lookup && Ember.isGlobalPath(path)) { + value = Ember.get(Ember.lookup, path); } return value; };
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-handlebars/tests/controls/button_test.js
@@ -2,8 +2,12 @@ var button, dispatcher; var get = Ember.get, set = Ember.set; +var originalLookup = Ember.lookup, lookup; + module("Ember.Button", { setup: function() { + lookup = Ember.lookup = {}; + Ember.TESTING_DEPRECATION = true; dispatcher = Ember.EventDispatcher.create(); dispatcher.setup(); @@ -16,6 +20,7 @@ module("Ember.Button", { dispatcher.destroy(); }); Ember.TESTING_DEPRECATION = false; + Ember.lookup = originalLookup; } }); @@ -178,7 +183,7 @@ test("should not trigger an action when another key is pressed", function() { test("should trigger an action on a String target when clicked", function() { var wasClicked = false; - window.MyApp = { + lookup.MyApp = { myActionObject: Ember.Object.create({ myAction: function() { wasClicked = true; @@ -199,8 +204,6 @@ test("should trigger an action on a String target when clicked", function() { synthesizeEvent('mouseup', button); ok(wasClicked); - - window.MyApp = undefined; }); test("should not trigger action if mouse leaves area before mouseup", function() {
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-handlebars/tests/handlebars_test.js
@@ -62,6 +62,8 @@ var appendView = function() { }; var additionalTeardown; +var originalLookup = Ember.lookup, lookup; +var TemplateTests; /** This module specifically tests integration with Handlebars and Ember-specific @@ -72,7 +74,8 @@ var additionalTeardown; */ module("Ember.View - handlebars integration", { setup: function() { - window.TemplateTests = Ember.Namespace.create(); + Ember.lookup = lookup = { Ember: Ember }; + lookup.TemplateTests = TemplateTests = Ember.Namespace.create(); }, teardown: function() { @@ -82,7 +85,7 @@ module("Ember.View - handlebars integration", { }); view = null; } - window.TemplateTests = undefined; + Ember.lookup = originalLookup; } }); @@ -198,8 +201,6 @@ test("should not escape HTML if string is a Handlebars.SafeString", function() { equal(view.$('i').length, 1, "creates an element when value is updated"); }); -TemplateTests = {}; - test("child views can be inserted using the {{view}} Handlebars helper", function() { var templates = Ember.Object.create({ nester: Ember.Handlebars.compile("<h1 id='hello-world'>Hello {{world}}</h1>{{view \"TemplateTests.LabelView\"}}"), @@ -1140,8 +1141,10 @@ test("{{view}} should be able to point to a local view", function() { }); test("{{view}} should evaluate class bindings set to global paths", function() { + var App; + Ember.run(function() { - window.App = Ember.Application.create({ + lookup.App = App = Ember.Application.create({ isApp: true, isGreat: true, directClass: "app-direct", @@ -1172,7 +1175,7 @@ test("{{view}} should evaluate class bindings set to global paths", function() { ok(view.$('input').hasClass('disabled'), "evaluates ternary operator in classBindings"); Ember.run(function() { - window.App.destroy(); + lookup.App.destroy(); }); }); @@ -1205,8 +1208,10 @@ test("{{view}} should evaluate class bindings set in the current context", funct }); test("{{view}} should evaluate class bindings set with either classBinding or classNameBindings", function() { + var App; + Ember.run(function() { - window.App = Ember.Application.create({ + lookup.App = App = Ember.Application.create({ isGreat: true, isEnabled: true }); @@ -1236,13 +1241,13 @@ test("{{view}} should evaluate class bindings set with either classBinding or cl ok(view.$('input').hasClass('really-disabled'), "evaluates ternary operator in classBindings"); Ember.run(function() { - window.App.destroy(); + lookup.App.destroy(); }); }); test("{{view}} should evaluate other attribute bindings set to global paths", function() { Ember.run(function() { - window.App = Ember.Application.create({ + lookup.App = Ember.Application.create({ name: "myApp" }); }); @@ -1256,7 +1261,7 @@ test("{{view}} should evaluate other attribute bindings set to global paths", fu equal(view.$('input').attr('value'), "myApp", "evaluates attributes bound to global paths"); Ember.run(function() { - window.App.destroy(); + lookup.App.destroy(); }); }); @@ -1944,6 +1949,8 @@ test("should be able to explicitly set a view's context", function() { module("Ember.View - handlebars integration", { setup: function() { + Ember.lookup = lookup = { Ember: Ember }; + originalLog = Ember.Logger.log; logCalls = []; Ember.Logger.log = function(arg) { logCalls.push(arg); }; @@ -1958,6 +1965,7 @@ module("Ember.View - handlebars integration", { } Ember.Logger.log = originalLog; + Ember.lookup = originalLookup; } }); @@ -2003,16 +2011,18 @@ test("should be able to log `this`", function() { equal(logCalls[1], 'two', "should call log with item two"); }); +var MyApp; module("Templates redrawing and bindings", { setup: function(){ - MyApp = Ember.Object.create({}); + Ember.lookup = lookup = { Ember: Ember }; + MyApp = lookup.MyApp = Ember.Object.create({}); }, teardown: function(){ Ember.run(function() { if (view) view.destroy(); }); - window.MyApp = null; + Ember.lookup = originalLookup; } }); @@ -2184,8 +2194,10 @@ test("bindings can be 'this', in which case they *are* the current context", fun test("should not enter an infinite loop when binding an attribute in Handlebars", function() { expect(0); + var App; + Ember.run(function() { - window.App = Ember.Application.create(); + lookup.App = App = Ember.Application.create(); }); App.test = Ember.Object.create({ href: 'test' }); @@ -2216,7 +2228,7 @@ test("should not enter an infinite loop when binding an attribute in Handlebars" }); Ember.run(function() { - window.App.destroy(); + lookup.App.destroy(); }); });
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-handlebars/tests/helpers/each_test.js
@@ -4,8 +4,12 @@ var templateFor = function(template) { return Ember.Handlebars.compile(template); }; +var originalLookup = Ember.lookup, lookup; + module("the #each helper", { setup: function() { + Ember.lookup = lookup = { Ember: Ember }; + template = templateFor("{{#each people}}{{name}}{{/each}}"); people = Ember.A([{ name: "Steve Holt" }, { name: "Annabelle" }]); @@ -16,7 +20,7 @@ module("the #each helper", { templateMyView = templateFor("{{name}}"); - window.MyView = Ember.View.extend({ + lookup.MyView = Ember.View.extend({ template: templateMyView }); @@ -28,6 +32,7 @@ module("the #each helper", { view.destroy(); view = null; }); + Ember.lookup = originalLookup; } }); @@ -211,7 +216,7 @@ test("it supports {{itemViewClass=}} with tagName", function() { test("it supports {{itemViewClass=}} with in format", function() { - window.MyView = Ember.View.extend({ + lookup.MyView = Ember.View.extend({ template: templateFor("{{person.name}}") });
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-handlebars/tests/helpers/with_test.js
@@ -5,9 +5,12 @@ var appendView = function(view) { }; var view; +var originalLookup = Ember.lookup, lookup; module("Handlebars {{#with}} helper", { setup: function() { + Ember.lookup = lookup = { Ember: Ember }; + view = Ember.View.create({ template: Ember.Handlebars.compile("{{#with person as tom}}{{title}}: {{tom.name}}{{/with}}"), title: "Señor Engineer", @@ -21,6 +24,7 @@ module("Handlebars {{#with}} helper", { Ember.run(function(){ view.destroy(); }); + Ember.lookup = originalLookup; } }); @@ -56,7 +60,9 @@ test("updating a property on the view should update the HTML", function() { module("Handlebars {{#with}} globals helper", { setup: function() { - window.Foo = { bar: 'baz' }; + Ember.lookup = lookup = { Ember: Ember }; + + lookup.Foo = { bar: 'baz' }; view = Ember.View.create({ template: Ember.Handlebars.compile("{{#with Foo.bar as qux}}{{qux}}{{/with}}") }); @@ -66,17 +72,17 @@ module("Handlebars {{#with}} globals helper", { teardown: function() { Ember.run(function(){ - window.Foo = null; view.destroy(); }); + Ember.lookup = originalLookup; } }); test("it should support #with Foo.bar as qux", function() { equal(view.$().text(), "baz", "should be properly scoped"); Ember.run(function() { - Ember.set(Foo, 'bar', 'updated'); + Ember.set(lookup.Foo, 'bar', 'updated'); }); equal(view.$().text(), "updated", "should update");
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-handlebars/tests/helpers/yield_test.js
@@ -1,12 +1,12 @@ -/*global TemplateTests*/ - var set = Ember.set, get = Ember.get; -var view; +var originalLookup = Ember.lookup, lookup, TemplateTests, view; module("Support for {{yield}} helper (#307)", { setup: function() { - window.TemplateTests = Ember.Namespace.create(); + Ember.lookup = lookup = { Ember: Ember }; + + lookup.TemplateTests = TemplateTests = Ember.Namespace.create(); }, teardown: function() { Ember.run(function(){ @@ -15,8 +15,7 @@ module("Support for {{yield}} helper (#307)", { }} ); - - window.TemplateTests = undefined; + Ember.lookup = originalLookup; } });
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-handlebars/tests/loader_test.js
@@ -1,9 +1,12 @@ -/*global Tobias:true*/ +var originalLookup = Ember.lookup, lookup, Tobias; module("test Ember.Handlebars.bootstrap", { + setup: function() { + Ember.lookup = lookup = { Ember: Ember }; + }, teardown: function() { Ember.TEMPLATES = {}; - window.Tobias = undefined; + Ember.lookup = originalLookup; } });
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-handlebars/tests/views/collection_view_test.js
@@ -9,11 +9,12 @@ var nthChild = function(view, nth) { }; var firstChild = nthChild; -var view; +var originalLookup = Ember.lookup, lookup, TemplateTests, view; module("ember-handlebars/tests/views/collection_view_test", { setup: function() { - window.TemplateTests = Ember.Namespace.create(); + Ember.lookup = lookup = { Ember: Ember }; + lookup.TemplateTests = TemplateTests = Ember.Namespace.create(); }, teardown: function() { Ember.run(function(){ @@ -22,8 +23,7 @@ module("ember-handlebars/tests/views/collection_view_test", { } }); - window.TemplateTests = undefined; - window.App = undefined; + Ember.lookup = originalLookup; } }); @@ -62,8 +62,10 @@ test("collection helper should accept relative paths", function() { }); test("empty views should be removed when content is added to the collection (regression, ht: msofaer)", function() { + var App; + Ember.run(function() { - window.App = Ember.Application.create(); + lookup.App = App = Ember.Application.create(); }); App.EmptyView = Ember.View.extend({ @@ -92,12 +94,14 @@ test("empty views should be removed when content is added to the collection (reg equal(view.$('tr').length, 1, 'has one row'); - Ember.run(function(){ window.App.destroy(); }); + Ember.run(function(){ App.destroy(); }); }); test("should be able to specify which class should be used for the empty view", function() { + var App; + Ember.run(function() { - window.App = Ember.Application.create(); + lookup.App = App = Ember.Application.create(); }); App.EmptyView = Ember.View.extend({ @@ -115,7 +119,7 @@ test("should be able to specify which class should be used for the empty view", equal(view.$().text(), 'This is an empty view', "Empty view should be rendered."); Ember.run(function() { - window.App.destroy(); + App.destroy(); }); });
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-metal/lib/accessors.js
@@ -177,10 +177,10 @@ function normalizeTuple(target, path) { isGlobal = !hasThis && IS_GLOBAL_PATH.test(path), key; - if (!target || isGlobal) target = window; + if (!target || isGlobal) target = Ember.lookup; if (hasThis) path = path.slice(5); - if (target === window) { + if (target === Ember.lookup) { key = firstKey(path); target = get(target, key); path = path.slice(key.length+1); @@ -198,7 +198,7 @@ function getPath(root, path) { // If there is no root and path is a key name, return that // property from the global object. // E.g. get('Ember') -> Ember - if (root === null && path.indexOf('.') === -1) { return get(window, path); } + if (root === null && path.indexOf('.') === -1) { return get(Ember.lookup, path); } // detect complicated paths and normalize them hasThis = HAS_THIS.test(path);
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-metal/lib/binding.js
@@ -32,7 +32,7 @@ var get = Ember.get, function getWithGlobals(obj, path) { - return get(isGlobalPath(path) ? window : obj, path); + return get(isGlobalPath(path) ? Ember.lookup : obj, path); } // .......................................................... @@ -243,7 +243,7 @@ Binding.prototype = { Ember.Logger.log(' ', this.toString(), '<-', toValue, obj); } Ember._suspendObserver(obj, fromPath, this, this.fromDidChange, function () { - Ember.trySet(Ember.isGlobalPath(fromPath) ? window : obj, fromPath, toValue); + Ember.trySet(Ember.isGlobalPath(fromPath) ? Ember.lookup : obj, fromPath, toValue); }); } }
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-metal/lib/core.js
@@ -32,10 +32,13 @@ if ('undefined' === typeof Ember) { Ember = {}; } +// Default imports, exports and lookup to the global object; +var imports = Ember.imports = Ember.imports || this; +var exports = Ember.exports = Ember.exports || this; +var lookup = Ember.lookup = Ember.lookup || this; + // aliases needed to keep minifiers from removing the global context -if ('undefined' !== typeof window) { - window.Em = window.Ember = Em = Ember; -} +exports.Em = exports.Ember = Em = Ember; // Make sure these are set whether Ember was already defined or not @@ -177,11 +180,11 @@ if ('undefined' === typeof Ember.deprecateFunc) { // These are deprecated but still supported -if ('undefined' === typeof ember_assert) { window.ember_assert = Ember.K; } -if ('undefined' === typeof ember_warn) { window.ember_warn = Ember.K; } -if ('undefined' === typeof ember_deprecate) { window.ember_deprecate = Ember.K; } +if ('undefined' === typeof ember_assert) { exports.ember_assert = Ember.K; } +if ('undefined' === typeof ember_warn) { exports.ember_warn = Ember.K; } +if ('undefined' === typeof ember_deprecate) { exports.ember_deprecate = Ember.K; } if ('undefined' === typeof ember_deprecateFunc) { - window.ember_deprecateFunc = function(_, func) { return func; }; + exports.ember_deprecateFunc = function(_, func) { return func; }; } @@ -190,13 +193,13 @@ if ('undefined' === typeof ember_deprecateFunc) { // /** - Inside Ember-Metal, simply uses the window.console object. + Inside Ember-Metal, simply uses the imports.console object. Override this to provide more robust logging functionality. @class Logger @namespace Ember */ -Ember.Logger = window.console || { log: Ember.K, warn: Ember.K, error: Ember.K, info: Ember.K, debug: Ember.K }; +Ember.Logger = imports.console || { log: Ember.K, warn: Ember.K, error: Ember.K, info: Ember.K, debug: Ember.K }; // ..........................................................
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-metal/lib/mixin.js
@@ -477,21 +477,21 @@ function processNames(paths, root, seen) { } function findNamespaces() { - var Namespace = Ember.Namespace, obj, isNamespace; + var Namespace = Ember.Namespace, lookup = Ember.lookup, obj, isNamespace; if (Namespace.PROCESSED) { return; } - for (var prop in window) { + for (var prop in lookup) { // get(window.globalStorage, 'isNamespace') would try to read the storage for domain isNamespace and cause exception in Firefox. // globalStorage is a storage obsoleted by the WhatWG storage specification. See https://developer.mozilla.org/en/DOM/Storage#globalStorage - if (prop === "globalStorage" && window.StorageList && window.globalStorage instanceof window.StorageList) { continue; } + if (prop === "globalStorage" && lookup.StorageList && lookup.globalStorage instanceof lookup.StorageList) { continue; } // Unfortunately, some versions of IE don't support window.hasOwnProperty - if (window.hasOwnProperty && !window.hasOwnProperty(prop)) { continue; } + if (lookup.hasOwnProperty && !lookup.hasOwnProperty(prop)) { continue; } // At times we are not allowed to access certain properties for security reasons. // There are also times where even if we can access them, we are not allowed to access their properties. try { - obj = window[prop]; + obj = Ember.lookup[prop]; isNamespace = obj && get(obj, 'isNamespace'); } catch (e) { continue;
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-metal/tests/accessors/setPath_test.js
@@ -1,4 +1,4 @@ -/*globals Foo:true $foo:true */ +var originalLookup = Ember.lookup; var obj, moduleOpts = { setup: function() { @@ -11,33 +11,34 @@ var obj, moduleOpts = { }; - Foo = { - bar: { - baz: { biff: 'FooBiff' } - } - }; + Ember.lookup = { + Foo: { + bar: { + baz: { biff: 'FooBiff' } + } + }, - $foo = { - bar: { - baz: { biff: '$FOOBIFF' } + $foo: { + bar: { + baz: { biff: '$FOOBIFF' } + } } }; }, teardown: function() { obj = null; - Foo = null; - $foo = null; + Ember.lookup = originalLookup; } }; module('Ember.set with path', moduleOpts); test('[Foo, bar] -> Foo.bar', function() { - window.Foo = {toString: function() { return 'Foo'; }}; // Behave like an Ember.Namespace - Ember.set(Foo, 'bar', 'baz'); - equal(Ember.get(Foo, 'bar'), 'baz'); - window.Foo = null; + Ember.lookup.Foo = {toString: function() { return 'Foo'; }}; // Behave like an Ember.Namespace + + Ember.set(Ember.lookup.Foo, 'bar', 'baz'); + equal(Ember.get(Ember.lookup.Foo, 'bar'), 'baz'); }); // .......................................................... @@ -70,7 +71,7 @@ test('[obj, this.foo.bar] -> obj.foo.bar', function() { test('[null, Foo.bar] -> Foo.bar', function() { Ember.set(null, 'Foo.bar', "BAM"); - equal(Ember.get(Foo, 'bar'), "BAM"); + equal(Ember.get(Ember.lookup.Foo, 'bar'), "BAM"); }); // ..........................................................
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-metal/tests/observer_test.js
@@ -537,6 +537,7 @@ testBoth('addBeforeObserver should respect targets with methods', function(get,s // var obj, count; +var originalLookup = Ember.lookup, lookup; module('Ember.addObserver - dependentkey with chained properties', { setup: function() { @@ -550,11 +551,13 @@ module('Ember.addObserver - dependentkey with chained properties', { } }; - Global = { - foo: { - bar: { - baz: { - biff: "BIFF" + Ember.lookup = lookup = { + Global: { + foo: { + bar: { + baz: { + biff: "BIFF" + } } } } @@ -564,7 +567,8 @@ module('Ember.addObserver - dependentkey with chained properties', { }, teardown: function() { - obj = count = Global = null; + obj = count = null; + Ember.lookup = originalLookup; } }); @@ -607,10 +611,10 @@ testBoth('depending on a simple chain', function(get, set) { }); testBoth('depending on a Global chain', function(get, set) { + var Global = lookup.Global, val; - var val ; Ember.addObserver(obj, 'Global.foo.bar.baz.biff', function(target, key){ - val = Ember.get(window, key); + val = Ember.get(lookup, key); count++; });
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-metal/tests/utils/meta_test.js
@@ -41,7 +41,7 @@ module("Ember.meta enumerable"); // Tests fix for https://github.com/emberjs/ember.js/issues/344 // This is primarily for older browsers such as IE8 if (Ember.platform.defineProperty.isSimulated) { - if (window.jQuery) { + if (Ember.imports.jQuery) { test("meta is not jQuery.isPlainObject", function () { var proto, obj; proto = {foo: 'bar'}; @@ -63,7 +63,7 @@ if (Ember.platform.defineProperty.isSimulated) { props.push(prop); } deepEqual(props.sort(), ['bar', 'foo']); - if (window.JSON && 'stringify' in JSON) { + if (typeof JSON !== 'undefiend' && 'stringify' in JSON) { try { JSON.stringify(obj); } catch (e) {
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-routing/lib/routable.js
@@ -222,7 +222,7 @@ Ember.Routable = Ember.Mixin.create({ var modelType = get(this, 'modelType'); if (typeof modelType === 'string') { - return Ember.get(window, modelType); + return Ember.get(Ember.lookup, modelType); } else { return modelType; }
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-routing/lib/router.js
@@ -576,7 +576,26 @@ Ember.Router = Ember.StateManager.extend( }).start(); }, + moveStatesIntoRoot: function() { + this.root = Ember.Route.extend(); + + for (var name in this) { + if (name === "constructor") { continue; } + + var state = this[name]; + + if (state instanceof Ember.Route || Ember.Route.detect(state)) { + this.root[name] = state; + delete this[name]; + } + } + }, + init: function() { + if (!this.root) { + this.moveStatesIntoRoot(); + } + this._super(); var location = get(this, 'location'),
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-routing/tests/routable_test.js
@@ -1,3 +1,5 @@ +var originalLookup = Ember.lookup, lookup, TestApp; + module("Ember.Routable"); test("it should have its updateRoute method called when it is entered", function() { @@ -272,19 +274,21 @@ var url, firstPost, firstUser; module("default serialize and deserialize with modelType", { setup: function() { - window.TestApp = Ember.Namespace.create(); - window.TestApp.Post = Ember.Object.extend(); - window.TestApp.Post.find = function(id) { + Ember.lookup = lookup = {}; + + lookup.TestApp = TestApp = Ember.Namespace.create(); + TestApp.Post = Ember.Object.extend(); + TestApp.Post.find = function(id) { if (id === "1") { return firstPost; } }; - window.TestApp.User = Ember.Object.extend(); - window.TestApp.User.find = function(id) { + TestApp.User = Ember.Object.extend(); + TestApp.User.find = function(id) { if (id === "1") { return firstUser; } }; - firstPost = window.TestApp.Post.create({ id: 1 }); - firstUser = window.TestApp.User.create({ id: 1 }); + firstPost = TestApp.Post.create({ id: 1 }); + firstUser = TestApp.User.create({ id: 1 }); router = Ember.Router.create({ location: { @@ -305,7 +309,7 @@ module("default serialize and deserialize with modelType", { user: Ember.Route.extend({ route: '/users/:user_id', - modelType: window.TestApp.User, + modelType: TestApp.User, connectOutlets: function(router, user) { equal(user, firstUser, "the post should have deserialized correctly"); @@ -316,7 +320,7 @@ module("default serialize and deserialize with modelType", { }, teardown: function() { - window.TestApp = undefined; + Ember.lookup = originalLookup; } }); @@ -349,35 +353,36 @@ var postSuccessCallback, postFailureCallback, module("modelType with promise", { setup: function() { - window.TestApp = Ember.Namespace.create(); + Ember.lookup = lookup = {}; + lookup.TestApp = TestApp = Ember.Namespace.create(); - window.TestApp.User = Ember.Object.extend({ + TestApp.User = Ember.Object.extend({ then: function(success, failure) { userLoaded = true; userSuccessCallback = success; userFailureCallback = failure; } }); - window.TestApp.User.find = function(id) { + TestApp.User.find = function(id) { if (id === "1") { return firstUser; } }; - window.TestApp.Post = Ember.Object.extend({ + TestApp.Post = Ember.Object.extend({ then: function(success, failure) { postSuccessCallback = success; postFailureCallback = failure; } }); - window.TestApp.Post.find = function(id) { + TestApp.Post.find = function(id) { // Simulate dependency on user if (!userLoaded) { return; } if (id === "1") { return firstPost; } }; - firstUser = window.TestApp.User.create({ id: 1 }); - firstPost = window.TestApp.Post.create({ id: 1 }); + firstUser = TestApp.User.create({ id: 1 }); + firstPost = TestApp.Post.create({ id: 1 }); router = Ember.Router.create({ location: { @@ -443,11 +448,11 @@ module("modelType with promise", { }, teardown: function() { - window.TestApp = undefined; postSuccessCallback = postFailureCallback = undefined; userSuccessCallback = userFailureCallback = undefined; connectedUser = connectedPost = connectedChild = connectedOther = undefined; isLoading = userLoaded = undefined; + Ember.lookup = originalLookup; } }); @@ -554,16 +559,17 @@ test("should stop promises if transitionTo is called", function() { module("default serialize and deserialize without modelType", { setup: function() { - window.TestApp = Ember.Namespace.create(); - window.TestApp.Post = Ember.Object.extend(); - window.TestApp.Post.find = function(id) { + Ember.lookup = lookup = {}; + lookup.TestApp = TestApp = Ember.Namespace.create(); + TestApp.Post = Ember.Object.extend(); + TestApp.Post.find = function(id) { if (id === "1") { return firstPost; } }; - firstPost = window.TestApp.Post.create({ id: 1 }); + firstPost = TestApp.Post.create({ id: 1 }); router = Ember.Router.create({ - namespace: window.TestApp, + namespace: TestApp, location: { setURL: function(passedURL) { @@ -584,7 +590,7 @@ module("default serialize and deserialize without modelType", { }, teardown: function() { - window.TestApp = undefined; + Ember.lookup = originalLookup; } });
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-runtime/lib/mixins/target_action_support.js
@@ -19,7 +19,7 @@ Ember.TargetActionSupport = Ember.Mixin.create({ if (Ember.typeOf(target) === "string") { var value = get(this, target); - if (value === undefined) { value = get(window, target); } + if (value === undefined) { value = get(Ember.lookup, target); } return value; } else { return target;
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-runtime/lib/system/namespace.js
@@ -37,7 +37,7 @@ Ember.Namespace = Ember.Object.extend({ destroy: function() { var namespaces = Ember.Namespace.NAMESPACES; - window[this.toString()] = undefined; + Ember.lookup[this.toString()] = undefined; namespaces.splice(indexOf.call(namespaces, this), 1); this._super(); }
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-runtime/tests/core/isArray_test.js
@@ -1,5 +1,7 @@ module("Ember Type Checking"); +var global = this; + test("Ember.isArray" ,function(){ var numarray = [1,2,3], number = 23, @@ -15,6 +17,6 @@ test("Ember.isArray" ,function(){ equal( Ember.isArray(string), false, '"Hello"' ); equal( Ember.isArray(object), false, "{}" ); equal( Ember.isArray(length), true, "{length: 12}" ); - equal( Ember.isArray(window), false, "window" ); + equal( Ember.isArray(global), false, "global" ); equal( Ember.isArray(fn), false, "function() {}" ); });
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-runtime/tests/legacy_1x/mixins/observable/observable_test.js
@@ -32,6 +32,7 @@ var forEach = Ember.EnumerableUtils.forEach; var object, ObjectC, ObjectD, objectA, objectB ; var ObservableObject = Ember.Object.extend(Ember.Observable); +var originalLookup = Ember.lookup, lookup; // .......................................................... // GET() @@ -167,20 +168,24 @@ test("should work when object is Ember (used in Ember.get)", function() { equal(Ember.get(Ember, 'RunLoop'), Ember.RunLoop, 'Ember.get(Ember, RunLoop)'); }); -module("Ember.get() with paths"); +module("Ember.get() with paths", { + setup: function() { + lookup = Ember.lookup = {}; + }, + + teardown: function() { + Ember.lookup = originalLookup; + } +}); -test("should return a property at a given path relative to the window", function() { - window.Foo = ObservableObject.create({ +test("should return a property at a given path relative to the lookup", function() { + lookup.Foo = ObservableObject.create({ Bar: ObservableObject.create({ Baz: Ember.computed(function() { return "blargh"; }).property().volatile() }) }); - try { - equal(Ember.get('Foo.Bar.Baz'), "blargh"); - } finally { - window.Foo = undefined; - } + equal(Ember.get('Foo.Bar.Baz'), "blargh"); }); test("should return a property at a given path relative to the passed object", function() { @@ -193,18 +198,14 @@ test("should return a property at a given path relative to the passed object", f equal(Ember.get(foo, 'bar.baz'), "blargh"); }); -test("should return a property at a given path relative to the window - JavaScript hash", function() { - window.Foo = { +test("should return a property at a given path relative to the lookup - JavaScript hash", function() { + lookup.Foo = { Bar: { Baz: "blargh" } }; - try { - equal(Ember.get('Foo.Bar.Baz'), "blargh"); - } finally { - window.Foo = undefined; - } + equal(Ember.get('Foo.Bar.Baz'), "blargh"); }); test("should return a property at a given path relative to the passed object - JavaScript hash", function() { @@ -314,6 +315,8 @@ test("should call unknownProperty with value when property is undefined", functi module("Computed properties", { setup: function() { + lookup = Ember.lookup = {}; + object = ObservableObject.create({ // REGULAR @@ -378,6 +381,9 @@ module("Computed properties", { }).property('state').volatile() }) ; + }, + teardown: function() { + Ember.lookup = originalLookup; } }); @@ -545,7 +551,7 @@ test("dependent keys should be able to be specified as property paths", function test("nested dependent keys should propagate after they update", function() { var bindObj; Ember.run(function () { - window.DepObj = ObservableObject.create({ + lookup.DepObj = ObservableObject.create({ restaurant: ObservableObject.create({ menu: ObservableObject.create({ price: 5 @@ -565,13 +571,13 @@ test("nested dependent keys should propagate after they update", function() { equal(bindObj.get('price'), 5, "precond - binding propagates"); Ember.run(function () { - DepObj.set('restaurant.menu.price', 10); + lookup.DepObj.set('restaurant.menu.price', 10); }); equal(bindObj.get('price'), 10, "binding propagates after a nested dependent keys updates"); Ember.run(function () { - DepObj.set('restaurant.menu', ObservableObject.create({ + lookup.DepObj.set('restaurant.menu', ObservableObject.create({ price: 15 })); }); @@ -581,49 +587,51 @@ test("nested dependent keys should propagate after they update", function() { test("cacheable nested dependent keys should clear after their dependencies update", function() { ok(true); - + + var DepObj; + Ember.run(function(){ - window.DepObj = ObservableObject.create({ + lookup.DepObj = DepObj = ObservableObject.create({ restaurant: ObservableObject.create({ menu: ObservableObject.create({ price: 5 }) }), - + price: Ember.computed(function() { return this.get('restaurant.menu.price'); }).property('restaurant.menu.price').cacheable() }); }); - + equal(DepObj.get('price'), 5, "precond - computed property is correct"); - + Ember.run(function(){ DepObj.set('restaurant.menu.price', 10); }); equal(DepObj.get('price'), 10, "cacheable computed properties are invalidated even if no run loop occurred"); - + Ember.run(function(){ DepObj.set('restaurant.menu.price', 20); }); equal(DepObj.get('price'), 20, "cacheable computed properties are invalidated after a second get before a run loop"); equal(DepObj.get('price'), 20, "precond - computed properties remain correct after a run loop"); - + Ember.run(function(){ DepObj.set('restaurant.menu', ObservableObject.create({ price: 15 })); }); - - + + equal(DepObj.get('price'), 15, "cacheable computed properties are invalidated after a middle property changes"); - + Ember.run(function(){ DepObj.set('restaurant.menu', ObservableObject.create({ price: 25 })); }); - + equal(DepObj.get('price'), 25, "cacheable computed properties are invalidated after a middle property changes again, before a run loop"); }); @@ -854,12 +862,12 @@ test("should bind property with method parameter as undefined", function() { Ember.run(function(){ objectA.bind("name", "Namespace.objectB.normal",undefined) ; }); - + // now make a change to see if the binding triggers. Ember.run(function(){ objectB.set("normal", "changedValue") ; }); - + // support new-style bindings if available equal("changedValue", objectA.get("name"), "objectA.name is binded"); });
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-runtime/tests/mixins/target_action_support_test.js
@@ -1,6 +1,15 @@ /*global Test:true*/ -module("Ember.TargetActionSupport"); +var originalLookup; + +module("Ember.TargetActionSupport", { + setup: function() { + originalLookup = Ember.lookup; + }, + teardown: function() { + Ember.lookup = originalLookup; + } +}); test("it should return false if no target or action are specified", function() { expect(1); @@ -45,7 +54,8 @@ test("it should invoke the send() method on objects that implement it", function test("it should find targets specified using a property path", function() { expect(2); - window.Test = {}; + var Test = {}; + Ember.lookup = { Test: Test }; Test.targetObj = Ember.Object.create({ anEvent: function() { @@ -59,6 +69,4 @@ test("it should find targets specified using a property path", function() { }); ok(true === myObj.triggerAction(), "a valid target and action were specified"); - - window.Test = undefined; });
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-runtime/tests/suites/enumerable/forEach.js
@@ -1,6 +1,6 @@ require('ember-runtime/~tests/suites/enumerable'); -var suite = Ember.EnumerableTests; +var suite = Ember.EnumerableTests, global = this; suite.module('forEach'); @@ -38,9 +38,8 @@ suite.test('forEach should iterate over list after mutation', function() { suite.test('2nd target parameter', function() { var obj = this.newObject(), target = this; - obj.forEach(function() { - equal(Ember.guidFor(this), Ember.guidFor(window), 'should pass window as this if no context'); + equal(Ember.guidFor(this), Ember.guidFor(global), 'should pass the global object as this if no context'); }); obj.forEach(function() {
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-runtime/tests/suites/enumerable/map.js
@@ -1,6 +1,6 @@ require('ember-runtime/~tests/suites/enumerable'); -var suite = Ember.EnumerableTests; +var suite = Ember.EnumerableTests, global = this; suite.module('map'); @@ -40,7 +40,7 @@ suite.test('2nd target parameter', function() { obj.map(function() { - equal(Ember.guidFor(this), Ember.guidFor(window), 'should pass window as this if no context'); + equal(Ember.guidFor(this), Ember.guidFor(global), 'should pass the global object as this if no context'); }); obj.map(function() {
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-runtime/tests/system/namespace/base_test.js
@@ -2,22 +2,27 @@ // Project: Ember Runtime // ========================================================================== -var get = Ember.get; +var get = Ember.get, originalLookup = Ember.lookup, lookup; module('Ember.Namespace', { + setup: function() { + lookup = Ember.lookup = {}; + }, teardown: function() { - if (window.NamespaceA) { Ember.run(function(){ window.NamespaceA.destroy(); }); } - if (window.NamespaceB) { Ember.run(function(){ window.NamespaceB.destroy(); }); } - if (window.namespaceC) { + if (lookup.NamespaceA) { Ember.run(function(){ lookup.NamespaceA.destroy(); }); } + if (lookup.NamespaceB) { Ember.run(function(){ lookup.NamespaceB.destroy(); }); } + if (lookup.namespaceC) { try { Ember.TESTING_DEPRECATION = true; Ember.run(function(){ - window.namespaceC.destroy(); + lookup.namespaceC.destroy(); }); } finally { Ember.TESTING_DEPRECATION = false; } } + + Ember.lookup = originalLookup; } }); @@ -30,22 +35,22 @@ test("Ember.Namespace should be duck typed", function() { }); test('Ember.Namespace is found and named', function() { - var nsA = window.NamespaceA = Ember.Namespace.create(); - equal(nsA.toString(), "NamespaceA", "namespaces should have a name if they are on window"); + var nsA = lookup.NamespaceA = Ember.Namespace.create(); + equal(nsA.toString(), "NamespaceA", "namespaces should have a name if they are on lookup"); - var nsB = window.NamespaceB = Ember.Namespace.create(); + var nsB = lookup.NamespaceB = Ember.Namespace.create(); equal(nsB.toString(), "NamespaceB", "namespaces work if created after the first namespace processing pass"); }); test("Classes under an Ember.Namespace are properly named", function() { - var nsA = window.NamespaceA = Ember.Namespace.create(); + var nsA = lookup.NamespaceA = Ember.Namespace.create(); nsA.Foo = Ember.Object.extend(); equal(nsA.Foo.toString(), "NamespaceA.Foo", "Classes pick up their parent namespace"); nsA.Bar = Ember.Object.extend(); equal(nsA.Bar.toString(), "NamespaceA.Bar", "New Classes get the naming treatment too"); - var nsB = window.NamespaceB = Ember.Namespace.create(); + var nsB = lookup.NamespaceB = Ember.Namespace.create(); nsB.Foo = Ember.Object.extend(); equal(nsB.Foo.toString(), "NamespaceB.Foo", "Classes in new namespaces get the naming treatment"); }); @@ -58,7 +63,7 @@ test("Classes under Ember are properly named", function() { }); test("Lowercase namespaces should be deprecated", function() { - window.namespaceC = Ember.Namespace.create(); + lookup.namespaceC = Ember.Namespace.create(); var originalWarn = Ember.Logger.warn, loggerWarning;
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-views/lib/core.js
@@ -3,12 +3,13 @@ @submodule ember-views */ -Ember.assert("Ember Views require jQuery 1.7 or 1.8", window.jQuery && (window.jQuery().jquery.match(/^1\.[78](\.\d+)?(pre|rc\d?)?/) || Ember.ENV.FORCE_JQUERY)); +var jQuery = Ember.imports.jQuery; +Ember.assert("Ember Views require jQuery 1.7 or 1.8", jQuery && (jQuery().jquery.match(/^1\.[78](\.\d+)?(pre|rc\d?)?/) || Ember.ENV.FORCE_JQUERY)); /** Alias for jQuery @method $ @for Ember */ -Ember.$ = window.jQuery; +Ember.$ = jQuery;
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-views/lib/views/view.js
@@ -1189,7 +1189,7 @@ Ember.View = Ember.Object.extend(Ember.Evented, var val = get(this, path); if (val === undefined && Ember.isGlobalPath(path)) { - val = get(window, path); + val = get(Ember.lookup, path); } return Ember.View._classStringForValue(path, val, parsedPath.className, parsedPath.falsyClassName);
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-views/tests/system/controller_test.js
@@ -1,9 +1,11 @@ -/*globals TestApp*/ +var originalLookup = Ember.lookup, TestApp, lookup; module("Ember.Controller#connectOutlet", { setup: function() { + lookup = Ember.lookup = {}; + Ember.run(function () { - window.TestApp = Ember.Application.create(); + lookup.TestApp = TestApp = Ember.Application.create(); }); @@ -15,9 +17,9 @@ module("Ember.Controller#connectOutlet", { teardown: function() { Ember.run(function () { - window.TestApp.destroy(); + lookup.TestApp.destroy(); }); - window.TestApp = undefined; + Ember.lookup = originalLookup; } });
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-views/tests/views/view/attribute_bindings_test.js
@@ -1,20 +1,24 @@ /*global Test:true*/ var set = Ember.set, get = Ember.get; -var view; +var originalLookup = Ember.lookup, lookup, view; var appendView = function() { Ember.run(function() { view.appendTo('#qunit-fixture'); }); }; module("Ember.View - Attribute Bindings", { + setup: function() { + Ember.lookup = lookup = {}; + }, teardown: function() { if (view) { Ember.run(function(){ view.destroy(); }); view = null; } + Ember.lookup = originalLookup; } }); @@ -99,9 +103,9 @@ test("should update attribute bindings", function() { }); test("should allow attributes to be set in the inBuffer state", function() { - var parentView, childViews; + var parentView, childViews, Test; Ember.run(function() { - window.Test = Ember.Namespace.create(); + lookup.Test = Test = Ember.Namespace.create(); Test.controller = Ember.Object.create({ foo: 'bar' });
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-views/tests/views/view/init_test.js
@@ -1,22 +1,31 @@ /*global TestApp:true*/ var set = Ember.set, get = Ember.get; -module("Ember.View.create"); +var originalLookup = Ember.lookup, lookup; + +module("Ember.View.create", { + setup: function() { + Ember.lookup = lookup = {}; + }, + teardown: function() { + Ember.lookup = originalLookup; + } +}); test("registers view in the global views hash using layerId for event targeted", function() { var v = Ember.View.create(); equal(Ember.View.views[get(v, 'elementId')], v, 'registers view'); }); test("registers itself with a controller if the viewController property is set", function() { - window.TestApp = {}; - TestApp.fooController = Ember.Object.create(); + lookup.TestApp = {}; + lookup.TestApp.fooController = Ember.Object.create(); var v = Ember.View.create({ viewController: 'TestApp.fooController' }); - equal(TestApp.fooController.get('view'), v, "sets the view property of the controller"); + equal(lookup.TestApp.fooController.get('view'), v, "sets the view property of the controller"); }); test("should warn if a non-array is used for classNames", function() {
true
Other
emberjs
ember.js
305202fa51aca55ce1ff935aa9fb8ebe3da4a0d4.json
Remove dependency on `window` throughout Ember Previously, Ember used the `window` object for three concerns: * `imports`: libraries that Ember requires in order to work, such as `jQuery`, `Handlebars`, and `Metamorph` * `exports`: the variables that Ember itself exports (`Ember` and `Em`) * `lookup`: the global lookup path for application code (e.g. when used in Handlebars templates). Now, these three concerns are looked up on `Ember.imports`, `Ember.exports` and `Ember.lookup` respectively. For convenience, all three of these are assigned to `window` by default. You can change the defaults by assigning a new Ember object before loading Ember: ```javascript var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var exports = {}, lookup = {}; Ember = { imports: imports, exports: exports, lookup: lookup } ``` You can use this to package Ember for external module loaders like AMD: ```javascript define("Ember", ["exports", "App", "handlebars", "metamorph", "jQuery"], function(exports, App, Handlebars, Metamorph, jQuery) { var imports = { Handlebars: Handlebars, Metamorph: Metamorph, jQuery: jQuery }; var Ember = { imports: imports, exports: exports, lookup: { App: App } } // distributed ember.js }); define("App", [], function() { return {}; }); define("Post", ["App", "Ember"], function(App, Ember) { App.Post = Ember.Object.extend({ // stuff }); }); ``` You can use a similar technique to package Ember Runtime for Node or other environments with CommonJS-style modules.
packages/ember-views/tests/views/view/view_lifecycle_test.js
@@ -1,10 +1,10 @@ /*global ViewTest:true*/ -var view; +var originalLookup = Ember.lookup, lookup, view; module("views/view/view_lifecycle_test - pre-render", { setup: function() { - + Ember.lookup = lookup = {}; }, teardown: function() { @@ -13,6 +13,7 @@ module("views/view/view_lifecycle_test - pre-render", { view.destroy(); }); } + Ember.lookup = originalLookup; } }); @@ -23,7 +24,9 @@ function tmpl(str) { } test("should create and append a DOM element after bindings have synced", function() { - window.ViewTest = {}; + var ViewTest; + + lookup.ViewTest = ViewTest = {}; Ember.run(function() { ViewTest.fakeController = Ember.Object.create({ @@ -44,7 +47,6 @@ test("should create and append a DOM element after bindings have synced", functi }); equal(view.$().text(), 'controllerPropertyValue', "renders and appends after bindings have synced"); - window.ViewTest = undefined; }); test("should throw an exception if trying to append a child before rendering has begun", function() {
true
Other
emberjs
ember.js
833e2367dce711d0b78aa754137f05c438f6dab0.json
Fix failing example in Ember.Select docs
packages/ember-handlebars/lib/controls/select.js
@@ -26,11 +26,11 @@ var indexOf = Ember.EnumerableUtils.indexOf, indexesOf = Ember.EnumerableUtils.i Example: ``` javascript - App.Names = ["Yehuda", "Tom"]; + App.names = ["Yehuda", "Tom"]; ``` ``` handlebars - {{view Ember.Select contentBinding="App.Names"}} + {{view Ember.Select contentBinding="App.names"}} ``` Would result in the following HTML: @@ -46,16 +46,16 @@ var indexOf = Ember.EnumerableUtils.indexOf, indexesOf = Ember.EnumerableUtils.i `value` property directly or as a binding: ``` javascript - App.Names = Ember.Object.create({ + App.names = Ember.Object.create({ selected: 'Tom', content: ["Yehuda", "Tom"] }); ``` ``` handlebars {{view Ember.Select - contentBinding="App.controller.content" - valueBinding="App.controller.selected" + contentBinding="App.names.content" + valueBinding="App.names.selected" }} ``` @@ -69,7 +69,7 @@ var indexOf = Ember.EnumerableUtils.indexOf, indexesOf = Ember.EnumerableUtils.i ``` A user interacting with the rendered `<select>` to choose "Yehuda" would update - the value of `App.controller.selected` to "Yehuda". + the value of `App.names.selected` to "Yehuda". ### `content` as an Array of Objects An Ember.Select can also take an array of JavaScript or Ember objects @@ -85,15 +85,15 @@ var indexOf = Ember.EnumerableUtils.indexOf, indexesOf = Ember.EnumerableUtils.i element's text. Both paths must reference each object itself as 'content': ``` javascript - App.Programmers = [ + App.programmers = [ Ember.Object.create({firstName: "Yehuda", id: 1}), Ember.Object.create({firstName: "Tom", id: 2}) ]; ``` ``` handlebars {{view Ember.Select - contentBinding="App.Programmers" + contentBinding="App.programmers" optionValuePath="content.id" optionLabelPath="content.firstName"}} ``` @@ -114,7 +114,7 @@ var indexOf = Ember.EnumerableUtils.indexOf, indexesOf = Ember.EnumerableUtils.i `valueBinding` option: ``` javascript - App.Programmers = [ + App.programmers = [ Ember.Object.create({firstName: "Yehuda", id: 1}), Ember.Object.create({firstName: "Tom", id: 2}) ]; @@ -126,7 +126,7 @@ var indexOf = Ember.EnumerableUtils.indexOf, indexesOf = Ember.EnumerableUtils.i ``` handlebars {{view Ember.Select - contentBinding="App.controller.content" + contentBinding="App.programmers" optionValuePath="content.id" optionLabelPath="content.firstName" valueBinding="App.currentProgrammer.id"}}
false
Other
emberjs
ember.js
3df8cb4bde6fec21ed4c646084bed75eaad86027.json
Use connectOutlet in {{outlet}} documentation
packages/ember-handlebars/lib/helpers/outlet.js
@@ -15,27 +15,29 @@ Ember.Handlebars.OutletView = Ember.ContainerView.extend(Ember._Metamorph); {{outlet}} ``` - By default, when the the current controller's `view` - property changes, the outlet will replace its current - view with the new view. + By default, when the the current controller's `view` property changes, the + outlet will replace its current view with the new view. You can set the + `view` property directly, but it's normally best to use `connectOutlet`. ``` javascript - controller.set('view', someView); + # Instantiate App.PostsView and assign to `view`, so as to render into outlet. + controller.connectOutlet('posts'); ``` - You can also specify a particular name, other than view: + You can also specify a particular name other than `view`: ``` handlebars {{outlet masterView}} {{outlet detailView}} ``` - Then, you can control several outlets from a single - controller: + Then, you can control several outlets from a single controller. ``` javascript - controller.set('masterView', postsView); - controller.set('detailView', postView); + # Instantiate App.PostsView and assign to controller.masterView. + controller.connectOutlet('masterView', 'posts'); + # Also, instantiate App.PostInfoView and assign to controller.detailView. + controller.connectOutlet('detailView', 'postInfo'); ``` @method outlet
false
Other
emberjs
ember.js
0c0b720c92518a5083fba7693d449ac41836e8b6.json
Update instructions for building API docs - Fixes #1398
README.md
@@ -149,13 +149,17 @@ See <http://emberjs.com/> for annotated introductory documentation. ## Preview API documenation -* run `rake docs:preview` +* Clone https://github.com/emberjs/website.git at the same level as the + main Ember repo. -* The `docs:preview` task will build the documentation and make it available at <http://localhost:9292/index.html> +* From the website repo, run `rake preview` + +* The docs will be available at <http://localhost:4567/api> ## Build API documentation -* run `rake docs:build` +* From the website repo, run `rake build` -* HTML documentation is built in the `docs` directory +* The website, along with documentation will be built into the `build` + directory
false
Other
emberjs
ember.js
a2fee026a5e38522b4ec8e858d13c4c4a825be8a.json
Allow operation with handlebars runtime only
packages/ember-handlebars/lib/ext.js
@@ -43,7 +43,12 @@ Ember.Handlebars.helpers = objectCreate(Handlebars.helpers); @constructor */ Ember.Handlebars.Compiler = function() {}; -Ember.Handlebars.Compiler.prototype = objectCreate(Handlebars.Compiler.prototype); + +// Handlebars.Compiler doesn't exist in runtime-only +if (Handlebars.Compiler) { + Ember.Handlebars.Compiler.prototype = objectCreate(Handlebars.Compiler.prototype); +} + Ember.Handlebars.Compiler.prototype.compiler = Ember.Handlebars.Compiler; /** @@ -53,8 +58,14 @@ Ember.Handlebars.Compiler.prototype.compiler = Ember.Handlebars.Compiler; @constructor */ Ember.Handlebars.JavaScriptCompiler = function() {}; -Ember.Handlebars.JavaScriptCompiler.prototype = objectCreate(Handlebars.JavaScriptCompiler.prototype); -Ember.Handlebars.JavaScriptCompiler.prototype.compiler = Ember.Handlebars.JavaScriptCompiler; + +// Handlebars.JavaScriptCompiler doesn't exist in runtime-only +if (Handlebars.JavaScriptCompiler) { + Ember.Handlebars.JavaScriptCompiler.prototype = objectCreate(Handlebars.JavaScriptCompiler.prototype); + Ember.Handlebars.JavaScriptCompiler.prototype.compiler = Ember.Handlebars.JavaScriptCompiler; +} + + Ember.Handlebars.JavaScriptCompiler.prototype.namespace = "Ember.Handlebars"; @@ -134,24 +145,27 @@ Ember.Handlebars.precompile = function(string) { return new Ember.Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true); }; -/** - The entry point for Ember Handlebars. This replaces the default Handlebars.compile and turns on - template-local data and String parameters. - - @method compile - @for Ember.Handlebars - @static - @param {String} string The template to compile - @return {Function} -*/ -Ember.Handlebars.compile = function(string) { - var ast = Handlebars.parse(string); - var options = { data: true, stringParams: true }; - var environment = new Ember.Handlebars.Compiler().compile(ast, options); - var templateSpec = new Ember.Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true); - - return Handlebars.template(templateSpec); -}; +// We don't support this for Handlebars runtime-only +if (Handlebars.compile) { + /** + The entry point for Ember Handlebars. This replaces the default Handlebars.compile and turns on + template-local data and String parameters. + + @method compile + @for Ember.Handlebars + @static + @param {String} string The template to compile + @return {Function} + */ + Ember.Handlebars.compile = function(string) { + var ast = Handlebars.parse(string); + var options = { data: true, stringParams: true }; + var environment = new Ember.Handlebars.Compiler().compile(ast, options); + var templateSpec = new Ember.Handlebars.JavaScriptCompiler().compile(environment, options, undefined, true); + + return Handlebars.template(templateSpec); + }; +} /** @private
false
Other
emberjs
ember.js
0a3adbe6ad46a9bf8a9592d210055a7d0065e48a.json
Fix comments for Ember.View.context
packages/ember-views/lib/views/view.js
@@ -700,8 +700,8 @@ Ember.View = Ember.Object.extend(Ember.Evented, The context of a view is looked up as follows: - 1. Specified controller - 2. Supplied context (usually by Handlebars) + 1. Supplied context (usually by Handlebars) + 2. Specified controller 3. `parentView`'s context (for a child of a ContainerView) The code in Handlebars that overrides the `_context` property first
false
Other
emberjs
ember.js
bb149dcbb7df91866fce10e6dbec78c3e439d0ee.json
Remove support for inline anonymous templates. Default a template without a name to application.
packages/ember-handlebars/lib/loader.js
@@ -39,49 +39,14 @@ Ember.Handlebars.bootstrap = function(ctx) { // 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'), - template = compile(script.html()), - view, viewPath, elementId, options; + templateName = script.attr('data-template-name') || script.attr('id') || 'application', + template = compile(script.html()); - if (templateName) { - // For templates which have a name, we save them and then remove them from the DOM - Ember.TEMPLATES[templateName] = template; + // For templates which have a name, we save them and then remove them from the DOM + Ember.TEMPLATES[templateName] = template; - // Remove script tag from DOM - script.remove(); - } else { - if (script.parents('head').length !== 0) { - // don't allow inline templates in the head - throw new Ember.Error("Template found in <head> without a name specified. " + - "Please provide a data-template-name attribute.\n" + - script.html()); - } - - // For templates which will be evaluated inline in the HTML document, instantiates a new - // view, and replaces the script tag holding the template with the new - // view's DOM representation. - // - // Users can optionally specify a custom view subclass to use by setting the - // data-view attribute of the script tag. - viewPath = script.attr('data-view'); - view = viewPath ? Ember.get(viewPath) : Ember.View; - - // Get the id of the script, used by Ember.View's elementId property, - // Look for data-element-id attribute. - elementId = script.attr('data-element-id'); - - options = { template: template }; - if (elementId) { options.elementId = elementId; } - - view = view.create(options); - - view._insertElementLater(function() { - script.replaceWith(this.$()); - - // Avoid memory leak in IE - script = null; - }); - } + // Remove script tag from DOM + script.remove(); }); }; @@ -100,5 +65,4 @@ function bootstrap() { from the DOM after processing. */ -Ember.$(document).ready(bootstrap); Ember.onLoad('application', bootstrap);
true
Other
emberjs
ember.js
bb149dcbb7df91866fce10e6dbec78c3e439d0ee.json
Remove support for inline anonymous templates. Default a template without a name to application.
packages/ember-handlebars/tests/loader_test.js
@@ -7,69 +7,45 @@ module("test Ember.Handlebars.bootstrap", { } }); -test('template with data-template-name should add a new template to Ember.TEMPLATES', function() { - Ember.$('#qunit-fixture').html('<script type="text/x-handlebars" data-template-name="funkyTemplate" >{{Tobias.firstName}} {{Tobias.lastName}}</script>'); - +function checkTemplate(templateName) { Ember.run(function() { Ember.Handlebars.bootstrap(Ember.$('#qunit-fixture')); - Tobias = Ember.Object.create({ - firstName: 'Tobias', - lastName: 'Fünke' - }); }); - - ok(Ember.TEMPLATES['funkyTemplate'], 'template with name funkyTemplate available'); - equal(Ember.$('#qunit-fixture').text(), '', 'no template content is added'); -}); - -test('template with id instead of data-template-name should add a new template to Ember.TEMPLATES', function() { - Ember.$('#qunit-fixture').html('<script type="text/x-handlebars" id="funkyTemplate" >{{Tobias.firstName}} takes {{Tobias.drug}}</script>'); - - Ember.run(function() { - Ember.Handlebars.bootstrap(Ember.$('#qunit-fixture')); - Tobias = Ember.Object.create({ + var template = Ember.TEMPLATES[templateName]; + ok(template, 'template is available on Ember.TEMPLATES'); + equal(Ember.$('#qunit-fixture script').length, 0, 'script removed'); + var view = Ember.View.create({ + template: template, + context: { firstName: 'Tobias', drug: 'teamocil' - }); + } }); - - ok(Ember.TEMPLATES['funkyTemplate'], 'template with name funkyTemplate available'); - equal(Ember.$('#qunit-fixture').text(), '', 'no template content is added'); -}); - -test('inline template should be added', function() { - Ember.$('#qunit-fixture').html('<script type="text/x-handlebars" >{{Tobias.firstName}} {{Tobias.lastName}}</script>'); - Ember.run(function() { - Ember.Handlebars.bootstrap(Ember.$('#qunit-fixture')); - Tobias = Ember.Object.create({ - firstName: 'Tobias', - lastName: 'Fünke' - }); + view.createElement(); }); - - equal(Ember.$('#qunit-fixture').text(), 'Tobias Fünke', 'template is rendered'); -}); - -test('template with data-element-id should add an id attribute to the view', function() { - Ember.$('#qunit-fixture').html('<script type="text/x-handlebars" data-element-id="application">Hello World !</script>'); - + equal(view.$().text(), 'Tobias takes teamocil', 'template works'); Ember.run(function() { - Ember.Handlebars.bootstrap(Ember.$('#qunit-fixture')); + view.destroy(); }); +} - equal(Ember.$('#qunit-fixture #application').text(), 'Hello World !', 'view exists with id'); +test('template with data-template-name should add a new template to Ember.TEMPLATES', function() { + Ember.$('#qunit-fixture').html('<script type="text/x-handlebars" data-template-name="funkyTemplate">{{firstName}} takes {{drug}}</script>'); + + checkTemplate('funkyTemplate'); }); -test('template without data-element-id should still get an attribute', function() { - Ember.$('#qunit-fixture').html('<script type="text/x-handlebars">Hello World!</script>'); +test('template with id instead of data-template-name should add a new template to Ember.TEMPLATES', function() { + Ember.$('#qunit-fixture').html('<script type="text/x-handlebars" id="funkyTemplate" >{{firstName}} takes {{drug}}</script>'); - Ember.run(function() { - Ember.Handlebars.bootstrap(Ember.$('#qunit-fixture')); - }); + checkTemplate('funkyTemplate'); +}); + +test('template without data-template-name or id should default to application', function() { + Ember.$('#qunit-fixture').html('<script type="text/x-handlebars">{{firstName}} takes {{drug}}</script>'); - var id = Ember.$('#qunit-fixture .ember-view').attr('id'); - ok(id && /^ember\d+$/.test(id), "has standard Ember id"); + checkTemplate('application'); }); test('template with type text/x-raw-handlebars should be parsed', function() {
true
Other
emberjs
ember.js
b6159885e88c842922e53395e531f5220327c3f8.json
Extract createRouter from Application#initialize
packages/ember-application/lib/system/application.js
@@ -315,22 +315,7 @@ Ember.Application = Ember.Namespace.extend( @param router {Ember.Router} */ initialize: function(router) { - if (!router && Ember.Router.detect(this.Router)) { - router = this.Router.create(); - this._createdRouter = router; - } - - if (router) { - set(this, 'router', router); - - // By default, the router's namespace is the current application. - // - // This allows it to find model classes when a state has a - // route like `/posts/:post_id`. In that case, it would first - // convert `post_id` into `Post`, and then look it up on its - // namespace. - set(router, 'namespace', this); - } + router = this.createRouter(router); this.runInjections(router); @@ -363,6 +348,29 @@ Ember.Application = Ember.Namespace.extend( }); }, + /** @private */ + createRouter: function(router) { + if (!router && Ember.Router.detect(this.Router)) { + router = this.Router.create(); + this._createdRouter = router; + } + + if (router) { + set(this, 'router', router); + + // By default, the router's namespace is the current application. + // + // This allows it to find model classes when a state has a + // route like `/posts/:post_id`. In that case, it would first + // convert `post_id` into `Post`, and then look it up on its + // namespace. + set(router, 'namespace', this); + } + + return router; + }, + + /** @private */ didBecomeReady: function() { var eventDispatcher = get(this, 'eventDispatcher'), customEvents = get(this, 'customEvents'),
false
Other
emberjs
ember.js
41e2f8042f483f06ecd3bdc44ffbf1a140c52419.json
Extract runInjections from Application#initialize This also runs the injections on the newly created router property, because we collect the keys after adding the router. But this shouldn't do any harm.
packages/ember-application/lib/system/application.js
@@ -315,9 +315,6 @@ Ember.Application = Ember.Namespace.extend( @param router {Ember.Router} */ initialize: function(router) { - var injections = get(this.constructor, 'injections'), - namespace = this; - if (!router && Ember.Router.detect(this.Router)) { router = this.Router.create(); this._createdRouter = router; @@ -335,7 +332,24 @@ Ember.Application = Ember.Namespace.extend( set(router, 'namespace', this); } - var graph = new Ember.DAG(), i, injection; + this.runInjections(router); + + Ember.runLoadHooks('application', this); + + // At this point, any injections or load hooks that would have wanted + // to defer readiness have fired. + this.advanceReadiness(); + + return this; + }, + + /** @private */ + runInjections: function(router) { + var injections = get(this.constructor, 'injections'), + graph = new Ember.DAG(), + namespace = this, + properties, i, injection; + for (i=0; i<injections.length; i++) { injection = injections[i]; graph.addEdges(injection.name, injection.injection, injection.before, injection.after); @@ -347,14 +361,6 @@ Ember.Application = Ember.Namespace.extend( injection(namespace, router, property); }); }); - - Ember.runLoadHooks('application', this); - - // At this point, any injections or load hooks that would have wanted - // to defer readiness have fired. - this.advanceReadiness(); - - return this; }, didBecomeReady: function() {
false
Other
emberjs
ember.js
20cab0721d99214c468abe9fbd187344663f8007.json
Simplify syntax so we can extract more easily
packages/ember-application/lib/system/application.js
@@ -318,8 +318,8 @@ Ember.Application = Ember.Namespace.extend( var injections = get(this.constructor, 'injections'), namespace = this; - if (!router && Ember.Router.detect(namespace['Router'])) { - router = namespace['Router'].create(); + if (!router && Ember.Router.detect(this.Router)) { + router = this.Router.create(); this._createdRouter = router; }
false
Other
emberjs
ember.js
a2cd03b0f219142c52f291de7a439931d83ffaa3.json
Add hooks to containerView. It helps in some cases where we need to implement some special behavior on outlet connection. We add four new methods to containerView : `presentCurrentView` and `dismissCurrentView` `appendCurrentView` and `removeCurrentView` In cases where we need some special handeling like animations you can override theus methods Add willAppear / willDisappear and didAppear / didDisappear Refactor so it would be easier to override presentCurrentView / dismissCurrentView
packages/ember-views/lib/views/container_view.js
@@ -230,6 +230,45 @@ var childViewsProperty = Ember.computed(function() { {{view Ember.ContainerView currentViewBinding="App.appController.view"}} ``` + ## Use lifecycle hooks + + This is an example of how you could implement reusable currentView view. + + ``` javascript + App.ContainerView = Ember.ContainerView.extend({ + appendCurrentView: function(currentView, callback) { + currentView.set('isVisible', true); + + if (!this.get('childViews').contains(currentView)) { + this._super(currentView, callback); + } else { + callback(); + } + }, + removeCurrentView: function(currentView, callback) { + if (currentView.get('isShared')) { + currentView.set('isVisible', false); + callback(); + } else { + this._super(currentView, callback); + } + } + }); + ```` + + This is an example of how you could implement animations. + + ```` javascript + App.ContainerView = Ember.ContainerView.extend({ + presentCurrentView: function(currentView, callback) { + currentView.$().animate({top: '0px'}, callback); + }, + dismissCurrentView: function(currentView, callback) { + currentView.$().animate({top: '-100px'}, callback); + } + }); + ```` + @class ContainerView @namespace Ember @extends Ember.View @@ -259,9 +298,6 @@ Ember.ContainerView = Ember.View.extend({ _childViews[idx] = view; }, this); - var currentView = get(this, 'currentView'); - if (currentView) _childViews.push(this.createChildView(currentView)); - // Make the _childViews array observable Ember.A(_childViews); @@ -272,6 +308,10 @@ Ember.ContainerView = Ember.View.extend({ willChange: 'childViewsWillChange', didChange: 'childViewsDidChange' }); + + // Make sure we initialize with currentView if it is present + var currentView = get(this, 'currentView'); + if (currentView) { this._currentViewDidChange(); } }, /** @@ -370,22 +410,94 @@ Ember.ContainerView = Ember.View.extend({ currentView: null, + /** + This method is responsible for presenting a new view. + Default implementation will simply call the callback. + You can override this method if you want to add an animation for example. + + @param {Ember.View} currentView a view to present + @param {Function} callback the callback called once operation is terminated + */ + presentCurrentView: function(currentView, callback) { + callback(); + }, + + /** + This method is responsible for adding view to containerView + + @param {Ember.View} currentView a view to present + @param {Function} callback the callback called once view is appended + */ + appendCurrentView: function(currentView, callback) { + var childViews = get(this, 'childViews'); + + currentView.one('didInsertElement', callback); + + childViews.pushObject(currentView); + }, + + /** + This method is responsible for dismissing a view. + Default implementation will simply call the callback. + You can override this method if you want to add an animation for example. + + @param {Ember.View} currentView a view to dismiss + @param {Function} callback the callback called once operation is terminated + */ + dismissCurrentView: function(currentView, callback) { + callback(); + }, + + /** + This method is responsible for removing a view from the containerView + You may want to override it in case you implementing views sharing for example + + @param {Ember.View} currentView a view to present + @param {Function} callback the callback called once view is removed + */ + removeCurrentView: function(currentView, callback) { + var childViews = get(this, 'childViews'); + + currentView.one('didDisappear', function() { + currentView.destroy(); + }); + + childViews.removeObject(currentView); + + callback(); + }, + _currentViewWillChange: Ember.beforeObserver(function() { - var childViews = get(this, 'childViews'), - currentView = get(this, 'currentView'); + var currentView = get(this, 'currentView'), + containerView = this; if (currentView) { - childViews.removeObject(currentView); - currentView.destroy(); + set(currentView, 'isBeingDismissed', true); + currentView.trigger('willDisappear', currentView); + + this.dismissCurrentView(currentView, function() { + containerView.removeCurrentView(currentView, function() { + set(currentView, 'isBeingDismissed', false); + currentView.trigger('didDisappear', currentView); + }); + }); } }, 'currentView'), _currentViewDidChange: Ember.observer(function() { - var childViews = get(this, 'childViews'), - currentView = get(this, 'currentView'); + var currentView = get(this, 'currentView'), + containerView = this; if (currentView) { - childViews.pushObject(currentView); + set(currentView, 'isBeingPresented', true); + currentView.trigger('willAppear', currentView); + + this.appendCurrentView(currentView, function() { + containerView.presentCurrentView(currentView, function() { + set(currentView, 'isBeingPresented', false); + currentView.trigger('didAppear', currentView); + }); + }); } }, 'currentView'),
true
Other
emberjs
ember.js
a2cd03b0f219142c52f291de7a439931d83ffaa3.json
Add hooks to containerView. It helps in some cases where we need to implement some special behavior on outlet connection. We add four new methods to containerView : `presentCurrentView` and `dismissCurrentView` `appendCurrentView` and `removeCurrentView` In cases where we need some special handeling like animations you can override theus methods Add willAppear / willDisappear and didAppear / didDisappear Refactor so it would be easier to override presentCurrentView / dismissCurrentView
packages/ember-views/tests/views/container_view_test.js
@@ -494,3 +494,53 @@ test("should invalidate `element` on itself and childViews when being rendered b ok(!!container.get('element'), "Parent's element should have been recomputed after being rendered"); ok(!!view.get('element'), "Child's element should have been recomputed after being rendered"); }); + +test("should execut all the hooks when removing or adding a currentView", function() { + expect(9); + var viewsCount = 0; + var container = Ember.ContainerView.create({ + presentCurrentView: function(currentView, callback) { + if (viewsCount === 1) { + equal(currentView, child1, 'will present child1'); + equal(child1.get('isBeingPresented'), true); + } else { + equal(currentView, child2, 'will present child2'); + equal(child2.get('isBeingPresented'), true); + } + callback(); + }, + appendCurrentView: function(currentView, callback) { + viewsCount++; + if (viewsCount === 1) { + equal(currentView, child1, 'will append child1'); + } else { + equal(currentView, child2, 'will append child2'); + } + this._super(currentView, callback); + }, + dismissCurrentView: function(currentView, callback) { + equal(child1.get('isBeingDismissed'), true); + equal(currentView, child1, 'will dismiss child1'); + callback(); + }, + removeCurrentView: function(currentView, callback) { + equal(currentView, child1, 'will remove child1'); + this._super(currentView, callback); + } + }); + + var child1 = Ember.View.create(); + var child2 = Ember.View.create(); + + Ember.run(function() { + container.appendTo('#qunit-fixture'); + }); + + Ember.run(function() { + set(container, 'currentView', child1); + }); + + Ember.run(function() { + set(container, 'currentView', child2); + }); +});
true
Other
emberjs
ember.js
85cc66ac39baccb4b33af824d67ebf41008db9cb.json
Remove unused variable
packages/ember-views/lib/views/view.js
@@ -711,7 +711,7 @@ Ember.View = Ember.Object.extend(Ember.Evented, @property _context */ _context: Ember.computed(function(key, value) { - var parentView, controller, context; + var parentView, controller; if (arguments.length === 2) { return value;
false
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
LICENSE
@@ -1,4 +1,4 @@ -Copyright (c) 2011 Yehuda Katz, Tom Dale, Charles Jolley and Ember.js contributors +Copyright (c) 2012 Yehuda Katz, Tom Dale, Charles Jolley and Ember.js contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
generators/license.js
@@ -3,5 +3,6 @@ // Copyright: ©2011-2012 Tilde Inc. and contributors // Portions ©2006-2011 Strobe Inc. // Portions ©2008-2011 Apple Inc. All rights reserved. -// License: Licensed under MIT license (see license.js) +// License: Licensed under MIT license +// See https://raw.github.com/emberjs/ember.js/master/LICENSE // ==========================================================================
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-application/lib/system/application.js
@@ -1,10 +1,3 @@ -// ========================================================================== -// Project: Ember - JavaScript Application Framework -// Copyright: ©2006-2011 Strobe Inc. and contributors. -// Portions ©2008-2011 Apple Inc. All rights reserved. -// License: Licensed under MIT license (see license.js) -// ========================================================================== - /** @module ember @submodule ember-application
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-application/tests/system/application_test.js
@@ -1,10 +1,3 @@ -// ========================================================================== -// Project: Ember - JavaScript Application Framework -// Copyright: ©2006-2011 Strobe Inc. and contributors. -// Portions ©2008-2011 Apple Inc. All rights reserved. -// License: Licensed under MIT license (see license.js) -// ========================================================================== - var view; var application; var set = Ember.set, get = Ember.get;
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-handlebars/lib/controls.js
@@ -1,9 +1,3 @@ -// ========================================================================== -// Project: Ember Handlebars Views -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== - require("ember-handlebars/controls/checkbox"); require("ember-handlebars/controls/text_field"); require("ember-handlebars/controls/button");
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-handlebars/lib/controls/button.js
@@ -1,9 +1,3 @@ -// ========================================================================== -// Project: Ember Handlebars Views -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== - require('ember-runtime/mixins/target_action_support'); /**
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-handlebars/lib/controls/checkbox.js
@@ -1,9 +1,3 @@ -// ========================================================================== -// Project: Ember Handlebars Views -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== - require("ember-views/views/view"); require("ember-handlebars/ext");
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-handlebars/lib/controls/text_area.js
@@ -1,9 +1,3 @@ -// ========================================================================== -// Project: Ember Handlebars Views -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== - require("ember-handlebars/ext"); require("ember-views/views/view"); require("ember-handlebars/controls/text_support");
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-handlebars/lib/controls/text_field.js
@@ -1,9 +1,3 @@ -// ========================================================================== -// Project: Ember Handlebars Views -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== - require("ember-handlebars/ext"); require("ember-views/views/view"); require("ember-handlebars/controls/text_support");
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-handlebars/lib/controls/text_support.js
@@ -1,9 +1,3 @@ -// ========================================================================== -// Project: Ember Handlebars Views -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== - require("ember-handlebars/ext"); require("ember-views/views/view");
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-handlebars/lib/ext.js
@@ -1,8 +1,3 @@ -// ========================================================================== -// Project: Ember Handlebars Views -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== /*globals Handlebars */ require("ember-views/system/render_buffer");
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-handlebars/lib/helpers.js
@@ -1,9 +1,3 @@ -// ========================================================================== -// Project: Ember Handlebars Views -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== - require("ember-handlebars/helpers/binding"); require("ember-handlebars/helpers/collection"); require("ember-handlebars/helpers/view");
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-handlebars/lib/helpers/binding.js
@@ -1,9 +1,3 @@ -// ========================================================================== -// Project: Ember Handlebars Views -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== - require('ember-handlebars/ext'); require('ember-handlebars/views/handlebars_bound_view'); require('ember-handlebars/views/metamorph_view');
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-handlebars/lib/helpers/collection.js
@@ -1,8 +1,3 @@ -// ========================================================================== -// Project: Ember Handlebars Views -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== /*globals Handlebars */ // TODO: Don't require all of this module
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-handlebars/lib/helpers/debug.js
@@ -1,9 +1,3 @@ -// ========================================================================== -// Project: Ember Handlebars Views -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== - /*jshint debug:true*/ require('ember-handlebars/ext');
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-handlebars/lib/helpers/unbound.js
@@ -1,8 +1,3 @@ -// ========================================================================== -// Project: Ember Handlebars Views -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== /*globals Handlebars */ require('ember-handlebars/ext');
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-handlebars/lib/helpers/view.js
@@ -1,8 +1,3 @@ -// ========================================================================== -// Project: Ember Handlebars Views -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== /*globals Handlebars */ // TODO: Don't require the entire module
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-handlebars/lib/loader.js
@@ -1,8 +1,3 @@ -// ========================================================================== -// Project: Ember Handlebars Views -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== /*globals Handlebars */ require("ember-handlebars/ext");
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-handlebars/lib/main.js
@@ -1,9 +1,3 @@ -// ========================================================================== -// Project: Ember Handlebars Views -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== - require("ember-runtime"); require("ember-views"); require("ember-handlebars/ext");
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-handlebars/lib/views.js
@@ -1,8 +1,2 @@ -// ========================================================================== -// Project: Ember Handlebars Views -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== - require("ember-handlebars/views/handlebars_bound_view"); require("ember-handlebars/views/metamorph_view");
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-handlebars/lib/views/handlebars_bound_view.js
@@ -1,8 +1,3 @@ -// ========================================================================== -// Project: Ember Handlebars Views -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== /*globals Handlebars */ /**
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-handlebars/tests/controls/button_test.js
@@ -1,9 +1,3 @@ -// ========================================================================== -// Project: Ember Handlebars Views -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== - var button, dispatcher; var get = Ember.get, set = Ember.set;
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-handlebars/tests/controls/checkbox_test.js
@@ -1,9 +1,3 @@ -// ========================================================================== -// Project: Ember Handlebars Views -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== - var get = Ember.get, set = Ember.set, checkboxView, dispatcher; module("Ember.Checkbox", {
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-handlebars/tests/controls/text_area_test.js
@@ -1,8 +1,3 @@ -// ========================================================================== -// Project: Ember Handlebars Views -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== /*globals TestObject:true */ var textArea;
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-handlebars/tests/controls/text_field_test.js
@@ -1,8 +1,3 @@ -// ========================================================================== -// Project: Ember Handlebars Views -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== /*globals TestObject:true */ var textField;
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-handlebars/tests/handlebars_test.js
@@ -1,8 +1,3 @@ -// ========================================================================== -// Project: Ember Handlebars Views -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== /*globals TemplateTests:true MyApp:true App:true */ var get = Ember.get, set = Ember.set;
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-handlebars/tests/helpers/yield_test.js
@@ -1,8 +1,3 @@ -// ========================================================================== -// Project: Ember Handlebars Views -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== /*global TemplateTests*/ var set = Ember.set, get = Ember.get;
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-handlebars/tests/views/collection_view_test.js
@@ -1,8 +1,3 @@ -// ========================================================================== -// Project: Ember Handlebars Views -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== /*globals TemplateTests:true App:true */ var set = Ember.set, get = Ember.get;
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-metal/lib/accessors.js
@@ -1,9 +1,3 @@ -// ========================================================================== -// Project: Ember Metal -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== - require('ember-metal/core'); require('ember-metal/platform'); require('ember-metal/utils');
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-metal/lib/binding.js
@@ -1,9 +1,3 @@ -// ========================================================================== -// Project: Ember Runtime -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== - require('ember-metal/core'); // Ember.Logger require('ember-metal/accessors'); // get, set, trySet require('ember-metal/utils'); // guidFor, isArray, meta
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-metal/lib/computed.js
@@ -1,9 +1,3 @@ -// ========================================================================== -// Project: Ember Metal -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== - require('ember-metal/core'); require('ember-metal/platform'); require('ember-metal/utils');
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-metal/lib/core.js
@@ -1,8 +1,3 @@ -// ========================================================================== -// Project: Ember Metal -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== /*globals Em:true ENV */ /**
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-metal/lib/events.js
@@ -1,9 +1,3 @@ -// ========================================================================== -// Project: Ember Metal -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== - require('ember-metal/core'); require('ember-metal/platform'); require('ember-metal/utils');
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-metal/lib/main.js
@@ -1,9 +1,3 @@ -// ========================================================================== -// Project: Ember Metal -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== - /** Ember Metal
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-metal/lib/mixin.js
@@ -1,9 +1,3 @@ -// ========================================================================== -// Project: Ember Runtime -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== - require('ember-metal/core'); require('ember-metal/accessors'); require('ember-metal/computed');
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-metal/lib/observer.js
@@ -1,9 +1,3 @@ -// ========================================================================== -// Project: Ember Metal -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== - require('ember-metal/core'); require('ember-metal/platform'); require('ember-metal/utils');
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-metal/lib/platform.js
@@ -1,8 +1,3 @@ -// ========================================================================== -// Project: Ember Metal -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== /*globals Node */ require('ember-metal/core');
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-metal/lib/properties.js
@@ -1,9 +1,3 @@ -// ========================================================================== -// Project: Ember Metal -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== - require('ember-metal/core'); require('ember-metal/platform'); require('ember-metal/utils');
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-metal/lib/run_loop.js
@@ -1,10 +1,3 @@ -// ========================================================================== -// Project: Ember Runtime -// Copyright: ©2006-2011 Strobe Inc. and contributors. -// Portions ©2008-2010 Apple Inc. All rights reserved. -// License: Licensed under MIT license (see license.js) -// ========================================================================== - require('ember-metal/core'); // Ember.Logger require('ember-metal/watching'); // Ember.watch.flushPending require('ember-metal/observer'); // Ember.beginPropertyChanges, Ember.endPropertyChanges
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-metal/lib/utils.js
@@ -1,9 +1,3 @@ -// ========================================================================== -// Project: Ember Metal -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== - require('ember-metal/core'); require('ember-metal/platform');
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-metal/lib/watching.js
@@ -1,9 +1,3 @@ -// ========================================================================== -// Project: Ember Metal -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== - require('ember-metal/core'); require('ember-metal/platform'); require('ember-metal/utils');
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-metal/tests/accessors/getPath_test.js
@@ -1,8 +1,3 @@ -// ========================================================================== -// Project: Ember Runtime -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== /*globals Foo:true $foo:true */ var obj, moduleOpts = {
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-metal/tests/accessors/get_test.js
@@ -1,9 +1,3 @@ -// ========================================================================== -// Project: Ember Runtime -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== - require('ember-metal/~tests/props_helper'); module('Ember.get');
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-metal/tests/accessors/isGlobalPath_test.js
@@ -1,9 +1,3 @@ -// ========================================================================== -// Project: Ember Runtime -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== - module('Ember.isGlobalPath'); test("global path's are recognized", function(){
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-metal/tests/accessors/normalizeTuple_test.js
@@ -1,8 +1,3 @@ -// ========================================================================== -// Project: Ember Runtime -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== /*globals Foo:true $foo:true */ var obj, moduleOpts = {
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-metal/tests/accessors/setPath_test.js
@@ -1,8 +1,3 @@ -// ========================================================================== -// Project: Ember Runtime -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== /*globals Foo:true $foo:true */ var obj, moduleOpts = {
true
Other
emberjs
ember.js
b2470d9d824d7251307749cade58593f41760e31.json
Remove duplicate licenses, update copyright year
packages/ember-metal/tests/accessors/set_test.js
@@ -1,10 +1,3 @@ -// ========================================================================== -// Project: Ember Runtime -// Copyright: ©2011 Strobe Inc. and contributors. -// License: Licensed under MIT license (see license.js) -// ========================================================================== - - module('Ember.set'); test('should set arbitrary properties on an object', function() {
true