Closed
Bug 102293
Opened 23 years ago
Closed 22 years ago
We should have proper NodeTests
Categories
(Core :: XSLT, defect, P2)
Core
XSLT
Tracking
()
VERIFIED
FIXED
mozilla1.0
People
(Reporter: sicking, Assigned: axel)
References
Details
Attachments
(1 file, 1 obsolete file)
55.43 KB,
patch
|
Details | Diff | Splinter Review |
We should have proper NodeTests instead of letting everything being expressions. The classes AttributeExpr, BasicNodeExpr, ElementExpr, and TextExpr are currently only used as NodeTests (ie we never call ::evaluate on them) even though they inherit Expr. The reason we need NodeTests instead of just expressions is that there is a difference between the the expression "node()" and the nodetest "node()": * The expression "node()" is really short for "child::node()" which only matches nodes that has a parent, ei it does not match root-node. * The nodetest "node()" matches any node, so for example when used in the ancestor axis in the expression "ancestor::node()" the root-node will be part of the resulting nodeset. So what I've done is to create a new rootclass, txNodeTest. I've then merged ElementExpr and AttributeExpr into txNameTest. BasicNodeExpr and TextExpr is merged into txNodeTypeTest (should it be called txNodeType?). Warning! the names in the enum for wildcards sux! suggestions appritiated!
Reporter | ||
Comment 1•23 years ago
|
||
Assignee | ||
Comment 2•23 years ago
|
||
txNodeTest::matches shouldn't have a context state. ErrorObserver should be enough. (And that indicates more clearly what's supposed to happen.) + /* + * Creates a new txNameTest with the given type and the given + * principal node type + */ + txNameTest(String& aName, Node::NodeType aNodeType); TypeType? And make that Node::NodeType an enum over element or attribute. txNameTest should resolve the namespace in the constructor. Give it a ContextState, I gave you the dependency for that. I like WildNess, btw. txNameTest::matches should be stricter to attributes or elements. The parent of a attr is always an element, no need to check that. Of course you could null check it. So far for this bug and today. Axel
Reporter | ||
Comment 3•23 years ago
|
||
> txNodeTest::matches shouldn't have a context state. ErrorObserver should be > enough. (And that indicates more clearly what's supposed to happen.) No, i want it to have a complete contextstate so that we can make some more powerfull in the future. For example in an expression like "foo[@bar]" it would be great if have a special NodeTest that combined the predicate and the NameTest (this is part of the big optimisations thingy that we'll do in 2010 :) ) > + txNameTest(String& aName, Node::NodeType aNodeType); > TypeType? > And make that Node::NodeType an enum over element or attribute. Hmm.. I rather like it to have it generic for any nodetype. This way we can also use this namespace nodes. > txNameTest should resolve the namespace in the constructor. Give it a > ContextState, I gave you the dependency for that. I totally agree that this is the right way to do it. Not really sure I wanna wait that long though, but I could live with it I guess. > I like WildNess, btw. If you're happy, I'm happy :) > txNameTest::matches should be stricter to attributes or elements. The parent > of a attr is always an element, no need to check that. Of course you could > null check it. Acually this won't be a problem once ns-doom has landed and bug 96410 is fixed. The code will look totally different then.
Comment 4•23 years ago
|
||
So nsdoom has landed. Show us the difference ;).
Reporter | ||
Updated•23 years ago
|
Priority: -- → P2
Target Milestone: --- → mozilla0.9.7
Reporter | ||
Comment 6•23 years ago
|
||
Reporter | ||
Updated•23 years ago
|
Attachment #51353 -
Attachment is obsolete: true
Assignee | ||
Comment 7•23 years ago
|
||
push. This bug depends on the xpath context foo, which didn't make it. At least we can't decide if it does or not fast enough. Sorry Jonas, I owe you a trout.
Target Milestone: mozilla0.9.7 → mozilla0.9.8
Reporter | ||
Comment 9•23 years ago
|
||
this will be part of Pikes context rework
Assignee: sicking → axel
Status: ASSIGNED → NEW
Assignee | ||
Comment 10•22 years ago
|
||
these bugs should go in with bug 113611
Assignee | ||
Comment 11•22 years ago
|
||
fixed with checkin of bug 113611.
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 12•22 years ago
|
||
we didn't verify for a long time. I really checked, so VERIFIED.
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•