mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Don't inject style elements using innerHTML as they will go away in IE. Fixes #5977.
This commit is contained in:
parent
14e1200d59
commit
c1ac9fdf45
@ -5,7 +5,7 @@ var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
|
|||||||
rtagName = /<([\w:]+)/,
|
rtagName = /<([\w:]+)/,
|
||||||
rtbody = /<tbody/i,
|
rtbody = /<tbody/i,
|
||||||
rhtml = /<|&#?\w+;/,
|
rhtml = /<|&#?\w+;/,
|
||||||
rnocache = /<script|<object|<embed|<option/i,
|
rnocache = /<script|<object|<embed|<option|<style/i,
|
||||||
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, // checked="checked" or checked (html5)
|
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, // checked="checked" or checked (html5)
|
||||||
fcloseTag = function( all, front, tag ) {
|
fcloseTag = function( all, front, tag ) {
|
||||||
return rselfClosing.test( tag ) ?
|
return rselfClosing.test( tag ) ?
|
||||||
|
@ -866,7 +866,7 @@ test("clone() on XML nodes", function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var testHtml = function(valueObj) {
|
var testHtml = function(valueObj) {
|
||||||
expect(29);
|
expect(31);
|
||||||
|
|
||||||
jQuery.scriptorder = 0;
|
jQuery.scriptorder = 0;
|
||||||
|
|
||||||
@ -886,6 +886,11 @@ var testHtml = function(valueObj) {
|
|||||||
equals( jQuery("<div/>").html(valueObj(" "))[0].innerHTML, " ", "Make sure entities are passed through correctly." );
|
equals( jQuery("<div/>").html(valueObj(" "))[0].innerHTML, " ", "Make sure entities are passed through correctly." );
|
||||||
equals( jQuery("<div/>").html(valueObj("&"))[0].innerHTML, "&", "Make sure entities are passed through correctly." );
|
equals( jQuery("<div/>").html(valueObj("&"))[0].innerHTML, "&", "Make sure entities are passed through correctly." );
|
||||||
|
|
||||||
|
jQuery("#main").html(valueObj("<style>.foobar{color:green;}</style>"));
|
||||||
|
|
||||||
|
equals( jQuery("#main").children().length, 1, "Make sure there is a child element." );
|
||||||
|
equals( jQuery("#main").children()[0].nodeName.toUpperCase(), "STYLE", "And that a style element was inserted." );
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
// using contents will get comments regular, text, and comment nodes
|
// using contents will get comments regular, text, and comment nodes
|
||||||
var j = jQuery("#nonnodes").contents();
|
var j = jQuery("#nonnodes").contents();
|
||||||
|
Loading…
Reference in New Issue
Block a user