]> source.dussan.org Git - jquery.git/commitdiff
Simplify jQuery( html, props ), closes gh-765.
authorScott González <scott.gonzalez@gmail.com>
Fri, 4 May 2012 17:55:23 +0000 (13:55 -0400)
committerDave Methvin <dave.methvin@gmail.com>
Mon, 7 May 2012 01:24:46 +0000 (21:24 -0400)
src/core.js

index 2ed6d62b6015b0067f9db69343557321d72568e5..f1feb702f25da8d0357560e95c60c306fca960a9 100644 (file)
@@ -116,19 +116,16 @@ jQuery.fn = jQuery.prototype = {
                                // HANDLE: $(html) -> $(array)
                                if ( match[1] ) {
                                        context = context instanceof jQuery ? context[0] : context;
-                                       doc = ( context ? context.ownerDocument || context : document );
+                                       doc = ( context && context.nodeType ? context.ownerDocument || context : document );
 
                                        // If a single string is passed in and it's a single tag
                                        // just do a createElement and skip the rest
                                        ret = rsingleTag.exec( selector );
 
                                        if ( ret ) {
+                                               selector = [ doc.createElement( ret[1] ) ];
                                                if ( jQuery.isPlainObject( context ) ) {
-                                                       selector = [ document.createElement( ret[1] ) ];
-                                                       jQuery.fn.attr.call( selector, context, true );
-
-                                               } else {
-                                                       selector = [ doc.createElement( ret[1] ) ];
+                                                       this.attr.call( selector, context, true );
                                                }
 
                                        } else {