mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-14 18:51:28 +00:00
Not part of regular build. Added fix for expressions starting with '/'
This commit is contained in:
parent
596099c506
commit
48e3a1ba4a
@ -29,7 +29,7 @@
|
||||
* - foo//bar would not match properly if there was more than
|
||||
* one node in the NodeSet (nodes) on the final iteration
|
||||
*
|
||||
* $Id: PathExpr.cpp,v 1.3 2000/05/29 07:15:17 kvisco%ziplink.net Exp $
|
||||
* $Id: PathExpr.cpp,v 1.4 2000/11/07 10:42:35 kvisco%ziplink.net Exp $
|
||||
*/
|
||||
|
||||
#include "Expr.h"
|
||||
@ -239,7 +239,11 @@ MBool PathExpr::matches(Node* node, Node* context, ContextState* cs) {
|
||||
case PARENT_OP:
|
||||
{
|
||||
Node* parent = cs->getParentNode(node);
|
||||
if (parent) return pxi->pExpr->matches(node, parent, cs);
|
||||
if (parent) {
|
||||
//-- make sure node is Document node
|
||||
if (parent->getNodeType() == Node::DOCUMENT_NODE)
|
||||
return pxi->pExpr->matches(node, parent, cs);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -285,6 +289,11 @@ MBool PathExpr::matches(Node* node, Node* context, ContextState* cs) {
|
||||
{
|
||||
Node* parent = cs->getParentNode(tnode);
|
||||
if (parent) {
|
||||
|
||||
//-- make sure we have a document node if necessary
|
||||
if ( !iter->hasNext() )
|
||||
if (parent->getNodeType() != Node::DOCUMENT_NODE) break;
|
||||
|
||||
if (pxi->pExpr->matches(tnode, parent, cs))
|
||||
tmpNodes.add(parent);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user