mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix(ElementHandle): teach ElementHandle to work with shadowdom (#1227)
Elements in shadow dom erroneously considered that they were detached from document. This patch starts using `Element.isConnected` instead of `document.contains()` call. Fixes #1061.
This commit is contained in:
@@ -42,7 +42,7 @@ class ElementHandle extends JSHandle {
|
||||
|
||||
async _scrollIntoViewIfNeeded() {
|
||||
const error = await this.executionContext().evaluate(element => {
|
||||
if (!element.ownerDocument.contains(element))
|
||||
if (!element.isConnected)
|
||||
return 'Node is detached from document';
|
||||
if (element.nodeType !== Node.ELEMENT_NODE)
|
||||
return 'Node is not of type HTMLElement';
|
||||
|
||||
Reference in New Issue
Block a user