Closed
Bug 322005
Opened 19 years ago
Closed 12 years ago
E4X: Facility to access the node in context, root, parent etc in filter and method for ancestor list.
Categories
(Core :: JavaScript Engine, enhancement)
Core
JavaScript Engine
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: BijuMailList, Unassigned)
References
Details
Attachments
(1 file)
(deleted),
text/html
|
Details |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20051227 Firefox/1.6a1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20051227 Firefox/1.6a1
Two issues...
1.
context node, root, parent etc in filter :-
Ref: 11.2.4 XML Filtering Predicate Operator, ECMA-357 2nd Edition / December 2005
It would have been nice if we had simple accessors to the current node, root node (of original document), parent node etc in the filter clause.
Right now a web developer can do this with little work around i am attaching a demo see attachment e4x_contextnode.htm
2.
root() node, ancestors() list.
We have children(), child(), descendants() for a node (Ref: 11.2.3 XML Descendant Accessor ),
But we dont have a function for root() of the original XML object
also no method for to get all in the chain above a node
Here is an example for the use of context node, root, parent etc in filter
c=<company president="1">
<dept boss="1" n="sales">
<emp id="1" n="evan" />
<emp id="2" n="tom" />
<emp id="3" n="matt" />
<emp id="12" n="susan" />
</dept>
<dept boss="11" n="support">
<emp id="4" n="dick" />
<emp id="5" n="earl" />
<emp id="11" n="barry" />
</dept>
<dept boss="6" n="rnd">
<emp id="6" n="eric" />
<emp id="7" n="bob" />
</dept>
<dept boss="8" n="qa">
<emp id="9" n="tim" />
<emp id="8" n="biju" />
<emp id="10" n="salim" />
</dept>
</company>
// list dept heads
c.dept.emp.(@id == @id.parent().parent().@boss);
// better if we had
//c.dept.emp.(@id == @_node.parent().@boss);
//c.dept.emp.(@id == @_parent.@boss);
// get name of the company president
c.dept.emp.(@id == @id.parent().parent().parent().@president).@n;
// better if we had
//c.dept.emp.(@id == @_root.@boss);
Reproducible: Always
Steps to Reproduce:
see demo on attachment e4x_contextnode.htm
c.dept.emp.(@id == @id.parent().parent().@boss);
// better would have been
//c.dept.emp.(@id == @_node.parent().@boss);
//c.dept.emp.(@id == @_parent.@boss);
// or simply
//c.dept.emp.(@id == @.parent().@boss);
//c.dept.emp.(@id == @..@boss); //like dir . and ..
c.dept.emp.(@id == @id.parent().parent().parent().@president).@n;
// better would have been
//c.dept.emp.(@id == @_root.@boss);
// or simply
//c.dept.emp.(@id == @/.@boss);
//c.dept.emp.(@id == @/@boss); //like dir /
Comment 2•12 years ago
|
||
E4X will be removed again from Spidermonkey (bug 788293)
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•