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( $, "$()" );
|
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() {
|
test("length", function() {
|
||||||
ok( $("div").length == 2, "Get Number of Elements Found" );
|
ok( $("div").length == 2, "Get Number of Elements Found" );
|
||||||
});
|
});
|
||||||
|
|
10
src/jquery/jquery.js
vendored
10
src/jquery/jquery.js
vendored
|
@ -38,14 +38,14 @@ var jQuery = function(a,c) {
|
||||||
|
|
||||||
// Handle HTML strings
|
// Handle HTML strings
|
||||||
if ( typeof a == "string" ) {
|
if ( typeof a == "string" ) {
|
||||||
var m = /^[^<]*(<.+>)[^>]*$/.exec(a);
|
|
||||||
|
|
||||||
a = m ?
|
|
||||||
// HANDLE: $(html) -> $(array)
|
// HANDLE: $(html) -> $(array)
|
||||||
jQuery.clean( [ m[1] ] ) :
|
var m = /^[^<]*(<.+>)[^>]*$/.exec(a);
|
||||||
|
if ( m )
|
||||||
|
a = jQuery.clean( [ m[1] ] );
|
||||||
|
|
||||||
// HANDLE: $(expr)
|
// HANDLE: $(expr)
|
||||||
jQuery.find( a, c );
|
else
|
||||||
|
return new jQuery( c ).find( a );
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.setArray(
|
return this.setArray(
|
||||||
|
|
Loading…
Reference in a new issue