diff --git a/src/nameTest.js b/src/nameTest.js index 73ef2bf..997be88 100644 --- a/src/nameTest.js +++ b/src/nameTest.js @@ -52,7 +52,7 @@ wgxpath.NameTest = function(name, opt_namespaceUri) { * @type {string} * @private */ - this.name_ = name.toLowerCase(); + this.name_ = name; var defaultNamespace; if (this.name_ == wgxpath.NameTest.WILDCARD) { @@ -69,6 +69,9 @@ wgxpath.NameTest = function(name, opt_namespaceUri) { this.namespaceUri_ = opt_namespaceUri ? opt_namespaceUri.toLowerCase() : defaultNamespace; + if (this.namespaceUri_ == wgxpath.NameTest.HTML_NAMESPACE_URI_) { + this.name_ = this.name_.toLowerCase(); + } }; diff --git a/src/node.js b/src/node.js index cdcdc18..854d28e 100644 --- a/src/node.js +++ b/src/node.js @@ -265,8 +265,8 @@ wgxpath.Node.getDescendantNodesGeneric_ = function(test, node, } else if (test instanceof wgxpath.KindTest) { wgxpath.Node.doRecursiveAttrMatch_(test, node, attrName, attrValue, nodeset); - } else if (node.getElementsByTagName) { - var nodes = node.getElementsByTagName(test.getName()); + } else if (node.getElementsByTagNameNS) { + var nodes = node.getElementsByTagNameNS(test.getNamespaceUri(), test.getName()); goog.array.forEach(nodes, function(node) { if (wgxpath.Node.attrMatches(node, attrName, attrValue)) { nodeset.add(node);