You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org> on 2005/10/24 06:02:03 UTC
[jira] Updated: (XERCESJ-807) dispatchEventToSubtree also dispatches to Siblings of initial Node
[ http://issues.apache.org/jira/browse/XERCESJ-807?page=all ]
Michael Glavassevich updated XERCESJ-807:
-----------------------------------------
Bugzilla Id: (was: 23793)
Component: DOM (Level 2 Events)
(was: DOM (Level 3 Core))
Description:
The dispatching of events with the recursive function dispatchEventToSubtree(..)
in DocumentImpl does also dispatch to the following Siblings of the initial Node
(though they are not in the subtree).
I have quickly fixed it by splitting the function into 2 and adding a boolean to
prevent dispatching to siblings at the first level of recursion.
(Invitation to everybody to fix this properly:)
Please verify if this is correct.
Thanks,
Regards,
Christian
The following 2 functions replace the original function:
-------------------------------------------
protected void dispatchEventToSubtree(NodeImpl node, Node n, Event e) {
dispatchEventToSubtree( node, n, e,true);
}
protected void dispatchEventToSubtree(NodeImpl node, Node n, Event e,boolean
p_FirstPass) {
Vector nodeListeners = getEventListeners(node);
if (nodeListeners == null || n == null)
return;
// ***** Recursive implementation. This is excessively expensive,
// and should be replaced in conjunction with optimization
// mentioned above.
((NodeImpl) n).dispatchEvent(e);
if (n.getNodeType() == Node.ELEMENT_NODE) {
NamedNodeMap a = n.getAttributes();
for (int i = a.getLength() - 1; i >= 0; --i)
dispatchEventToSubtree(node, a.item(i), e,false);
}
dispatchEventToSubtree(node, n.getFirstChild(), e,false);
if (!p_FirstPass)dispatchEventToSubtree(node, n.getNextSibling(), e,false);
}
-------------------------------------------
was:
The dispatching of events with the recursive function dispatchEventToSubtree(..)
in DocumentImpl does also dispatch to the following Siblings of the initial Node
(though they are not in the subtree).
I have quickly fixed it by splitting the function into 2 and adding a boolean to
prevent dispatching to siblings at the first level of recursion.
(Invitation to everybody to fix this properly:)
Please verify if this is correct.
Thanks,
Regards,
Christian
The following 2 functions replace the original function:
-------------------------------------------
protected void dispatchEventToSubtree(NodeImpl node, Node n, Event e) {
dispatchEventToSubtree( node, n, e,true);
}
protected void dispatchEventToSubtree(NodeImpl node, Node n, Event e,boolean
p_FirstPass) {
Vector nodeListeners = getEventListeners(node);
if (nodeListeners == null || n == null)
return;
// ***** Recursive implementation. This is excessively expensive,
// and should be replaced in conjunction with optimization
// mentioned above.
((NodeImpl) n).dispatchEvent(e);
if (n.getNodeType() == Node.ELEMENT_NODE) {
NamedNodeMap a = n.getAttributes();
for (int i = a.getLength() - 1; i >= 0; --i)
dispatchEventToSubtree(node, a.item(i), e,false);
}
dispatchEventToSubtree(node, n.getFirstChild(), e,false);
if (!p_FirstPass)dispatchEventToSubtree(node, n.getNextSibling(), e,false);
}
-------------------------------------------
Environment:
Operating System: Other
Platform: Other
was:
Operating System: Other
Platform: Other
Assign To: (was: Xerces-J Developers Mailing List)
Priority: Minor
> dispatchEventToSubtree also dispatches to Siblings of initial Node
> ------------------------------------------------------------------
>
> Key: XERCESJ-807
> URL: http://issues.apache.org/jira/browse/XERCESJ-807
> Project: Xerces2-J
> Type: Bug
> Components: DOM (Level 2 Events)
> Versions: 2.5.0
> Environment: Operating System: Other
> Platform: Other
> Reporter: Christian FRANCK
> Priority: Minor
> Attachments: XercesJ807Patch
>
> The dispatching of events with the recursive function dispatchEventToSubtree(..)
> in DocumentImpl does also dispatch to the following Siblings of the initial Node
> (though they are not in the subtree).
> I have quickly fixed it by splitting the function into 2 and adding a boolean to
> prevent dispatching to siblings at the first level of recursion.
> (Invitation to everybody to fix this properly:)
> Please verify if this is correct.
> Thanks,
> Regards,
> Christian
> The following 2 functions replace the original function:
> -------------------------------------------
> protected void dispatchEventToSubtree(NodeImpl node, Node n, Event e) {
> dispatchEventToSubtree( node, n, e,true);
> }
> protected void dispatchEventToSubtree(NodeImpl node, Node n, Event e,boolean
> p_FirstPass) {
> Vector nodeListeners = getEventListeners(node);
> if (nodeListeners == null || n == null)
> return;
> // ***** Recursive implementation. This is excessively expensive,
> // and should be replaced in conjunction with optimization
> // mentioned above.
> ((NodeImpl) n).dispatchEvent(e);
> if (n.getNodeType() == Node.ELEMENT_NODE) {
> NamedNodeMap a = n.getAttributes();
> for (int i = a.getLength() - 1; i >= 0; --i)
> dispatchEventToSubtree(node, a.item(i), e,false);
> }
> dispatchEventToSubtree(node, n.getFirstChild(), e,false);
> if (!p_FirstPass)dispatchEventToSubtree(node, n.getNextSibling(), e,false);
> }
> -------------------------------------------
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org