fix(types): cast nodes to elements in _viewportPointAndScroll

This commit is contained in:
Joel 2019-12-06 19:15:41 +00:00
parent 1c9103e642
commit 074fd1290a

View file

@ -258,8 +258,8 @@ export class ElementHandle<T extends Node = Node> extends js.JSHandle<T> {
private async _viewportPointAndScroll(relativePoint: types.Point): Promise<{point: types.Point, scrollX: number, scrollY: number}> { private async _viewportPointAndScroll(relativePoint: types.Point): Promise<{point: types.Point, scrollX: number, scrollY: number}> {
const [box, border] = await Promise.all([ const [box, border] = await Promise.all([
this.boundingBox(), this.boundingBox(),
this.evaluate((e: Element) => { this.evaluate((e: Node) => {
const style = e.ownerDocument.defaultView.getComputedStyle(e); const style = e.ownerDocument.defaultView.getComputedStyle(e as Element);
return { x: parseInt(style.borderLeftWidth, 10), y: parseInt(style.borderTopWidth, 10) }; return { x: parseInt(style.borderLeftWidth, 10), y: parseInt(style.borderTopWidth, 10) };
}).catch(debugError), }).catch(debugError),
]); ]);