diff --git a/src/functionCall.js b/src/functionCall.js index 9250493..d2bf443 100644 --- a/src/functionCall.js +++ b/src/functionCall.js @@ -371,14 +371,14 @@ wgxpath.FunctionCall.Func = { wgxpath.DataType.STRING, false, true, false, function(ctx, opt_expr) { var node = opt_expr ? opt_expr.evaluate(ctx).getFirst() : ctx.getNode(); - return node ? (node.localName || node.nodeName.toLowerCase()) : ''; + return node ? (node.localName || node.nodeName) : ''; }, 0, 1, true), NAME: wgxpath.FunctionCall.createFunc_('name', wgxpath.DataType.STRING, false, true, false, function(ctx, opt_expr) { // TODO: Fully implement this. var node = opt_expr ? opt_expr.evaluate(ctx).getFirst() : ctx.getNode(); - return node ? node.nodeName.toLowerCase() : ''; + return node ? node.nodeName : ''; }, 0, 1, true), NAMESPACE_URI: wgxpath.FunctionCall.createFunc_('namespace-uri', wgxpath.DataType.STRING, true, false, false, diff --git a/src/nameTest.js b/src/nameTest.js index 73ef2bf..e0639b3 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) { @@ -103,7 +103,7 @@ wgxpath.NameTest.prototype.matches = function(node) { // TODO(moz): Investigate if node.localName is necessary. var localName = goog.isDef(node.localName) ? node.localName : node.nodeName; if (this.name_ != wgxpath.NameTest.WILDCARD && - this.name_ != localName.toLowerCase()) { + this.name_ != localName) { return false; } else { if (this.namespaceUri_ == wgxpath.NameTest.WILDCARD) { diff --git a/src/node.js b/src/node.js index cdcdc18..8740572 100644 --- a/src/node.js +++ b/src/node.js @@ -268,7 +268,7 @@ wgxpath.Node.getDescendantNodesGeneric_ = function(test, node, } else if (node.getElementsByTagName) { var nodes = node.getElementsByTagName(test.getName()); goog.array.forEach(nodes, function(node) { - if (wgxpath.Node.attrMatches(node, attrName, attrValue)) { + if (test.matches(node) && wgxpath.Node.attrMatches(node, attrName, attrValue)) { nodeset.add(node); } }); @@ -320,7 +320,7 @@ wgxpath.Node.getChildNodesIEPre9_ = function(test, node, if (name != '*') { //children = children.tags(name); // children.tags seems buggy. children = goog.array.filter(children, function(child) { - return child.tagName && child.tagName.toLowerCase() == name; + return child.tagName && child.tagName == name; }); if (!children) { return nodeset;