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)
        Core
          
        
        
      
        
    
        Layout: Form Controls
          
        
        
      
        
    Tracking
()
        RESOLVED
        FIXED
        
    
  
        
            mozilla1.6beta
        
    
  
People
(Reporter: sicking, Assigned: bzbarsky)
References
Details
Attachments
(2 files)
| 815 bytes,
          text/html         | Details | |
| 9.63 KB,
          patch         | dbaron
:
              
              review+ dbaron
:
              
              superreview+ | Details | Diff | Splinter Review | 
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.
| Reporter | ||
| Comment 1•21 years ago
           | ||
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.
|   | Assignee | |
| Updated•21 years ago
           | 
        Attachment #135759 -
        Attachment is patch: false
        Attachment #135759 -
        Attachment mime type: text/plain → text/html
| Reporter | ||
| Comment 3•21 years ago
           | ||
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
|   | Assignee | |
| Comment 4•21 years ago
           | ||
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.
|   | Assignee | |
| Comment 5•21 years ago
           | ||
This fixes the testcase and all the testcases in bug 98239; no more asserts.
|   | Assignee | |
| Comment 6•21 years ago
           | ||
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 | |
| Comment 7•21 years ago
           | ||
.
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+
|   | Assignee | |
| Comment 8•21 years ago
           | ||
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.
        
Description
•