mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix(highlight): drive-by fixes to selector highlight (#12083)
This commit is contained in:
parent
5ea79c2ffa
commit
6c89f160e8
@ -1144,7 +1144,7 @@ export class Frame extends SdkObject {
|
|||||||
const pair = await this.resolveFrameForSelectorNoWait(selector);
|
const pair = await this.resolveFrameForSelectorNoWait(selector);
|
||||||
if (!pair)
|
if (!pair)
|
||||||
return;
|
return;
|
||||||
const context = await this._utilityContext();
|
const context = await pair.frame._utilityContext();
|
||||||
const injectedScript = await context.injectedScript();
|
const injectedScript = await context.injectedScript();
|
||||||
return await injectedScript.evaluate((injected, { parsed }) => {
|
return await injectedScript.evaluate((injected, { parsed }) => {
|
||||||
return injected.highlight(parsed);
|
return injected.highlight(parsed);
|
||||||
|
|||||||
@ -882,8 +882,9 @@ export class InjectedScript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_runHighlightOnRaf(selector: ParsedSelector) {
|
_runHighlightOnRaf(selector: ParsedSelector) {
|
||||||
if (this._highlight)
|
if (!this._highlight)
|
||||||
this._highlight.updateHighlight(this.querySelectorAll(selector, document.documentElement), stringifySelector(selector), false);
|
return;
|
||||||
|
this._highlight.updateHighlight(this.querySelectorAll(selector, document.documentElement), stringifySelector(selector), false);
|
||||||
requestAnimationFrame(() => this._runHighlightOnRaf(selector));
|
requestAnimationFrame(() => this._runHighlightOnRaf(selector));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user