[Dojo-checkins] [Dojo Toolkit] #15176: _getXPath used for dojox.data.XmlStore identity uses 0-based index instead of 1

Dojo Trac trac at dojotoolkit.org
Fri Apr 13 17:06:17 EDT 2012


#15176: _getXPath used for dojox.data.XmlStore identity uses 0-based index instead
of 1
-------------------+------------------------
 Reporter:  suns   |        Type:  defect
   Status:  new    |    Priority:  undecided
Milestone:  tbd    |   Component:  General
  Version:  1.6.1  |  Blocked by:
 Blocking:         |
-------------------+------------------------
 _getXPath returns unique string which is serving good as identity but
 could not be used for XML navigation.

 {{{
 /root[0]
 }}}
 is not a valid XPath expression. XPath assumes 1-based indexes:
 {{{
 /root[1]
 }}}
 stands for first element.

 Patch is simple setting "1" instead of "0" in
 {{{#!js
                         while(node && node != element.ownerDocument){
                                 var pos = 1;// XPath uses 1-based indexes
                                 var sibling = node;
                                 var name = node.nodeName;
                                 while(sibling){
                                         sibling = sibling.previousSibling;
                                         if(sibling && sibling.nodeName ===
 name){
                                                 pos++;
                                         }
                                 }
                                 var temp = "/" + name + "[" + pos + "]";
 }}}

 Patch does not change the identity functionality but adds XPath
 capabilities.

-- 
Ticket URL: <http://bugs.dojotoolkit.org/ticket/15176>
Dojo Toolkit <http://dojotoolkit.org>
The Dojo Toolkit


More information about the Dojo-checkins mailing list