Merge pull request #10398 from Snuffleupagus/issue-10395
Prevent errors in various methods in `SimpleDOMNode` when the `childNodes` property is not defined (issue 10395)
This commit is contained in:
commit
1b84b2ed60
@ -278,12 +278,16 @@ class SimpleDOMNode {
|
||||
}
|
||||
|
||||
get firstChild() {
|
||||
return this.childNodes[0];
|
||||
return this.childNodes && this.childNodes[0];
|
||||
}
|
||||
|
||||
get nextSibling() {
|
||||
let index = this.parentNode.childNodes.indexOf(this);
|
||||
return this.parentNode.childNodes[index + 1];
|
||||
const childNodes = this.parentNode.childNodes;
|
||||
if (!childNodes) {
|
||||
return undefined;
|
||||
}
|
||||
const index = childNodes.indexOf(this);
|
||||
return childNodes[index + 1];
|
||||
}
|
||||
|
||||
get textContent() {
|
||||
|
Loading…
Reference in New Issue
Block a user