Skip to content

Commit

Permalink
fix($onsen): read-only variables fix, fixes #767
Browse files Browse the repository at this point in the history
  • Loading branch information
andipavllo committed Jul 10, 2015
1 parent c9717ca commit 8fd0393
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions framework/services/onsen.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ limitations under the License.
return element[methodName].apply(element, arguments);
};
});

return function() {
methodNames.forEach(function(methodName) {
view[methodName] = null;
Expand Down Expand Up @@ -163,7 +163,7 @@ limitations under the License.
deferred.resolve(this.normalizePageHTML(html));

return deferred.promise;

} else {
return $http({
url: page,
Expand All @@ -186,7 +186,7 @@ limitations under the License.
if (!html.match(/^<(ons-page|ons-navigator|ons-tabbar|ons-sliding-menu|ons-split-view)/)) {
html = '<ons-page>' + html + '</ons-page>';
}

return html;
},

Expand All @@ -195,7 +195,7 @@ limitations under the License.
*
* @param {Object} attrs
* @param {Array} [modifiers] an array of appendix modifier
* @return {Function}
* @return {Function}
*/
generateModifierTemplater: function(attrs, modifiers) {
var attrModifiers = attrs && typeof attrs.modifier === 'string' ? attrs.modifier.trim().split(/ +/) : [];
Expand All @@ -216,7 +216,7 @@ limitations under the License.
* Add modifier methods to view object for custom elements.
*
* @param {Object} view object
* @param {jqLite} element
* @param {jqLite} element
*/
addModifierMethodsForCustomElements: function(view, element) {
var methods = {
Expand Down Expand Up @@ -268,7 +268,7 @@ limitations under the License.
*
* @param {Object} view object
* @param {String} template
* @param {jqLite} element
* @param {jqLite} element
*/
addModifierMethods: function(view, template, element) {
var _tr = function(modifier) {
Expand All @@ -285,7 +285,7 @@ limitations under the License.
},

addModifier: function(modifier) {
element.addClass(_tr(modifier));
element.addClass(_tr(modifier));
},

setModifier: function(modifier) {
Expand All @@ -306,7 +306,7 @@ limitations under the License.
toggleModifier: function(modifier) {
var cls = _tr(modifier);
if (element.hasClass(cls)) {
element.removeClass(cls);
element.removeClass(cls);
} else {
element.addClass(cls);
}
Expand Down Expand Up @@ -469,6 +469,10 @@ limitations under the License.
}

container[names[names.length - 1]] = object;

if (container[names[names.length -1]] !== object) {
throw new Error('You cannot set var="' + object._attrs.var + '" because it\'s already a \'window\' read-only attribute.');
}
}

if (ons.componentBase) {
Expand Down

0 comments on commit 8fd0393

Please sign in to comment.