Closed rofly closed 6 months ago
Describe the bug
Calling Node.contains with undefined argument raises a TypeError exception.
"TypeError": Cannot read properties of undefined (reading 'Symbol(parentNode)')
To Reproduce
Run the following code snippet
const happyDom = require("happy-dom"); const happyWindow = new happyDom.Window(); const parentElement = happyWindow.document.createElement('div'); const childElement = happyWindow.document.createElement('div'); parentElement.appendChild(childElement); let nonInitializedElement; parentElement.contains(nonInitializedElement);
Expected behavior
The same behavior that happens in the browser. Node.contains should return false when it's called with undefined
undefined
Describe the bug
Calling Node.contains with undefined argument raises a TypeError exception.
"TypeError": Cannot read properties of undefined (reading 'Symbol(parentNode)')
To Reproduce
Run the following code snippet
Expected behavior
The same behavior that happens in the browser. Node.contains should return false when it's called with
undefined