Bug 174713: Make XPath on HTML documents behave consistently and HTML-ish. This makes the XPath-functions name() and local-name() return upper-case names and makes nametests case-insensitive.
r=peterv sr=jst a=asa git-svn-id: svn://10.0.0.236/trunk@137794 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -38,6 +38,9 @@
|
||||
#include "txIXPathContext.h"
|
||||
#include "txTokenizer.h"
|
||||
#include "XMLDOMUtils.h"
|
||||
#ifndef TX_EXE
|
||||
#include "nsIDOMNode.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Creates a NodeSetFunctionCall of the given type
|
||||
@@ -161,12 +164,23 @@ ExprResult* NodeSetFunctionCall::evaluate(txIEvalContext* aContext) {
|
||||
case LOCAL_NAME:
|
||||
{
|
||||
nsAutoString localName;
|
||||
#ifdef TX_EXE
|
||||
nsCOMPtr<nsIAtom> localNameAtom;
|
||||
node->getLocalName(getter_AddRefs(localNameAtom));
|
||||
if (localNameAtom) {
|
||||
// Node has a localName
|
||||
localNameAtom->ToString(localName);
|
||||
}
|
||||
#else
|
||||
// The mozilla HTML-elements returns different casing for
|
||||
// the localName-atom and .localName. Once we have a
|
||||
// treeWalker it should have a getLocalName(nsAString&)
|
||||
// function.
|
||||
nsCOMPtr<nsIDOMNode> mozNode =
|
||||
do_QueryInterface(node->getNSObj());
|
||||
NS_ASSERTION(mozNode, "wrapper doesn't wrap a nsIDOMNode");
|
||||
mozNode->GetLocalName(localName);
|
||||
#endif
|
||||
|
||||
return new StringResult(localName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user