Mutation events should fire after an attribute is removed

NEW
Unassigned

Status

()

Core
DOM
14 years ago
8 years ago

People

(Reporter: sicking, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

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.
You need to log in before you can comment on or make changes to this bug.