@@ -139,7 +139,7 @@ module.exports = {
139
139
name : 'DOMComment' ,
140
140
base : 'DOMNode' ,
141
141
identify : function ( obj ) {
142
- return obj && obj . nodeType === 8 ;
142
+ return obj && typeof obj . nodeType === 'number' && obj . nodeType === 8 ;
143
143
} ,
144
144
equal : function ( a , b ) {
145
145
return a . nodeValue === b . nodeValue ;
@@ -158,7 +158,7 @@ module.exports = {
158
158
name : 'DOMTextNode' ,
159
159
base : 'DOMNode' ,
160
160
identify : function ( obj ) {
161
- return obj && obj . nodeType === 3 ;
161
+ return obj && typeof obj . nodeType === 'number' && obj . nodeType === 3 ;
162
162
} ,
163
163
equal : function ( a , b ) {
164
164
return a . nodeValue . trim ( ) === b . nodeValue . trim ( ) ;
@@ -200,7 +200,7 @@ module.exports = {
200
200
name : 'HTMLDocType' ,
201
201
base : 'DOMNode' ,
202
202
identify : function ( obj ) {
203
- return obj && obj . nodeType === 10 && 'publicId' in obj ;
203
+ return obj && typeof obj . nodeType === 'number' && obj . nodeType === 10 && 'publicId' in obj ;
204
204
} ,
205
205
inspect : function ( doctype , depth , output , inspect ) {
206
206
output . code ( '<!DOCTYPE ' + doctype . name + '>' , 'html' ) ;
@@ -219,7 +219,7 @@ module.exports = {
219
219
name : 'HTMLDocument' ,
220
220
base : 'DOMNode' ,
221
221
identify : function ( obj ) {
222
- return obj && obj . nodeType === 9 && obj . documentElement && obj . implementation ;
222
+ return obj && typeof obj . nodeType === 'number' && obj . nodeType === 9 && obj . documentElement && obj . implementation ;
223
223
} ,
224
224
inspect : function ( document , depth , output , inspect ) {
225
225
for ( var i = 0 ; i < document . childNodes . length ; i += 1 ) {
@@ -240,7 +240,7 @@ module.exports = {
240
240
name : 'HTMLElement' ,
241
241
base : 'DOMNode' ,
242
242
identify : function ( obj ) {
243
- return obj && obj . nodeType === 1 && obj . nodeName && obj . attributes && obj . outerHTML ;
243
+ return obj && typeof obj . nodeType === 'number' && obj . nodeType === 1 && obj . nodeName && obj . attributes ;
244
244
} ,
245
245
equal : function ( a , b , equal ) {
246
246
return a . nodeName . toLowerCase ( ) === b . nodeName . toLowerCase ( ) && equal ( getAttributes ( a ) , getAttributes ( b ) ) && equal ( a . childNodes , b . childNodes ) ;
0 commit comments