aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2012-05-04 13:55:23 -0400
committerDave Methvin <dave.methvin@gmail.com>2012-05-06 21:24:46 -0400
commit95a4a776cffe6dd56f5796e93c0cba0225ee49e4 (patch)
tree3e47c96c49639eec483819c46491815d249028c7 /src
parenta743be19bd3622071c22e9874c92024bc3f5367a (diff)
downloadjquery-95a4a776cffe6dd56f5796e93c0cba0225ee49e4.tar.gz
jquery-95a4a776cffe6dd56f5796e93c0cba0225ee49e4.zip
Simplify jQuery( html, props ), closes gh-765.
Diffstat (limited to 'src')
-rw-r--r--src/core.js9
1 files 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 {