Skip to content

Commit

Permalink
Merge pull request #159 from nfischer/use-named-constants
Browse files Browse the repository at this point in the history
switch references to nodeType to use named constants
  • Loading branch information
jindw authored Nov 22, 2016
2 parents bafdf2c + 48125ed commit d4dcfa9
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ Node.prototype = {
}
}
}
el = el.nodeType == 2?el.ownerDocument : el.parentNode;
el = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode;
}
return null;
},
Expand All @@ -397,7 +397,7 @@ Node.prototype = {
return map[prefix] ;
}
}
el = el.nodeType == 2?el.ownerDocument : el.parentNode;
el = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode;
}
return null;
},
Expand Down Expand Up @@ -582,7 +582,7 @@ Document.prototype = {
}
return newChild;
}
if(this.documentElement == null && newChild.nodeType == 1){
if(this.documentElement == null && newChild.nodeType == ELEMENT_NODE){
this.documentElement = newChild;
}

Expand All @@ -602,7 +602,7 @@ Document.prototype = {
getElementById : function(id){
var rtv = null;
_visitNode(this.documentElement,function(node){
if(node.nodeType == 1){
if(node.nodeType == ELEMENT_NODE){
if(node.getAttribute('id') == id){
rtv = node;
return true;
Expand Down Expand Up @@ -1186,8 +1186,8 @@ try{
},
set:function(data){
switch(this.nodeType){
case 1:
case 11:
case ELEMENT_NODE:
case DOCUMENT_FRAGMENT_NODE:
while(this.firstChild){
this.removeChild(this.firstChild);
}
Expand All @@ -1206,8 +1206,8 @@ try{

function getTextContent(node){
switch(node.nodeType){
case 1:
case 11:
case ELEMENT_NODE:
case DOCUMENT_FRAGMENT_NODE:
var buf = [];
node = node.firstChild;
while(node){
Expand Down

0 comments on commit d4dcfa9

Please sign in to comment.