Side navigation
#10880 closed bug (invalid)
Opened November 23, 2011 10:21PM UTC
Closed December 15, 2011 08:13AM UTC
Last modified March 14, 2012 11:28AM UTC
$(element).is(':visible') should return true if either offsetHeight:0 or offsetWidth:0?
Reported by: | ppan235@gmail.com | Owned by: | ppan235@gmail.com |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.7 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Hi there,
At present, $(element).is(':visible') returns true _only_ if element.offsetHeight and offsetWidth are _both_ 0px.
Surely $(element).is(':visible') should be true if _either_ element.offsetHeight or offsetWidth is 0px? Isn't 0px * anything-px = 0px-squared, so element cannot be visible?
Example html follows: please check the console. Tested in Mac FF8.01 and Safari 5.1.1.
Thanks.
Pete.
Example:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.js"></script> </head> <body> <div id="zero-height-nonzero-width"> <div id="invisible" style='display:none;'>I am invisible</div> </div> </div> <script type="text/javascript"> $(document).ready(function() { function dumpElement(elementId) { var $element = $(elementId); var element = $element[0]; console.log('\\nElement id: ' + $element.attr('id')); console.log('Visible?: ' + $element.is(':visible')); console.log('offsetWidth: ' + element.offsetWidth); console.log('offsetHeight: ' + element.offsetHeight); } dumpElement('#zero-height-nonzero-width'); dumpElement('#invisible'); }); </script> </body> </html>
Attachments (0)
Change History (3)
Changed November 24, 2011 08:52PM UTC by comment:1
owner: | → ppan235@gmail.com |
---|---|
status: | new → pending |
Changed November 30, 2011 08:26PM UTC by comment:2
Sure. I'll try to get the other test cases done next week.
Pete
Changed December 15, 2011 08:13AM UTC by comment:3
resolution: | → invalid |
---|---|
status: | pending → closed |
Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!
Sounds great. Can you test with IE6/7/8 on elements including table rows and columns that are empty? That is what I believe resulted in the current code. Once you have those test cases we can consider a change.