Closed Bug 232009 Opened 21 years ago Closed 3 years ago

Mutation events should fire after an attribute is removed

Categories

(Core :: DOM: Core & HTML, defect, P5)

defect

Tracking

()

RESOLVED INACTIVE

People

(Reporter: sicking, Unassigned)

References

Details

Currently we fire a mutation-event before removing an attribute. This is wrong
according to the DOM-spec, it says to fire all DOMAttrModified events after the
attribute is modified.

This should be easy to fix, the only thing to keep in mind is that we need to
get the attribute-node before removing the attribute, otherwise it won't be there.
semi-related: We need some sort of mechanism for telling attribute-nodes that
they are going away. Currently the attribute-node can be compleatly unaware that
it no longer is an attribute on the element.

One way to fix this is to every time we need to do something where that matters
call mContent->HasAttr(mNodeInfo...). The problem is that that won't catch the
case of the attribute being removed and then reinserted. However i'm not sure if
that matters.
Note that the behavior for attr removal and element/pi/whatever removal is
totally different (node removal events fire _before_ the node is removed).  The
two really should be treated symmetrically, since there is no substantive
difference between attr nodes and other nodes.....  imo this is a problem with
the spec.
it's additionally interesting because we fire at least some of the child-insert
event after the change has taken place :)
more fun: we're calling GetAttributeNode when we should call GetAttributeNodeNS
to retrieve the relevant attributenode before firing off mutation-events
Assignee: general → nobody
QA Contact: ian → general
This should be fixed now.
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven't been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.