Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
Fix tests for existing elements
Browse files Browse the repository at this point in the history
The type of a just created HTMLElement is never undefined, it is
actually an object of type HTMLUnknownElement. So now instead of
comparing to undefined, the tests check if the element is an instance of
HTMLUnknownElement and fails if it is.
  • Loading branch information
lucianafujii committed Nov 20, 2013
1 parent 6cc3962 commit 00163d9
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions scripts/engine.js
Expand Up @@ -1176,7 +1176,7 @@ Test = (function() {

var passed = false;
try {
passed = typeof HTMLElement != 'undefined' && element instanceof HTMLElement && this.isBlock(element) && this.closesImplicitly(elements[e]);
passed = element instanceof HTMLElement && !(element instanceof HTMLUnknownElement) && this.isBlock(element) && this.closesImplicitly(elements[e]);
} catch(error) {
}

Expand All @@ -1201,7 +1201,7 @@ Test = (function() {

var passed = false;
try {
passed = typeof HTMLElement != 'undefined' && element instanceof HTMLElement && this.isBlock(element) && (elements[e] != 'figure' || this.closesImplicitly(elements[e]));
passed = element instanceof HTMLElement && !(element instanceof HTMLUnknownElement) && this.isBlock(element) && (elements[e] != 'figure' || this.closesImplicitly(elements[e]));
} catch(error) {
}

Expand Down Expand Up @@ -1245,7 +1245,7 @@ Test = (function() {

var passed = false;
try {
passed = typeof HTMLElement != 'undefined' && element instanceof HTMLElement && (color = this.getStyle(element, 'background-color')) && (color != 'transparent');
passed = element instanceof HTMLElement && !(element instanceof HTMLUnknownElement) && (color = this.getStyle(element, 'background-color')) && (color != 'transparent');
} catch(error) {
}

Expand All @@ -1269,9 +1269,9 @@ Test = (function() {
var rpSupport = false;

try {
rubySupport = rubyElement && typeof HTMLElement != 'undefined' && rubyElement instanceof HTMLElement;
rtSupport = rtElement && typeof HTMLElement != 'undefined' && rtElement instanceof HTMLElement;
rpSupport = rpElement && typeof HTMLElement != 'undefined' && rpElement instanceof HTMLElement && this.isHidden(rpElement);
rubySupport = rubyElement && rubyElement instanceof HTMLElement && !(element instanceof HTMLUnknownElement);
rtSupport = rtElement && rtElement instanceof HTMLElement && !(element instanceof HTMLUnknownElement);
rpSupport = rpElement && rpElement instanceof HTMLElement && !(element instanceof HTMLUnknownElement) && this.isHidden(rpElement);
} catch(error) {
}

Expand Down Expand Up @@ -1301,7 +1301,7 @@ Test = (function() {

var passed = false;
try {
passed = typeof HTMLElement != 'undefined' && element instanceof HTMLElement;
passed = element instanceof HTMLElement && !(element instanceof HTMLUnknownElement);
} catch(error) {
}

Expand Down Expand Up @@ -1335,7 +1335,7 @@ Test = (function() {

var passed = false;
try {
passed = typeof HTMLElement != 'undefined' && element instanceof HTMLElement;
passed = element instanceof HTMLElement && !(element instanceof HTMLUnknownElement);
} catch(error) {
}

Expand Down

0 comments on commit 00163d9

Please sign in to comment.