Fixed bug #1594, #1565, #1598 - all of which were concerning the improper execution of embedded scripts in IE and Safari.
This commit is contained in:
parent
62d84e44ac
commit
606b863eda
28
src/core.js
28
src/core.js
|
@ -394,18 +394,32 @@ jQuery.fn = jQuery.prototype = {
|
||||||
obj = this.getElementsByTagName("tbody")[0] || this.appendChild(document.createElement("tbody"));
|
obj = this.getElementsByTagName("tbody")[0] || this.appendChild(document.createElement("tbody"));
|
||||||
|
|
||||||
jQuery.each( a, function(){
|
jQuery.each( a, function(){
|
||||||
if ( jQuery.nodeName(this, "script") ) {
|
var elem = clone ? this.cloneNode(true) : this;
|
||||||
if ( this.src )
|
if ( !evalScript(0, elem) )
|
||||||
jQuery.ajax({ url: this.src, async: false, dataType: "script" });
|
fn.call( obj, elem );
|
||||||
else
|
|
||||||
jQuery.globalEval( this.text || this.textContent || this.innerHTML || "" );
|
|
||||||
} else
|
|
||||||
fn.apply( obj, [ clone ? this.cloneNode(true) : this ] );
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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() {
|
jQuery.extend = jQuery.fn.extend = function() {
|
||||||
// copy reference to target object
|
// copy reference to target object
|
||||||
var target = arguments[0] || {}, a = 1, al = arguments.length, deep = false;
|
var target = arguments[0] || {}, a = 1, al = arguments.length, deep = false;
|
||||||
|
|
|
@ -821,7 +821,7 @@ test("val(String)", function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("html(String)", function() {
|
test("html(String)", function() {
|
||||||
expect(1);
|
expect(3);
|
||||||
var div = $("div");
|
var div = $("div");
|
||||||
div.html("<b>test</b>");
|
div.html("<b>test</b>");
|
||||||
var pass = true;
|
var pass = true;
|
||||||
|
@ -830,8 +830,13 @@ test("html(String)", function() {
|
||||||
}
|
}
|
||||||
ok( pass, "Set HTML" );
|
ok( pass, "Set HTML" );
|
||||||
|
|
||||||
// Ccommented out until we can resolve it
|
stop();
|
||||||
// $("#main").html('<script type="text/javascript">ok( true, "$().html().evalScripts() Evals Scripts Twice in Firefox, see #975" );</script>').evalScripts();
|
|
||||||
|
$("#main").html('<script type="text/javascript">ok( true, "$().html().evalScripts() Evals Scripts Twice in Firefox, see #975" );</script>');
|
||||||
|
|
||||||
|
$("#main").html('foo <form><script type="text/javascript">ok( true, "$().html().evalScripts() Evals Scripts Twice in Firefox, see #975" );</script></form>');
|
||||||
|
|
||||||
|
setTimeout( start, 100 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test("filter()", function() {
|
test("filter()", function() {
|
||||||
|
|
Loading…
Reference in a new issue