mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Reverted optimization to jQuery function, fixing broken jQuery-as-context, added test (fix for #804)
This commit is contained in:
parent
689739072f
commit
53e12752e0
5
src/jquery/coreTest.js
vendored
5
src/jquery/coreTest.js
vendored
@ -11,6 +11,11 @@ test("Basic requirements", function() {
|
||||
ok( $, "$()" );
|
||||
});
|
||||
|
||||
test("$()", function() {
|
||||
var main = $("#main");
|
||||
isSet( $("div p", main).get(), q("sndp", "en", "sap"), "Basic selector with jQuery object as context" );
|
||||
});
|
||||
|
||||
test("length", function() {
|
||||
ok( $("div").length == 2, "Get Number of Elements Found" );
|
||||
});
|
||||
|
12
src/jquery/jquery.js
vendored
12
src/jquery/jquery.js
vendored
@ -38,14 +38,14 @@ var jQuery = function(a,c) {
|
||||
|
||||
// Handle HTML strings
|
||||
if ( typeof a == "string" ) {
|
||||
// HANDLE: $(html) -> $(array)
|
||||
var m = /^[^<]*(<.+>)[^>]*$/.exec(a);
|
||||
if ( m )
|
||||
a = jQuery.clean( [ m[1] ] );
|
||||
|
||||
a = m ?
|
||||
// HANDLE: $(html) -> $(array)
|
||||
jQuery.clean( [ m[1] ] ) :
|
||||
|
||||
// HANDLE: $(expr)
|
||||
jQuery.find( a, c );
|
||||
// HANDLE: $(expr)
|
||||
else
|
||||
return new jQuery( c ).find( a );
|
||||
}
|
||||
|
||||
return this.setArray(
|
||||
|
Loading…
Reference in New Issue
Block a user