From 95a4a776cffe6dd56f5796e93c0cba0225ee49e4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Scott=20Gonz=C3=A1lez?= Date: Fri, 4 May 2012 13:55:23 -0400 Subject: [PATCH] Simplify jQuery( html, props ), closes gh-765. --- src/core.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/core.js b/src/core.js index 2ed6d62b6..f1feb702f 100644 --- a/src/core.js +++ b/src/core.js @@ -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 { -- 2.39.5