Opened 14 years ago
Closed 14 years ago
#6047 closed bug (duplicate)
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.
oh damn, that title should read "insertAfter" ... and appending will do it too.