Bug Tracker

Modify

Ticket #5567 (closed bug: duplicate)

Opened 3 years ago

Last modified 3 years ago

Bug about ":visible" and ":hidden"

Reported by: txdkiller Owned by: john
Priority: critical Milestone: 1.4
Component: selector Version: 1.3.2
Keywords: hidden visible Cc:
Blocking: Blocked by:

Description

MyEmail: 775356txdd@…

Bug: In my option,source code below: "

Sizzle.selectors.filters.hidden = function(elem){

return elem.offsetWidth === 0
elem.offsetHeight === 0;

};

Sizzle.selectors.filters.visible = function(elem){

return elem.offsetWidth > 0
elem.offsetHeight > 0;

}; " doesn't seems correctly; if elem.offsetWidth equals to "1421" and elem.offsetHeight equals to "0" ,for example:

<div id="test"><input type="hidden" value="hello world!"/></div>,in IE,FireFox,Opeara,offsetWidth is not equal to "0" but offsetHeight is equal to "0" ,so, div with id "test" is hidden and visible,which is funny...

So , maybe This is better when change these code to: "

Sizzle.selectors.filters.hidden = function(elem){

return elem.offsetWidth === 0
elem.offsetHeight === 0;

};

Sizzle.selectors.filters.visible = function(elem){

return elem.offsetWidth > 0 && elem.offsetHeight > 0;

}; " Beg your Email :775356txdd@… Thank you!~

Change History

comment:1 in reply to: ↑ description Changed 3 years ago by txdkiller

Replying to txdkiller:

MyEmail: 775356txdd@…

Bug: In my option,source code below: "

Sizzle.selectors.filters.hidden = function(elem){

return elem.offsetWidth === 0 or elem.offsetHeight === 0;

};

Sizzle.selectors.filters.visible = function(elem){

return elem.offsetWidth > 0 or elem.offsetHeight > 0;

}; " doesn't seems correctly; if elem.offsetWidth equals to "1421" and elem.offsetHeight equals to "0" ,for example:

<div id="test"><input type="hidden" value="hello world!"/></div>,in IE,FireFox,Opeara,offsetWidth is not equal to "0" but offsetHeight is equal to "0" ,so, div with id "test" is hidden and visible,which is funny...

So , maybe This is better when change these code to: "

Sizzle.selectors.filters.hidden = function(elem){

return elem.offsetWidth === 0 or elem.offsetHeight === 0;

};

Sizzle.selectors.filters.visible = function(elem){

return elem.offsetWidth > 0 and elem.offsetHeight > 0;

}; " Beg your Email :775356txdd@… Thank you!~

comment:2 Changed 3 years ago by snover

  • Status changed from new to closed
  • Resolution set to duplicate

comment:3 Changed 3 years ago by snover

Duplicate of #4512.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.