Skip to content

Commit

Permalink
Fix *ElementSibiling polyfills
Browse files Browse the repository at this point in the history
In Internet Explorer 8 errors are thrown when checking the nodeType as nextSibiling is undefined, so to fix this issue we should first check if there is a next sibiling which matches the conditional in the while loop.

Fixes #1490
  • Loading branch information
NickColley committed Dec 11, 2019
1 parent cfca85f commit fe66067
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import '../../Element'
get: function(){
var el = this.nextSibling;
while (el && el.nodeType !== 1) { el = el.nextSibling; }
return (el.nodeType === 1) ? el : null;
return (el && el.nodeType === 1) ? el : null;
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import '../../Element'
get: function(){
var el = this.previousSibling;
while (el && el.nodeType !== 1) { el = el.previousSibling; }
return (el.nodeType === 1) ? el : null;
return (el && el.nodeType === 1) ? el : null;
}
});

Expand Down

0 comments on commit fe66067

Please sign in to comment.