Bug Tracker

Modify

Ticket #6818 (closed bug: invalid)

Opened 3 years ago

Last modified 14 months ago

Floating an image (<img>) kills its :visible selector

Reported by: halil Owned by:
Priority: Milestone: 1.4.3
Component: selector Version: 1.4.2
Keywords: visible, float, image, img Cc:
Blocking: Blocked by:

Description

If we give an image float property in CSS like

#our-img { float: left; }

then

$("#our-img:visible")

returns nothing.

See the attachment or you can view the ok one at

 http://demo.nette.com.tr/jquery-img-float/ok.html

and the erroneous one at

 http://demo.nette.com.tr/jquery-img-float/error.html

Attachments

jquery-img-float.rar Download (42.9 KB) - added by halil 3 years ago.
Offline files that are refenced in the text
jquery-img-float.zip Download (43.2 KB) - added by halil 3 years ago.
Offline files that are refenced in the text

Change History

Changed 3 years ago by halil

Offline files that are refenced in the text

Changed 3 years ago by halil

Offline files that are refenced in the text

comment:1 Changed 3 years ago by dmethvin

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

jQuery defines an element to be visible if the offsetWidth (css_width + padding_width + border_width) and offsetHeight is not 0.

If a container has only floated elements and no padding/border, it will have zero width/height.  http://www.quirksmode.org/css/clearing.html

Your selector is on the img container, $(".ubResUst a:visible") so it's running afoul of that rule. Try one of the approaches mentioned in that article, or perhaps add some border/padding to the link element.

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.