Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Simplify jQuery( html, props ), closes gh-765.
- Loading branch information
1 parent
a743be1
commit 95a4a776cffe6dd56f5796e93c0cba0225ee49e4
Showing
1 changed file
with
3 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -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 ); | ||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
scottgonzalez
Author
Member
|
||
|
||
// 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 { | ||
Did you mean to commit this? Doesn't appear to be related to the PR-summary/commit-msg.
I'd ask to add a unit test to verify that passing
{ ownerDocument: 1 }
ascontext
doesn't fail, but that looks a little silly. But if it is worth fixing, maybe a unit test is justified?