dist/ember.prod.js in ember-source-1.8.0 vs dist/ember.prod.js in ember-source-1.8.1
- old
+ new
@@ -3,11 +3,11 @@
* @copyright Copyright 2011-2014 Tilde Inc. and contributors
* Portions Copyright 2006-2011 Strobe Inc.
* Portions Copyright 2008-2011 Apple Inc. All rights reserved.
* @license Licensed under MIT license
* See https://raw.github.com/emberjs/ember.js/master/LICENSE
- * @version 1.8.0
+ * @version 1.8.1
*/
(function() {
var enifed, requireModule, eriuqer, requirejs, Ember;
@@ -9332,20 +9332,26 @@
helper: function(thisContext, path, options) {
var data = options.data;
var fn = options.fn;
var newView;
+ var newViewProto;
makeBindings(thisContext, options);
var container = this.container || (data && data.view && data.view.container);
newView = handlebarsGetView(thisContext, path, container, options);
+ if (View.detectInstance(newView)) {
+ newViewProto = newView;
+ } else {
+ newViewProto = newView.proto();
+ }
+
var viewOptions = this.propertiesFromHTMLOptions(options, thisContext);
var currentView = data.view;
viewOptions.templateData = data;
- var newViewProto = newView.proto();
if (fn) {
viewOptions.template = fn;
}
@@ -9810,10 +9816,13 @@
@for Ember.String
@static
@return {Handlebars.SafeString} a string that will not be html escaped by Handlebars
*/
function htmlSafe(str) {
+ if (typeof str !== 'string') {
+ str = ''+str;
+ }
return new Handlebars.SafeString(str);
}
EmberStringUtils.htmlSafe = htmlSafe;
if (Ember.EXTEND_PROTOTYPES === true || Ember.EXTEND_PROTOTYPES.String) {
@@ -9837,11 +9846,11 @@
}
__exports__["default"] = htmlSafe;
});
enifed("ember-handlebars/views/handlebars_bound_view",
- ["ember-handlebars-compiler","ember-metal/core","ember-metal/error","ember-metal/property_get","ember-metal/property_set","ember-metal/merge","ember-metal/run_loop","ember-metal/computed","ember-views/views/view","ember-views/views/states","ember-handlebars/views/metamorph_view","ember-handlebars/ext","ember-metal/utils","exports"],
+ ["ember-handlebars-compiler","ember-metal/core","ember-metal/error","ember-metal/property_get","ember-metal/property_set","ember-metal/merge","ember-metal/run_loop","ember-views/views/view","ember-handlebars/string","ember-views/views/states","ember-handlebars/views/metamorph_view","ember-handlebars/ext","ember-metal/utils","exports"],
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __dependency10__, __dependency11__, __dependency12__, __dependency13__, __exports__) {
"use strict";
/*globals Handlebars, Metamorph:true */
/*jshint newcap:false*/
@@ -9862,12 +9871,12 @@
var EmberError = __dependency3__["default"];
var get = __dependency4__.get;
var set = __dependency5__.set;
var merge = __dependency6__["default"];
var run = __dependency7__["default"];
- var computed = __dependency8__.computed;
- var View = __dependency9__["default"];
+ var View = __dependency8__["default"];
+ var htmlSafe = __dependency9__["default"];
var cloneStates = __dependency10__.cloneStates;
var states = __dependency10__.states;
var viewStates = states;
var _MetamorphView = __dependency11__["default"];
@@ -9924,11 +9933,11 @@
templateData = this.templateData;
result = handlebarsGet(pathRoot, path, { data: templateData });
}
if (!escape && !(result instanceof SafeString)) {
- result = new SafeString(result);
+ result = htmlSafe(result);
}
return result;
},
@@ -13333,11 +13342,11 @@
The core Runtime framework is based on the jQuery API with a number of
performance optimizations.
@class Ember
@static
- @version 1.8.0
+ @version 1.8.1
*/
if ('undefined' === typeof Ember) {
// Create core object. Make it act like an instance of Ember.Namespace so that
// objects assigned to it are given a sane string representation.
@@ -13360,14 +13369,14 @@
/**
@property VERSION
@type String
- @default '1.8.0'
+ @default '1.8.1'
@static
*/
- Ember.VERSION = '1.8.0';
+ Ember.VERSION = '1.8.1';
/**
Standard environmental variables. You can define these in a global `EmberENV`
variable before loading Ember to control various configuration settings.
@@ -13523,21 +13532,23 @@
__exports__["default"] = Ember;
});
enifed("ember-metal/dependent_keys",
["ember-metal/platform","ember-metal/watching","exports"],
function(__dependency1__, __dependency2__, __exports__) {
- "use strict";
- var create = __dependency1__.create;
+ // Remove "use strict"; from transpiled module until
+ // https://bugs.webkit.org/show_bug.cgi?id=138038 is fixed
+ //
+ // REMOVE_USE_STRICT: true
+
+ var o_create = __dependency1__.create;
var watch = __dependency2__.watch;
var unwatch = __dependency2__.unwatch;
/**
@module ember-metal
*/
- var o_create = create;
-
// ..........................................................
// DEPENDENT KEYS
//
// data structure:
@@ -13958,11 +13969,15 @@
__exports__["default"] = EmberError;
});
enifed("ember-metal/events",
["ember-metal/core","ember-metal/utils","ember-metal/platform","exports"],
function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
- "use strict";
+ // Remove "use strict"; from transpiled module until
+ // https://bugs.webkit.org/show_bug.cgi?id=138038 is fixed
+ //
+ // REMOVE_USE_STRICT: true
+
/**
@module ember-metal
*/
var Ember = __dependency1__["default"];
var meta = __dependency2__.meta;
@@ -15725,11 +15740,15 @@
}
});
enifed("ember-metal/mixin",
["ember-metal/core","ember-metal/merge","ember-metal/array","ember-metal/platform","ember-metal/utils","ember-metal/expand_properties","ember-metal/properties","ember-metal/computed","ember-metal/binding","ember-metal/observer","ember-metal/events","exports"],
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __dependency10__, __dependency11__, __exports__) {
- "use strict";
+ // Remove "use strict"; from transpiled module until
+ // https://bugs.webkit.org/show_bug.cgi?id=138038 is fixed
+ //
+ // REMOVE_USE_STRICT: true
+
/**
@module ember
@submodule ember-metal
*/
@@ -18444,11 +18463,15 @@
}
});
enifed("ember-metal/utils",
["ember-metal/core","ember-metal/platform","ember-metal/array","exports"],
function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
- "use strict";
+ // Remove "use strict"; from transpiled module until
+ // https://bugs.webkit.org/show_bug.cgi?id=138038 is fixed
+ //
+ // REMOVE_USE_STRICT: true
+
var Ember = __dependency1__["default"];
var o_defineProperty = __dependency2__.defineProperty;
var canDefineNonEnumerableProperties = __dependency2__.canDefineNonEnumerableProperties;
var hasPropertyAccessors = __dependency2__.hasPropertyAccessors;
var create = __dependency2__.create;
@@ -24343,11 +24366,11 @@
App.Router.map(function() {
this.resource('post', {path: '/posts/:post_id'});
});
```
- The model for the `post` route is `App.Post.find(params.post_id)`.
+ The model for the `post` route is `store.find('post', params.post_id)`.
By default, if your route has a dynamic segment ending in `_id`:
* The model class is determined from the segment (`post_id`'s
class is `App.Post`)
@@ -24386,11 +24409,11 @@
Example
```js
App.PostRoute = Ember.Route.extend({
model: function(params) {
- return App.Post.find(params.post_id);
+ return this.store.find('post', params.post_id);
}
});
```
@method model
@@ -24552,11 +24575,11 @@
`_super`:
```js
App.PhotosRoute = Ember.Route.extend({
model: function() {
- return App.Photo.find();
+ return this.store.find('photo');
},
setupController: function (controller, model) {
// Call _super for default behavior
this._super(controller, model);
@@ -24787,11 +24810,11 @@
```js
// posts route
Ember.Route.extend({
renderTemplate: function(){
- this.render('posts', {
+ this.render('photos', {
into: 'application',
outlet: 'anOutletName'
})
}
});
@@ -37594,10 +37617,12 @@
@return {DOMElement} The element corresponding to the generated HTML
of this buffer
*/
element: function() {
var content = this.innerContent();
+ // No content means a text node buffer, with the content
+ // in _element. HandlebarsBoundView is an example.
if (content === null) {
return this._element;
}
var contextualElement = this.innerContextualElement(content);
@@ -37669,20 +37694,21 @@
return this.buffer;
}
};
});
enifed("ember-views/system/renderer",
- ["ember-metal-views/renderer","ember-metal/platform","ember-views/system/render_buffer","ember-metal/run_loop","ember-metal/property_set","ember-metal/instrumentation","exports"],
- function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __exports__) {
+ ["ember-metal/core","ember-metal-views/renderer","ember-metal/platform","ember-views/system/render_buffer","ember-metal/run_loop","ember-metal/property_set","ember-metal/instrumentation","exports"],
+ function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __exports__) {
"use strict";
- var Renderer = __dependency1__["default"];
- var create = __dependency2__.create;
- var renderBuffer = __dependency3__["default"];
- var run = __dependency4__["default"];
- var set = __dependency5__.set;
- var _instrumentStart = __dependency6__._instrumentStart;
- var subscribers = __dependency6__.subscribers;
+ var Ember = __dependency1__["default"];
+ var Renderer = __dependency2__["default"];
+ var create = __dependency3__.create;
+ var renderBuffer = __dependency4__["default"];
+ var run = __dependency5__["default"];
+ var set = __dependency6__.set;
+ var _instrumentStart = __dependency7__._instrumentStart;
+ var subscribers = __dependency7__.subscribers;
function EmberRenderer() {
this.buffer = renderBuffer();
Renderer.call(this);
}
@@ -37738,22 +37764,26 @@
// If this is the top-most view, start a new buffer. Otherwise,
// create a new buffer relative to the original using the
// provided buffer operation (for example, `insertAfter` will
// insert a new buffer after the "parent buffer").
var tagName = view.tagName;
+ var classNameBindings = view.classNameBindings;
+ var taglessViewWithClassBindings = tagName === '' && classNameBindings.length > 0;
+
if (tagName === null || tagName === undefined) {
tagName = 'div';
}
+
var buffer = view.buffer = this.buffer;
buffer.reset(tagName, contextualElement);
if (view.beforeRender) {
view.beforeRender(buffer);
}
- if (view.tagName !== '') {
+ if (tagName !== '') {
if (view.applyAttributesToBuffer) {
view.applyAttributesToBuffer(buffer);
}
buffer.generateElement();
}
@@ -40632,10 +40662,11 @@
forEach(attributeBindings, function(binding) {
var split = binding.split(':');
var property = split[0];
var attributeName = split[1] || property;
+
if (property in this) {
this._setupAttributeBindingObservation(property, attributeName);
// Determine the current value and add it to the render buffer
// if necessary.
@@ -41906,21 +41937,21 @@
var svgHTMLIntegrationPoints = {foreignObject: 1, desc: 1, title: 1};
__exports__.svgHTMLIntegrationPoints = svgHTMLIntegrationPoints;var svgNamespace = 'http://www.w3.org/2000/svg';
__exports__.svgNamespace = svgNamespace;
// Safari does not like using innerHTML on SVG HTML integration
// points (desc/title/foreignObject).
- var needsIntegrationPointFix = document.createElementNS && (function() {
+ var needsIntegrationPointFix = document && document.createElementNS && (function() {
// In FF title will not accept innerHTML.
var testEl = document.createElementNS(svgNamespace, 'title');
testEl.innerHTML = "<div></div>";
return testEl.childNodes.length === 0 || testEl.childNodes[0].nodeType !== 1;
})();
// Internet Explorer prior to 9 does not allow setting innerHTML if the first element
// is a "zero-scope" element. This problem can be worked around by making
// the first node an invisible text node. We, like Modernizr, use ­
- var needsShy = (function() {
+ var needsShy = document && (function() {
var testEl = document.createElement('div');
testEl.innerHTML = "<div></div>";
testEl.firstChild.innerHTML = "<script><\/script>";
return testEl.firstChild.innerHTML === '';
})();
@@ -41933,10 +41964,35 @@
testEl.innerHTML = "Test: <script type='text/x-placeholder'><\/script>Value";
return testEl.childNodes[0].nodeValue === 'Test:' &&
testEl.childNodes[2].nodeValue === ' Value';
})();
+ // IE8 create a selected attribute where they should only
+ // create a property
+ var createsSelectedAttribute = document && (function() {
+ var testEl = document.createElement('div');
+ testEl.innerHTML = "<select><option></option></select>";
+ return testEl.childNodes[0].childNodes[0].getAttribute('selected') === 'selected';
+ })();
+
+ var detectAutoSelectedOption;
+ if (createsSelectedAttribute) {
+ var detectAutoSelectedOptionRegex = /<option[^>]*selected/;
+ detectAutoSelectedOption = function detectAutoSelectedOption(select, option, html) { //jshint ignore:line
+ return select.selectedIndex === 0 &&
+ !detectAutoSelectedOptionRegex.test(html);
+ };
+ } else {
+ detectAutoSelectedOption = function detectAutoSelectedOption(select, option, html) { //jshint ignore:line
+ var selectedAttribute = option.getAttribute('selected');
+ return select.selectedIndex === 0 && (
+ selectedAttribute === null ||
+ ( selectedAttribute !== '' && selectedAttribute.toLowerCase() !== 'selected' )
+ );
+ };
+ }
+
// IE 9 and earlier don't allow us to set innerHTML on col, colgroup, frameset,
// html, style, table, tbody, tfoot, thead, title, tr. Detect this and add
// them to an initial list of corrected tags.
//
// Here we are only dealing with the ones which can have child nodes.
@@ -42046,11 +42102,10 @@
contextualElement.innerHTML = html;
return contextualElement.childNodes;
};
}
-
var buildIESafeDOM;
if (tagNamesRequiringInnerHTMLFix || movesWhitespace) {
buildIESafeDOM = function buildIESafeDOM(html, contextualElement, dom) {
// Make a list of the leading text on script nodes. Include
// script tags without any whitespace for easier processing later.
@@ -42113,20 +42168,48 @@
};
} else {
buildIESafeDOM = buildDOM;
}
+ // When parsing innerHTML, the browser may set up DOM with some things
+ // not desired. For example, with a select element context and option
+ // innerHTML the first option will be marked selected.
+ //
+ // This method cleans up some of that, resetting those values back to
+ // their defaults.
+ //
+ function buildSafeDOM(html, contextualElement, dom) {
+ var childNodes = buildIESafeDOM(html, contextualElement, dom);
+
+ if (contextualElement.tagName === 'SELECT') {
+ // Walk child nodes
+ for (var i = 0; childNodes[i]; i++) {
+ // Find and process the first option child node
+ if (childNodes[i].tagName === 'OPTION') {
+ if (detectAutoSelectedOption(childNodes[i].parentNode, childNodes[i], html)) {
+ // If the first node is selected but does not have an attribute,
+ // presume it is not really selected.
+ childNodes[i].parentNode.selectedIndex = -1;
+ }
+ break;
+ }
+ }
+ }
+
+ return childNodes;
+ }
+
var buildHTMLDOM;
if (needsIntegrationPointFix) {
buildHTMLDOM = function buildHTMLDOM(html, contextualElement, dom){
if (svgHTMLIntegrationPoints[contextualElement.tagName]) {
- return buildIESafeDOM(html, document.createElement('div'), dom);
+ return buildSafeDOM(html, document.createElement('div'), dom);
} else {
- return buildIESafeDOM(html, contextualElement, dom);
+ return buildSafeDOM(html, contextualElement, dom);
}
};
} else {
- buildHTMLDOM = buildIESafeDOM;
+ buildHTMLDOM = buildSafeDOM;
}
__exports__.buildHTMLDOM = buildHTMLDOM;
});
enifed("morph/morph",
\ No newline at end of file