Closed Bug 226016 Opened 21 years ago Closed 21 years ago

[FIX]Removing all children from a <button> and inserting new ones doesn't work

Categories

(Core :: Layout: Form Controls, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla1.6beta

People

(Reporter: sicking, Assigned: bzbarsky)

References

Details

Attachments

(2 files)

For the following markup: <button id="theButton">TextHere</button> calling button.removeChild(button.firstChild); button.appendChild(document.createTextNode("TextHere"); puts the button in a weird state. Subsequent calls to either removeChild or appendChild will trigger a "not a container" assertion in layout and the changes will not be reflected in the rendering of the document. Reframing the button will put it back in a fully functional state again. Until the same operation is performed again (i.e. removing all children and putting a new one in). This happened on a customer webpage where the customer set .innerHTML twice on the button (setting .innerHTML removes all children before inserting any new ones) Testcase comming up.
Attached file testcase
An intersting sidenote is that the 'reframe' button doesn't work in optimized builds. All it does is setting .style.display="none"; .style.display=""; on a parent of the button.
Attachment #135759 - Attachment is patch: false
Attachment #135759 - Attachment mime type: text/plain → text/html
I bet this is the same thing as bug 98239 at heart.
Blocks: 98239
Yeah, that's definitly the same, feel free to dup if you want (though this one has a higher signal/noice ratio). I think what happens is that we have some sort of inner-frame for buttons that acts as the block-frame, which only gets created during the initial reflow and not when a node is inserted into an empty button
Exactly. Well, sorta. I have a patch that makes things "work", but triggers a different set of asserts... there's also some style context wackiness here that I need to look into.
This fixes the testcase and all the testcases in bug 98239; no more asserts.
Comment on attachment 135769 [details] [diff] [review] Wackiness and asserts were all the same deal David, would you do the honors?
Attachment #135769 - Flags: superreview?(dbaron)
Attachment #135769 - Flags: review?(dbaron)
.
Assignee: form → bz-vacation
OS: Windows 2000 → All
Priority: -- → P2
Hardware: PC → All
Summary: Removing all children from a <button> and inserting new ones doesn't work → [FIX]Removing all children from a <button> and inserting new ones doesn't work
Target Milestone: --- → mozilla1.6beta
Attachment #135769 - Flags: superreview?(dbaron)
Attachment #135769 - Flags: superreview+
Attachment #135769 - Flags: review?(dbaron)
Attachment #135769 - Flags: review+
Fixed.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: