Better detection of DOM Nodes for equality
- Also use JSDom if a real one isn't present to get some more coverage there - Fixes #1172
This commit is contained in:
@@ -233,8 +233,8 @@ getJasmineRequireObj().pp = function(j$) {
|
||||
if (el.innerHTML === '') {
|
||||
this.append(el.outerHTML.replace(closingTag, ''));
|
||||
} else {
|
||||
var tagEnd = el.outerHTML.indexOf(el.innerHTML);
|
||||
this.append(el.outerHTML.substring(0, tagEnd));
|
||||
var tagEnd = el.outerHTML.indexOf('>');
|
||||
this.append(el.outerHTML.substring(0, tagEnd + 1));
|
||||
this.append('...' + closingTag);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -101,7 +101,14 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
};
|
||||
|
||||
j$.isDomNode = function(obj) {
|
||||
return obj.nodeType > 0;
|
||||
// Node is a function, because constructors
|
||||
return typeof jasmineGlobal.Node !== 'undefined' ?
|
||||
obj instanceof jasmineGlobal.Node :
|
||||
obj !== null &&
|
||||
typeof obj === 'object' &&
|
||||
typeof obj.nodeType === 'number' &&
|
||||
typeof obj.nodeName === 'string';
|
||||
// return obj.nodeType > 0;
|
||||
};
|
||||
|
||||
j$.isMap = function(obj) {
|
||||
|
||||
Reference in New Issue
Block a user