Hi Mats
I'll study the DOM2 Events spec and see if there's
a clean way of adding support for tree mutation events without adversely
affecting performance.
Agreed. Maybe some way of listening either
to all changes to the tree, or all changes which match a specific type of
element, might help. So maybe an EventListener API that supports XPath filtering
might be useful...
If (say) the Document was the event
dispatcher, then it might be possible to have a single tree implementation that
could implement events or not without affecting performance too much. If needed
we could have a flag on a document to disable event firing.
The only current issue is that to conserve
RAM most Element implementations only contains a reference to its owner, which
is either its parent Element or the Document. So all Element implementations
currently walk up the tree of Elements to get to the Document, which for deeply
nested documents would be a performance penalty.
Though if changing this to have 2 instance
variables, the parent Element and Document, does not adversely affect
performance too much it might make sense to go this route.
James
|
- [dom4j-dev] DOM2 Events in DOM4J Mats Norén
- Re: [dom4j-dev] DOM2 Events in DOM4J James Strachan
- Re: [dom4j-dev] DOM2 Events in DOM4J Mats Norén
- James Strachan