Skip to main content

Bug Tracker

Side navigation

#6047 closed bug (duplicate)

Opened February 07, 2010 10:20AM UTC

Closed February 07, 2010 02:07PM UTC

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

Attachments (0)
Change History (2)

Changed February 07, 2010 10:25AM UTC by tswaters comment:1

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

Changed February 07, 2010 02:07PM UTC by john comment:2

resolution: → duplicate
status: newclosed

Duplicate of #5670.