Skip to main content

Bug Tracker

Side navigation

#5567 closed bug (duplicate)

Opened November 30, 2009 09:05AM UTC

Closed November 19, 2010 10:10AM UTC

Last modified November 19, 2010 10:10AM UTC

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:
Blocked by: Blocking:
Description

MyEmail: 775356txdd@sina.com

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@sina.com

Thank you!~

Attachments (0)
Change History (3)

Changed November 30, 2009 09:07AM UTC by txdkiller comment:1

Replying to [ticket:5567 txdkiller]:

MyEmail: 775356txdd@sina.com 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@sina.com Thank you!~

Changed November 19, 2010 10:10AM UTC by snover comment:2

resolution: → duplicate
status: newclosed

Changed November 19, 2010 10:10AM UTC by snover comment:3

Duplicate of #4512.