#7611 closed bug (invalid)
insertBefore fails when target is inline and previous non-empty sibling is inline and ends with a line break in Webkit
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | low | Milestone: | |
Component: | manipulation | Version: | 1.4.4 |
Keywords: | webkit insertBefore | Cc: | paul.irish |
Blocked by: | Blocking: |
Description
html: <span>abc<br></span> <a href="#">link</a>
JS: $("a").click(function(){
$("span").clone().insertBefore(this);
});
this works, though: $("span").clone().insertBefore(this); $("span").clone().insertAfter(this);
maybe it's a Chrome bug, not jQuery
Change History (11)
comment:1 Changed 12 years ago by
comment:2 follow-up: 9 Changed 12 years ago by
This is not a jQuery bug.
Criteria:
- The inserted element must be an inline element
- The element must be inserted using insertBefore
- The first previous non-empty, non-white-space-only, non-text-node sibling element of the target of the insert must:
- Be inline and
- End with a line break
- There must be at least one text node, empty node, or white-space only node between the sibling containing the line break and the target
If all these criteria are met, the inserted elements will not appear until another, different DOM manipulation occurs that does not match these criteria (even though the DOM manipulation occurs successfully).
comment:3 Changed 12 years ago by
Component: | unfiled → manipulation |
---|---|
Milestone: | 1.5 |
Priority: | undecided → low |
Summary: | insertBefore(this) bug in Chrome when content has <BR> → insertBefore fails when target is inline and previous non-empty sibling is inline and ends with a line break in Chrome |
comment:4 Changed 12 years ago by
Cc: | paul.irish added |
---|---|
Keywords: | chrome insertBefore added |
Milestone: | → 1.5 |
Status: | new → open |
This seems like a browser quirk we should try and smooth out, but first we'll report it to chrome and see if we can't get it pushed before we can fix it :D
comment:5 Changed 12 years ago by
Keywords: | webkit added; chrome removed |
---|
temp01 graciously pointed out that this is a webkit bug, not just a chrome-specific bug. He is correct.
comment:6 Changed 12 years ago by
Summary: | insertBefore fails when target is inline and previous non-empty sibling is inline and ends with a line break in Chrome → insertBefore fails when target is inline and previous non-empty sibling is inline and ends with a line break in Webkit |
---|
comment:7 Changed 12 years ago by
"temp01 graciously pointed out that this is a webkit bug, not just a chrome-specific bug. He is correct."
He really is a great guy.
comment:8 Changed 12 years ago by
He has reported the bug to WebKit: https://bugs.webkit.org/show_bug.cgi?id=50315
comment:9 Changed 12 years ago by
Replying to snover:
This is not a jQuery bug.
Criteria:
- The inserted element must be an inline element
- The element must be inserted using insertBefore
- The first previous non-empty, non-white-space-only, non-text-node sibling element of the target of the insert must:
- Be inline and
- End with a line break (on the same line)
- There must be at least one text node, empty node, or white-space only node between the sibling containing the line break and the target
If all these criteria are met, the inserted elements will not appear until another, different DOM manipulation occurs that does not match these criteria (even though the DOM manipulation occurs successfully).
comment:10 Changed 12 years ago by
Resolution: | → invalid |
---|---|
Status: | open → closed |
Here is an example that doesn't use jQuery but shows the problem.
http://jsfiddle.net/SZtbk/12/
I agree that this is a webkit bug, and that temp01 really is a great guy. If it were more critical we could work around it but at this point it doesn't seem like a very frequently encountered case.
I'm going to close this and you can track Webkit's progress via the link further up the ticket.
comment:11 Changed 12 years ago by
than you all, nice to see your attention! does not seem like webkid guys care, unfortunately
sorry, did not notice the link to jsFiddle
bug demo (open in Chrome): http://jsfiddle.net/SZtbk/1/
this works: http://jsfiddle.net/4Hukj/