mirror of
https://github.com/jquery/jquery.git
synced 2025-01-10 18:24:24 +00:00
This commit is contained in:
parent
372e04e78e
commit
b326225d90
@ -532,7 +532,9 @@ jQuery(function() {
|
|||||||
|
|
||||||
if ( jQuery.expr && jQuery.expr.filters ) {
|
if ( jQuery.expr && jQuery.expr.filters ) {
|
||||||
jQuery.expr.filters.hidden = function( elem ) {
|
jQuery.expr.filters.hidden = function( elem ) {
|
||||||
return elem.offsetWidth === 0 || elem.offsetHeight === 0;
|
// Support: Opera <= 12.12
|
||||||
|
// Opera reports offsetWidths and offsetHeights less than zero on some elements
|
||||||
|
return elem.offsetWidth <= 0 || elem.offsetHeight <= 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
jQuery.expr.filters.visible = function( elem ) {
|
jQuery.expr.filters.visible = function( elem ) {
|
||||||
|
@ -87,7 +87,7 @@
|
|||||||
<!-- Test HTML -->
|
<!-- Test HTML -->
|
||||||
<!-- this iframe is outside the #qunit-fixture so it won't reload constantly wasting time, but it means the tests must be "safe" and clean up after themselves -->
|
<!-- this iframe is outside the #qunit-fixture so it won't reload constantly wasting time, but it means the tests must be "safe" and clean up after themselves -->
|
||||||
<iframe id="loadediframe" name="loadediframe" style="display:none;" src="data/iframe.html"></iframe>
|
<iframe id="loadediframe" name="loadediframe" style="display:none;" src="data/iframe.html"></iframe>
|
||||||
<dl id="dl" style="position:absolute;top:-32767px;left:-32767px;width:1px">
|
<dl id="dl" style="position:absolute;top:-32767px;left:-32767px;width:1px;height:1px">
|
||||||
<div id="qunit-fixture">
|
<div id="qunit-fixture">
|
||||||
<p id="firstp">See <a id="simon1" href="http://simon.incutio.com/archive/2003/03/25/#getElementsBySelector" rel="bookmark">this blog entry</a> for more information.</p>
|
<p id="firstp">See <a id="simon1" href="http://simon.incutio.com/archive/2003/03/25/#getElementsBySelector" rel="bookmark">this blog entry</a> for more information.</p>
|
||||||
<p id="ap">
|
<p id="ap">
|
||||||
|
@ -857,7 +857,7 @@ test( "css opacity consistency across browsers (#12685)", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test( ":visible/:hidden selectors", function() {
|
test( ":visible/:hidden selectors", function() {
|
||||||
expect( 13 );
|
expect( 16 );
|
||||||
|
|
||||||
ok( jQuery("#nothiddendiv").is(":visible"), "Modifying CSS display: Assert element is visible" );
|
ok( jQuery("#nothiddendiv").is(":visible"), "Modifying CSS display: Assert element is visible" );
|
||||||
jQuery("#nothiddendiv").css({ display: "none" });
|
jQuery("#nothiddendiv").css({ display: "none" });
|
||||||
@ -884,6 +884,10 @@ test( ":visible/:hidden selectors", function() {
|
|||||||
equal(jQuery("#table td:visible").length, 1, "hidden cell is not perceived as visible (#4512). Works on table elements");
|
equal(jQuery("#table td:visible").length, 1, "hidden cell is not perceived as visible (#4512). Works on table elements");
|
||||||
$table.css("display", "none").html("<tr><td>cell</td><td>cell</td></tr>");
|
$table.css("display", "none").html("<tr><td>cell</td><td>cell</td></tr>");
|
||||||
equal(jQuery("#table td:visible").length, 0, "hidden cell children not perceived as visible (#4512)");
|
equal(jQuery("#table td:visible").length, 0, "hidden cell children not perceived as visible (#4512)");
|
||||||
|
|
||||||
|
t( "Is Visible", "#qunit-fixture div:visible:lt(2)", ["foo", "nothiddendiv"] );
|
||||||
|
t( "Is Not Hidden", "#qunit-fixture:hidden", [] );
|
||||||
|
t( "Is Hidden", "#form input:hidden", ["hidden1","hidden2"] );
|
||||||
});
|
});
|
||||||
|
|
||||||
asyncTest( "Clearing a Cloned Element's Style Shouldn't Clear the Original Element's Style (#8908)", 24, function() {
|
asyncTest( "Clearing a Cloned Element's Style Shouldn't Clear the Original Element's Style (#8908)", 24, function() {
|
||||||
|
@ -63,29 +63,6 @@ test("attributes - jQuery only", function() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
if ( jQuery.css ) {
|
|
||||||
test("pseudo - visibility", function() {
|
|
||||||
expect( 9 );
|
|
||||||
|
|
||||||
t( "Is Visible", "#qunit-fixture div:visible:lt(2)", ["foo", "nothiddendiv"] );
|
|
||||||
t( "Is Not Hidden", "#qunit-fixture:hidden", [] );
|
|
||||||
t( "Is Hidden", "#form input:hidden", ["hidden1","hidden2"] );
|
|
||||||
|
|
||||||
var $div = jQuery("<div/>").appendTo("body");
|
|
||||||
$div.css({ fontSize: 0, lineHeight: 0 });// IE also needs to set font-size and line-height to 0
|
|
||||||
$div.css( "width", 1 ).css( "height", 0 );
|
|
||||||
t( "Is Visible", "#nothiddendivchild:visible", ["nothiddendivchild"] );
|
|
||||||
t( "Is Not Visible", "#nothiddendivchild:hidden", [] );
|
|
||||||
$div.css( "width", 0 ).css( "height", 1 );
|
|
||||||
t( "Is Visible", "#nothiddendivchild:visible", ["nothiddendivchild"] );
|
|
||||||
t( "Is Not Visible", "#nothiddendivchild:hidden", [] );
|
|
||||||
$div.css( "width", 1 ).css( "height", 1 );
|
|
||||||
t( "Is Visible", "#nothiddendivchild:visible", ["nothiddendivchild"] );
|
|
||||||
t( "Is Not Visible", "#nothiddendivchild:hidden", [] );
|
|
||||||
$div.remove();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
test("disconnected nodes", function() {
|
test("disconnected nodes", function() {
|
||||||
expect( 4 );
|
expect( 4 );
|
||||||
var $opt = jQuery("<option></option>").attr("value", "whipit").appendTo("#qunit-fixture").detach();
|
var $opt = jQuery("<option></option>").attr("value", "whipit").appendTo("#qunit-fixture").detach();
|
||||||
|
Loading…
Reference in New Issue
Block a user