Closed
Bug 368133
Opened 19 years ago
Closed 19 years ago
DOMCharacterDataModified do not fire as expected.
Categories
(Core :: DOM: Events, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: clc4tts, Unassigned)
Details
Attachments
(1 file)
|
1.97 KB,
application/xhtml+xml
|
Details |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1
According to http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-eventgroupings-mutationevents
The DOMCharacterDataModified event is fired "after CharacterData within a node has been modified but the node itself has not been inserted or deleted."
However, in Firefox, if JavaScript is used to modify the textContent of an element (without removing or inserting nodes), the DOMCharacterDataModified event is not fired. Instead, Firefox treats it as a DOMNodeRemoved event, followed by a DOMNodeInserted event.
In addition, DOMSubtreeModified is not fired at all. It should be fired since DOMSubtreeModified "is a general event for notification of all changes to the document." This confirms: https://bugzilla.mozilla.org/show_bug.cgi?id=288392
Reproducible: Always
Steps to Reproduce:
1. Monitor DOM Mutation events
2. Change the textContent of an existing element
Actual Results:
DOMCharacterDataModified and DOMSubtreeModified events are fired.
Expected Results:
A DOMNodeRemoved event and then a DOMNodeInserted event are fired.
DOMCharacterDataModified is not fired.
DOMSubtreeModified is not fired.
window.document is watching for the following events:
DOMSubtreeModified
DOMNodeInserted
DOMNodeRemoved
DOMNodeRemovedFromDocument
DOMNodeInsertedIntoDocument
DOMAttrModified
DOMCharacterDataModified
When the "Change text." button is pressed, the textContent of testElement is changed from "Old text." to "New text." The only events that are fired are DOMNodeRemoved followed by DOMNodeInserted. The expected events of DOMCharacterDataModified and DOMSubtreeModified are not fired.
Updated•19 years ago
|
Assignee: nobody → events
Component: General → DOM: Events
Product: Firefox → Core
QA Contact: general → ian
Version: unspecified → 1.8 Branch
Comment 2•19 years ago
|
||
This is invalid.
See http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#Node3-textContent
"On setting, any possible children this node may have are removed and, if the new string is not empty or null, replaced by a single Text node..."
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → INVALID
Comment 3•19 years ago
|
||
Smaug, so when is DOMCharacterDataModified intended to be fired? We never fire it.
Comment 4•19 years ago
|
||
javascript:var t=document.createTextNode("foo");t.addEventListener("DOMCharacterDataModified",function(e) {alert(e.type);}, false); t.data = "foobar";
"Fired after CharacterData within a node has been modified but the node itself has not been inserted or deleted. This event is also triggered by modifications to PI elements. The target of this event is the CharacterData node."
You need to log in
before you can comment on or make changes to this bug.
Description
•