Closed
Bug 27211
Opened 25 years ago
Closed 24 years ago
{ib} removeChild() for a SPAN element only removes first element in SPAN
Categories
(Core :: Layout, defect, P3)
Tracking
()
RESOLVED
FIXED
M17
People
(Reporter: david.halls, Assigned: waterson)
References
Details
Attachments
(1 file)
626 bytes,
text/html
|
Details |
In the following example, a SPAN element (ID=foo) is removed from the body
of the document. However, only the first child actually appears to be removed.
Note though that when the SPAN element in re-appended to the body again
(below the HR), both children of the SPAN get appended with it.
Anyway, here's a canonical example:
---
<HTML>
<HEAD>
<SCRIPT>
function doit()
{
var span = document.getElementById("foo")
document.body.removeChild(span)
document.body.appendChild(span)
}
</SCRIPT>
</HEAD>
<BODY onload='doit()'>
<SPAN ID=foo>
one
<P>
two
</P>
</SPAN>
<HR>
</BODY>
</HTML>
Reporter | ||
Updated•25 years ago
|
OS: other → Windows NT
Summary: removeChild() for a SPAN element only removes first element in SPAN → removeChild() for a SPAN element only removes first element in SPAN
Comment 1•25 years ago
|
||
The problem is that the parser is modifying to the content model since the HTML
in the example above is invalide w.r.t. the HTML 4.0 DTD. Specifically, it's
moving the block element (the P) out of the inline element (the SPAN).
The debate on whether to do this type of fixup is still open. Passing this along
to the parser guys in case we don't have a bug marker for this discussion.
Assignee: vidur → harishd
Here is the content model: ** NOTE ** P is inside SPAN.
docshell=01510040
html@02DAA06C refcount=4<
head@02DABFBC refcount=2<
Text@01FFDF00 refcount=2<\n>
script@01FFE85C refcount=2<
Text@01FF9070 refcount=2<\r\nfunction doit()\r\n{\r\n var span =
document.getElementById("foo")\r\n document.body.removeChild(span)\r\n
document.body.appendChild(span)\r\n}\r\n>
>
>
Text@01FF92A0 refcount=3<\n>
body@01FF91EC onload=doit() refcount=5<
Text@0264E710 refcount=3<\n>
Text@0264AD80 refcount=3<\n>
hr@0264AD1C refcount=3<>
Text@0264AC00 refcount=3<\n>
span@0264A62C id=foo refcount=8<
Text@0264DD40 refcount=3<\none\n>
p@0264DC9C refcount=4<
Text@0264DBD0 refcount=4<\ntwo\n>
>
Text@0264AE40 refcount=4<\n>
>
>
>
Back to vidur.
Assignee: harishd → vidur
Comment 3•25 years ago
|
||
I checked this out in viewer and tried various things, first of all I simplified
the testcase by removing the appendChild call, IOW the only thing that should be
displayed is the HR, but I see both "two" and the HR.
Then the content model seems correct to me, both before and after the script has
executed (according to "Dump Content" in viewer). I loaded the testcase without
calling the script and had a look at the frames that are created, form what I
understand we get 3 line frames for the content in the span, one for the text
'one', one for the <P> tag and one for the newline after </P>. If I let the
script execute then the frame hierarchy is the same as above exept that only the
first line frame for the span content is missing when all of them should have
been removed!
I think this is related to the "Possible sollution for 28553, need some
feedback" discussions in n.p.m.layout, and this might even be a dup of 28553.
Handing over to Layout.
Assignee: vidur → troy
Component: DOM Level 1 → Layout
QA Contact: gerardok → petersen
Changed QA contact back as the bug still requires DOM removechild() method to
reproduce.
QA Contact: petersen → gerardok
This is another case of fallout from kipp's block-within-inline fixup code. It
should be straightforward to fix. When we find the primary frame for the
content to remove, we just need to search its siblings to see if they are mapped
to the same content, and if so delete them as well.
Status: NEW → ASSIGNED
Target Milestone: M17
Reporter | ||
Comment 7•25 years ago
|
||
Similar things happen when setting the style.display of the SPAN to "none"
and then "inline" again. The example below displays strange
results (I'd expect it to toggle display of the SPAN on and off).
Is this a related issue?
<HTML>
<HEAD>
<SCRIPT>
displayed = true
function doit()
{
document.getElementById("foo").style.display = displayed ? "none" : "inline"
displayed = !displayed
}
</SCRIPT>
</HEAD>
<BODY>
<BUTTON onclick='doit()'>Click</BUTTON>
<P>
<SPAN ID=foo>
one
<P>
two
</P>
</SPAN>
</P>
</BODY>
</HTML>
assigned to Nisheeth, this is another inline-contains-block issue
in my opinion, we should fix all of these {ib} bugs for beta2. Nisheeth, do you
have a tracking bug so we don't have to nominate them all separately?
Assignee: buster → nisheeth
Status: ASSIGNED → NEW
Keywords: nsbeta2
Summary: removeChild() for a SPAN element only removes first element in SPAN → {ib} removeChild() for a SPAN element only removes first element in SPAN
Comment 9•25 years ago
|
||
Removing nsbeta2 keyword from this bug. I'm going to hang all the inline block
bugs off of a tracking bug and mark that nsbeta2, like buster suggested.
For now, bug 36401, another inline block bug is marked nsbeta2...
Keywords: nsbeta2
Assignee | ||
Updated•24 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 12•24 years ago
|
||
Assignee | ||
Comment 13•24 years ago
|
||
The fix for bug 39211 will fix this bug as well.
Assignee | ||
Comment 14•24 years ago
|
||
fixed with checking for 39211.
Assignee | ||
Comment 15•24 years ago
|
||
oops, marking fixed.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•