Bug Tracker

Opened 15 years ago

Closed 15 years ago

#2190 closed bug (invalid)

width() and height() after form is appended to inline element

Reported by: tuupola Owned by:
Priority: major Milestone: 1.2.3
Component: core Version: 1.2.1
Keywords: width, height, safari, firefox, form Cc:
Blocked by: Blocking:



If inline element is appended a form element and later this form element is removed, all subsequent calls to $(elem).width() and $(elem).height() return 0.

Block level elements seem to be unaffected. See example page of the bug.

Atleast Safari 3.0.4 and FireFox are affected.


Problem seems to be fixed by changing the code starting at line 800 from:

if ( jQuery(elem).is(":visible") ) {
} else {
  jQuery.swap( elem, props, getWH );			    


if ( !jQuery(elem).is(":visible") ) {
} else {
  jQuery.swap( elem, props, getWH );			    

Although this for sure will break lots of other things. Should be a good starting point for debugging. I do not personally have understanding what that code does.

Change History (2)

comment:1 Changed 15 years ago by davidserduke


This same problem appears to have been in 1.2.1 so this isn't new. I think it is caused by invalid markup since form is a block level element and is being placed in an inline element which is confusing the browser.

For more detail see this thread:


comment:2 Changed 15 years ago by brandon

Resolution: invalid
Status: newclosed

As David already mentioned, this is invalid HTML. An display: inline element cannot be the parent of a display: block parent.

Note: See TracTickets for help on using tickets.