Commit c0294278 authored by John Resig's avatar John Resig

Landed a proper fix for #3255 - which involves doing createElement instead of...

Landed a proper fix for #3255 - which involves doing createElement instead of going through the normal clean method.
parent cff37cc8
...@@ -819,6 +819,14 @@ jQuery.extend({ ...@@ -819,6 +819,14 @@ jQuery.extend({
if ( typeof context.createElement === "undefined" ) if ( typeof context.createElement === "undefined" )
context = context.ownerDocument || context[0] && context[0].ownerDocument || document; context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
// If a single string is passed in and it's a single tag
// just do a createElement and skip the rest
if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) {
var match = /^<(\w+)\/?>$/.exec(elems[0]);
if ( match )
return [ context.createElement( match[1] ) ];
}
var ret = [], scripts = [], div = context.createElement("div"); var ret = [], scripts = [], div = context.createElement("div");
jQuery.each(elems, function(i, elem){ jQuery.each(elems, function(i, elem){
...@@ -915,12 +923,6 @@ jQuery.extend({ ...@@ -915,12 +923,6 @@ jQuery.extend({
}); });
// Clean up
// Safari 3.1 throws an exception when a colgroup is created
try {
div.innerHTML = "";
} catch(e){}
if ( fragment ) { if ( fragment ) {
for ( var i = 0; ret[i]; i++ ) { for ( var i = 0; ret[i]; i++ ) {
var node = ret[i]; var node = ret[i];
......
...@@ -254,7 +254,7 @@ test("isFunction", function() { ...@@ -254,7 +254,7 @@ test("isFunction", function() {
var foo = false; var foo = false;
test("jQuery('html')", function() { test("jQuery('html')", function() {
expect(6); expect(8);
reset(); reset();
foo = false; foo = false;
...@@ -267,7 +267,9 @@ test("jQuery('html')", function() { ...@@ -267,7 +267,9 @@ test("jQuery('html')", function() {
reset(); reset();
ok( jQuery("<link rel='stylesheet'/>")[0], "Creating a link" ); ok( jQuery("<link rel='stylesheet'/>")[0], "Creating a link" );
reset(); ok( !jQuery("<script/>")[0].parentNode, "Create a script" );
ok( jQuery("<input/>").attr("type", "hidden"), "Create an input and set the type." );
var j = jQuery("<span>hi</span> there <!-- mon ami -->"); var j = jQuery("<span>hi</span> there <!-- mon ami -->");
ok( j.length >= 2, "Check node,textnode,comment creation (some browsers delete comments)" ); ok( j.length >= 2, "Check node,textnode,comment creation (some browsers delete comments)" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment