Skip to content

Commit

Permalink
ADD getElementsByTagNameNS on Document
Browse files Browse the repository at this point in the history
  • Loading branch information
oelmekki committed Dec 12, 2010
1 parent ff5ded8 commit 484e556
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,2 +1,3 @@
.DS_Store
.svn
.*.swp
23 changes: 23 additions & 0 deletions lib/jsdom/level2/core.js
Expand Up @@ -188,6 +188,29 @@ core.NamedNodeMap.prototype._map = function(fn) {
return [];
};

core.Document.prototype.getElementsByTagNameNS = function(/* String */ namespaceURI,
/* String */ localName)
{
var nsPrefixCache = {};

function filterByTagName(child) {
if (child.nodeType && child.nodeType === this.ENTITY_REFERENCE_NODE) {
child = child._entity;
}

var localMatch = child.localName === localName,
nsMatch = child.namespaceURI === namespaceURI;
if ((localMatch || localName === "*") &&
(nsMatch || namespaceURI === "*"))
{
return true;
}
return false;
}

return new core.NodeList(this.ownerDocument || this, core.mapper(this, filterByTagName));
};

core.Element.prototype.getAttributeNS = function(/* string */ namespaceURI,
/* string */ localName)
{
Expand Down

0 comments on commit 484e556

Please sign in to comment.