Closed Bug 288721 Opened 19 years ago Closed 19 years ago

[FIX]DOMNodeInserted MutationEvent does not fire for HTMLButtonElement

Categories

(Core :: DOM: Events, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla1.8beta4

People

(Reporter: lucky, Assigned: bzbarsky)

Details

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050317 Firefox/1.0.2
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050317 Firefox/1.0.2

I almost gave up on using this great EventListener because my first test was the
use of createElement('button') .. and append it to a DIVElement.  It would never
fire off the MutationEvent DOMNodeInserted...  Finally, went back and simplified
the code.. and found that pretty much any other elements created in the same way
WOULD fire it successfully?

Reproducible: Always

Steps to Reproduce:
1. document.addEventListener('DOMNodeInserted',yourhandler,true);
2. document.createElement('button');
3. [some element in your document].appendChild(newButton);
4. no DOMNodeInserted event called :(
5. replace the document.createElement() w/ any other element tagName, and success.
Actual Results:  
No DOMNodeInserted event is called from a HTMLButtonElement;
other elements fire that event properly.

Expected Results:  
fire DOMNodeInserted event when button element is appended to DOM
This should display the lack of MutationEvent on insertion of
HTMLButtonElement;
Hope it will help you kill this bug quickly.
Component: General → DOM: Events
Product: Firefox → Core
Version: unspecified → 1.0 Branch
Attached patch Silly patchSplinter Review
The mutation event dispatch passes a null prescontext, which makes sense... 
Note that if we ever fix dispatchEvent to work without a presentation we'll
need to fix this code to actually deal with a null prescontext, and the same
for input element code, etc...
Assignee: firefox → bzbarsky
Status: UNCONFIRMED → ASSIGNED
Attachment #183244 - Flags: superreview?(jst)
Attachment #183244 - Flags: review?(jst)
OS: Windows XP → All
Hardware: PC → All
Summary: DOMNodeInserted MutationEvent does not fire for HTMLButtonElement → [FIX]DOMNodeInserted MutationEvent does not fire for HTMLButtonElement
Version: 1.0 Branch → Trunk
Priority: -- → P2
Target Milestone: --- → mozilla1.8beta3
Comment on attachment 183244 [details] [diff] [review]
Silly patch

r+sr=jst
Attachment #183244 - Flags: superreview?(jst)
Attachment #183244 - Flags: superreview+
Attachment #183244 - Flags: review?(jst)
Attachment #183244 - Flags: review+
Comment on attachment 183244 [details] [diff] [review]
Silly patch

This is no-risk and fixes a silly bug where we don't fire mutation events for
one and only one type of HTML element...
Attachment #183244 - Flags: approval1.8b4?
Attachment #183244 - Flags: approval1.8b4? → approval1.8b4+
Fixed.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Target Milestone: mozilla1.8beta3 → mozilla1.8beta4
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: