aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2007-09-15 02:16:29 +0000
committerJohn Resig <jeresig@gmail.com>2007-09-15 02:16:29 +0000
commit606b863edaff29035960e4d813b45d63b8d92876 (patch)
treedf1c3216c418ca80e1d6c23c56835ed8802b2bc8 /src
parent62d84e44ac3b4a3673c320514bbf5ac8dc7712d6 (diff)
downloadjquery-606b863edaff29035960e4d813b45d63b8d92876.tar.gz
jquery-606b863edaff29035960e4d813b45d63b8d92876.zip
Fixed bug #1594, #1565, #1598 - all of which were concerning the improper execution of embedded scripts in IE and Safari.
Diffstat (limited to 'src')
-rw-r--r--src/core.js28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/core.js b/src/core.js
index eb135400a..d9749ba49 100644
--- a/src/core.js
+++ b/src/core.js
@@ -394,18 +394,32 @@ jQuery.fn = jQuery.prototype = {
obj = this.getElementsByTagName("tbody")[0] || this.appendChild(document.createElement("tbody"));
jQuery.each( a, function(){
- if ( jQuery.nodeName(this, "script") ) {
- if ( this.src )
- jQuery.ajax({ url: this.src, async: false, dataType: "script" });
- else
- jQuery.globalEval( this.text || this.textContent || this.innerHTML || "" );
- } else
- fn.apply( obj, [ clone ? this.cloneNode(true) : this ] );
+ var elem = clone ? this.cloneNode(true) : this;
+ if ( !evalScript(0, elem) )
+ fn.call( obj, elem );
});
});
}
};
+function evalScript(i, elem){
+ var script = jQuery.nodeName(elem, "script");
+
+ if ( script ) {
+ if ( elem.src )
+ jQuery.ajax({ url: elem.src, async: false, dataType: "script" });
+ else
+ jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
+
+ if ( elem.parentNode )
+ elem.parentNode.removeChild(elem);
+
+ } else if ( elem.nodeType == 1 )
+ jQuery("script", elem).each(evalScript);
+
+ return script;
+}
+
jQuery.extend = jQuery.fn.extend = function() {
// copy reference to target object
var target = arguments[0] || {}, a = 1, al = arguments.length, deep = false;