Bug Tracker

Ticket #6047 (closed bug: duplicate)

Opened 5 years ago

Last modified 5 years ago

using insertBefore with inline element breaks hidden in IE8

Reported by: tswaters Owned by:
Priority: Milestone: 1.4.2
Component: selector Version: 1.4.1
Keywords: Cc:
Blocking: Blocked by:

Description

Not sure if this should be under 'selector', 'manipulating' or 'offset' ... or even under UI bugs.

I found this while trying to call "toggle" in IE8 (possibly other versions, have not tested). For some reason, it didn't work.

Checking for strangeness, I found that it related to inserting an inline element directly after the element. This causes ':hidden' to return false, and thus toggle always called 'hide()'

Here's an example:

<ul id="test"> <li>item 1<ul> <li>item 1.1</li> <li>item 1.2</li> </ul></li> <li>item 2<ul> <li>item 2.1</li> <li>item 2.2</li> </ul></li> </ul> <script> $("#test")

.find("ul")

.hide()

.end() .find("li")

.click(function(){

alert( "the child-ul is hidden?\n" +

$(this).find("ul").is(":hidden"));

}) .append("<div style='display:inline'>...</div>")

</script>

This should hide the UL, and add an inline element directly after it (before the end of the LI).

Even though the UL is clearly invisible, IE returns false when querying ":hidden".

Not appending the inline element (or making it block) makes it work again.

Change History

comment:1 Changed 5 years ago by tswaters

oh damn, that title should read "insertAfter" ... and appending will do it too.

comment:2 Changed 5 years ago by john

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

Duplicate of #5670.

Note: See TracTickets for help on using tickets.