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" );
|
||||||
});
|
});
|
||||||
|
|
12
src/jquery/jquery.js
vendored
12
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" ) {
|
||||||
|
// HANDLE: $(html) -> $(array)
|
||||||
var m = /^[^<]*(<.+>)[^>]*$/.exec(a);
|
var m = /^[^<]*(<.+>)[^>]*$/.exec(a);
|
||||||
|
if ( m )
|
||||||
a = m ?
|
a = jQuery.clean( [ m[1] ] );
|
||||||
// HANDLE: $(html) -> $(array)
|
|
||||||
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