mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
UPDATE SIZZLE: completed rewrite for better things!
Remove reverse in traversing for comma selectors. Sizzle's handling of commas is now more consistent.
This commit is contained in:
parent
f71a6ec6cf
commit
b418fa1f09
@ -1 +1 @@
|
|||||||
Subproject commit 2ae520aa9b7fdc18798df25948191dae69e33ace
|
Subproject commit e89d06c4134ec439e52382acd0e569e97fed7ebc
|
@ -1,7 +1,5 @@
|
|||||||
var runtil = /Until$/,
|
var runtil = /Until$/,
|
||||||
rparentsprev = /^(?:parents|prevUntil|prevAll)/,
|
rparentsprev = /^(?:parents|prev(?:Until|All))/,
|
||||||
// Note: This RegExp should be improved, or likely pulled from Sizzle
|
|
||||||
rmultiselector = /,/,
|
|
||||||
isSimple = /^.[^:#\[\.,]*$/,
|
isSimple = /^.[^:#\[\.,]*$/,
|
||||||
POS = jQuery.expr.match.globalPOS,
|
POS = jQuery.expr.match.globalPOS,
|
||||||
// methods guaranteed to produce a unique set when starting from a unique set
|
// methods guaranteed to produce a unique set when starting from a unique set
|
||||||
@ -217,7 +215,7 @@ jQuery.each({
|
|||||||
|
|
||||||
ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
|
ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
|
||||||
|
|
||||||
if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
|
if ( this.length > 1 && rparentsprev.test( name ) ) {
|
||||||
ret = ret.reverse();
|
ret = ret.reverse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -547,14 +547,17 @@ test( "show() resolves correct default display, detached nodes (#10006)", functi
|
|||||||
div = jQuery("<div>");
|
div = jQuery("<div>");
|
||||||
div.show().appendTo("#qunit-fixture");
|
div.show().appendTo("#qunit-fixture");
|
||||||
ok( !!div.get( 0 ).style.display, "Make sure not hidden div has a inline style." );
|
ok( !!div.get( 0 ).style.display, "Make sure not hidden div has a inline style." );
|
||||||
|
div.remove();
|
||||||
|
|
||||||
div = jQuery( document.createElement("div") );
|
div = jQuery( document.createElement("div") );
|
||||||
div.show().appendTo("#qunit-fixture");
|
div.show().appendTo("#qunit-fixture");
|
||||||
equal( div.css("display"), "block", "Make sure a pre-created element has default display." );
|
equal( div.css("display"), "block", "Make sure a pre-created element has default display." );
|
||||||
|
div.remove();
|
||||||
|
|
||||||
div = jQuery("<div style='display: inline'/>");
|
div = jQuery("<div style='display: inline'/>");
|
||||||
div.show().appendTo("#qunit-fixture");
|
div.show().appendTo("#qunit-fixture");
|
||||||
equal( div.css("display"), "inline", "Make sure that element has same display when it was created." );
|
equal( div.css("display"), "inline", "Make sure that element has same display when it was created." );
|
||||||
|
div.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("toggle()", function() {
|
test("toggle()", function() {
|
||||||
|
18
test/unit/effects.js
vendored
18
test/unit/effects.js
vendored
@ -95,6 +95,8 @@ test("show()", function() {
|
|||||||
equal( elem.css("display"), expected, "Show using correct display type for " + selector );
|
equal( elem.css("display"), expected, "Show using correct display type for " + selector );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
jQuery("#show-tests").remove();
|
||||||
|
|
||||||
// Make sure that showing or hiding a text node doesn't cause an error
|
// Make sure that showing or hiding a text node doesn't cause an error
|
||||||
jQuery("<div>test</div> text <span>test</span>").show().remove();
|
jQuery("<div>test</div> text <span>test</span>").show().remove();
|
||||||
jQuery("<div>test</div> text <span>test</span>").hide().remove();
|
jQuery("<div>test</div> text <span>test</span>").hide().remove();
|
||||||
@ -137,6 +139,8 @@ test("show(Number) - other displays", function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
jQuery("#show-tests").remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -726,6 +730,7 @@ jQuery.checkOverflowDisplay = function(){
|
|||||||
equal(o, "visible", "Overflow should be visible: " + o);
|
equal(o, "visible", "Overflow should be visible: " + o);
|
||||||
equal(jQuery.css( this, "display" ), "inline", "Display shouldn't be tampered with.");
|
equal(jQuery.css( this, "display" ), "inline", "Display shouldn't be tampered with.");
|
||||||
|
|
||||||
|
jQuery(this).remove();
|
||||||
start();
|
start();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -779,6 +784,8 @@ test( "jQuery.fx.prototype.cur() - <1.8 Back Compat", 7, function() {
|
|||||||
-11000,
|
-11000,
|
||||||
"support negative values < -10000 (bug #7193)"
|
"support negative values < -10000 (bug #7193)"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
jQuery( div ).remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("JS Overflow and Display", function() {
|
test("JS Overflow and Display", function() {
|
||||||
@ -1352,10 +1359,10 @@ test("animate will scale margin properties individually", function() {
|
|||||||
|
|
||||||
// clean up for next test
|
// clean up for next test
|
||||||
foo.css({
|
foo.css({
|
||||||
marginLeft: '',
|
marginLeft: "",
|
||||||
marginRight: '',
|
marginRight: "",
|
||||||
marginTop: '',
|
marginTop: "",
|
||||||
marginBottom: ''
|
marginBottom: ""
|
||||||
});
|
});
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
@ -1365,6 +1372,7 @@ test("Do not append px to 'fill-opacity' #9548", 1, function() {
|
|||||||
|
|
||||||
$div.css("fill-opacity", 0).animate({ "fill-opacity": 1.0 }, 0, function () {
|
$div.css("fill-opacity", 0).animate({ "fill-opacity": 1.0 }, 0, function () {
|
||||||
equal( jQuery(this).css("fill-opacity"), 1, "Do not append px to 'fill-opacity'");
|
equal( jQuery(this).css("fill-opacity"), 1, "Do not append px to 'fill-opacity'");
|
||||||
|
$div.remove();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1532,6 +1540,7 @@ asyncTest( "hide called on element within hidden parent should set display to no
|
|||||||
strictEqual( elems.get( 1 ).style.display, "none", "hide( 0 ) called on element within hidden parent should set display to none" );
|
strictEqual( elems.get( 1 ).style.display, "none", "hide( 0 ) called on element within hidden parent should set display to none" );
|
||||||
strictEqual( elems.get( 2 ).style.display, "none", "hide( 1 ) called on element within hidden parent should set display to none" );
|
strictEqual( elems.get( 2 ).style.display, "none", "hide( 1 ) called on element within hidden parent should set display to none" );
|
||||||
|
|
||||||
|
elems.remove();
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -1661,6 +1670,7 @@ asyncTest( "animate does not change start value for non-px animation (#7109)", 1
|
|||||||
var ratio = computed[ 0 ] / actual;
|
var ratio = computed[ 0 ] / actual;
|
||||||
ok( ratio > 0.9 && ratio < 1.1 , "Starting width was close enough" );
|
ok( ratio > 0.9 && ratio < 1.1 , "Starting width was close enough" );
|
||||||
next();
|
next();
|
||||||
|
parent.remove();
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -38,7 +38,7 @@ test("Handler changes and .trigger() order", function() {
|
|||||||
expect(1);
|
expect(1);
|
||||||
|
|
||||||
var markup = jQuery(
|
var markup = jQuery(
|
||||||
'<div><div><p><span><b class="a">b</b></span></p></div></div>'
|
"<div><div><p><span><b class=\"a\">b</b></span></p></div></div>"
|
||||||
),
|
),
|
||||||
path = "";
|
path = "";
|
||||||
|
|
||||||
@ -1433,7 +1433,7 @@ test("jQuery.Event( type, props )", function() {
|
|||||||
test("jQuery.Event.currentTarget", function(){
|
test("jQuery.Event.currentTarget", function(){
|
||||||
expect(2);
|
expect(2);
|
||||||
|
|
||||||
jQuery('<div><p><button>shiny</button></p></div>')
|
jQuery("<div><p><button>shiny</button></p></div>")
|
||||||
.on( "click", "p", function( e ){
|
.on( "click", "p", function( e ){
|
||||||
equal( e.currentTarget, this, "Check delegated currentTarget on event" );
|
equal( e.currentTarget, this, "Check delegated currentTarget on event" );
|
||||||
})
|
})
|
||||||
@ -2359,7 +2359,7 @@ test( "delegated event with delegateTarget-relative selector (#)", function() {
|
|||||||
test("stopPropagation() stops directly-bound events on delegated target", function() {
|
test("stopPropagation() stops directly-bound events on delegated target", function() {
|
||||||
expect(1);
|
expect(1);
|
||||||
|
|
||||||
var markup = jQuery( '<div><p><a href="#">target</a></p></div>' );
|
var markup = jQuery("<div><p><a href=\"#\">target</a></p></div>");
|
||||||
markup
|
markup
|
||||||
.on( "click", function() {
|
.on( "click", function() {
|
||||||
ok( false, "directly-bound event on delegate target was called" );
|
ok( false, "directly-bound event on delegate target was called" );
|
||||||
@ -2540,7 +2540,7 @@ test("Non DOM element events", function() {
|
|||||||
test("inline handler returning false stops default", function() {
|
test("inline handler returning false stops default", function() {
|
||||||
expect(1);
|
expect(1);
|
||||||
|
|
||||||
var markup = jQuery('<div><a href="#" onclick="return false">x</a></div>');
|
var markup = jQuery("<div><a href=\"#\" onclick=\"return false\">x</a></div>");
|
||||||
markup.click(function(e) {
|
markup.click(function(e) {
|
||||||
ok( e.isDefaultPrevented(), "inline handler prevented default");
|
ok( e.isDefaultPrevented(), "inline handler prevented default");
|
||||||
return false;
|
return false;
|
||||||
@ -2613,7 +2613,7 @@ test(".on and .off", function() {
|
|||||||
expect(9);
|
expect(9);
|
||||||
var counter, mixfn;
|
var counter, mixfn;
|
||||||
|
|
||||||
jQuery( '<div id="onandoff"><p>on<b>and</b>off</p><div>worked<em>or</em>borked?</div></div>' ).appendTo( 'body' );
|
var $onandoff = jQuery("<div id=\"onandoff\"><p>on<b>and</b>off</p><div>worked<em>or</em>borked?</div></div>").appendTo("body");
|
||||||
|
|
||||||
// Simple case
|
// Simple case
|
||||||
jQuery( "#onandoff" )
|
jQuery( "#onandoff" )
|
||||||
@ -2705,7 +2705,7 @@ test(".on and .off", function() {
|
|||||||
var data = jQuery.data[ jQuery( "#onandoff" )[0].expando ] || {};
|
var data = jQuery.data[ jQuery( "#onandoff" )[0].expando ] || {};
|
||||||
equal( data.events, undefined, "no events left" );
|
equal( data.events, undefined, "no events left" );
|
||||||
|
|
||||||
jQuery("#onandoff").remove();
|
$onandoff.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("special bind/delegate name mapping", function() {
|
test("special bind/delegate name mapping", function() {
|
||||||
@ -2723,7 +2723,7 @@ test("special bind/delegate name mapping", function() {
|
|||||||
ok( true, "event " + event.type + " triggered" );
|
ok( true, "event " + event.type + " triggered" );
|
||||||
};
|
};
|
||||||
|
|
||||||
jQuery( '<div><button id="mammy">Are We Not Men?</button></div>' )
|
jQuery("<div><button id=\"mammy\">Are We Not Men?</button></div>")
|
||||||
.on( "slap", "button", jQuery.noop )
|
.on( "slap", "button", jQuery.noop )
|
||||||
.on( "swing", "button", comeback )
|
.on( "swing", "button", comeback )
|
||||||
.find( "button" )
|
.find( "button" )
|
||||||
|
@ -37,6 +37,8 @@ test("text()", function() {
|
|||||||
var $newLineTest = jQuery("<div>test<br/>testy</div>").appendTo("#moretests");
|
var $newLineTest = jQuery("<div>test<br/>testy</div>").appendTo("#moretests");
|
||||||
$newLineTest.find("br").replaceWith("\n");
|
$newLineTest.find("br").replaceWith("\n");
|
||||||
equal( $newLineTest.text(), "test\ntesty", "text() does not remove new lines (#11153)" );
|
equal( $newLineTest.text(), "test\ntesty", "text() does not remove new lines (#11153)" );
|
||||||
|
|
||||||
|
$newLineTest.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("text(undefined)", function() {
|
test("text(undefined)", function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user