Permalink
Browse files

Merge pull request #294 from arexkun/master

Fix for #293
  • Loading branch information...
2 parents 9e97371 + 7a85952 commit 60f87bff505495e63dbf37d4516c0aa9d6d9c82f @kossnocorp kossnocorp committed Oct 26, 2011
Showing with 26 additions and 1 deletion.
  1. +1 −1 src/zepto.js
  2. +25 −0 test/zepto.html
View
@@ -444,7 +444,7 @@ var Zepto = (function() {
for (var i = 0; i < nodes.length; i++) {
var node = nodes[inReverse ? nodes.length-i-1 : i];
traverseNode(node, function (node) {
- if (node.nodeName != null && node.nodeName.toUpperCase() === 'SCRIPT') {
+ if (node.nodeName != null && node.nodeName.toUpperCase() === 'SCRIPT' && (!node.type || node.type === 'text/javascript')) {
window['eval'].call(window, node.innerHTML);
}
});
View
@@ -1317,6 +1317,31 @@
}
},
+ testAppendTemplateNonEval: function (t) {
+ try {
+ window.someGlobalVariable = true;
+ $('<' + 'script type="text/template">window.someGlobalVariable = false;</script' + '>').appendTo('body');
+ t.assert(window.someGlobalVariable);
+
+ window.someGlobalVariable = true;
+ $('<' + 'script type="text/template">this.someGlobalVariable = false;</script' + '>').appendTo('body');
+ t.assert(window.someGlobalVariable);
+ } finally {
+ delete window.someGlobalVariable;
+ }
+ },
+
+ testHtmlTemplateNonEval: function (t) {
+ try {
+ window.someGlobalVariable = true;
+ $('<div></div>').appendTo('body')
+ .html('<' + 'script type="text/template">window.someGlobalVariable = false;</script' + '>');
+ t.assert(window.someGlobalVariable);
+ } finally {
+ delete window.someGlobalVariable;
+ }
+ },
+
testRemove: function (t) {
var newElement1 = $('<div id="some_new_element_1" />');

0 comments on commit 60f87bf

Please sign in to comment.