fix(codegen): constructed CSSStyleSheet was not for the injected window
It caused the following error: DOMException: Failed to set the 'adoptedStyleSheets' property on 'ShadowRoot': Sharing constructed stylesheets in multiple documents is not allowed See https://developer.mozilla.org/en-US/docs/Web/API/Document/adoptedStyleSheets#notallowederror
This commit is contained in:
parent
513272e78c
commit
fb69e334f8
|
|
@ -75,7 +75,7 @@ export class Highlight {
|
|||
this._actionPointElement = document.createElement('x-pw-action-point');
|
||||
this._actionPointElement.setAttribute('hidden', 'true');
|
||||
this._glassPaneShadow = this._glassPaneElement.attachShadow({ mode: this._isUnderTest ? 'open' : 'closed' });
|
||||
const sheet = new CSSStyleSheet();
|
||||
const sheet = new injectedScript.window.CSSStyleSheet();
|
||||
sheet.replaceSync(highlightCSS);
|
||||
this._glassPaneShadow.adoptedStyleSheets = [sheet];
|
||||
this._glassPaneShadow.appendChild(this._actionPointElement);
|
||||
|
|
|
|||
|
|
@ -1024,7 +1024,7 @@ export class Recorder {
|
|||
this.overlay = new Overlay(this);
|
||||
this.overlay.setUIState(this.state);
|
||||
}
|
||||
this._stylesheet = new CSSStyleSheet();
|
||||
this._stylesheet = new injectedScript.window.CSSStyleSheet();
|
||||
this._stylesheet.replaceSync(`
|
||||
body[data-pw-cursor=pointer] *, body[data-pw-cursor=pointer] *::after { cursor: pointer !important; }
|
||||
body[data-pw-cursor=text] *, body[data-pw-cursor=text] *::after { cursor: text !important; }
|
||||
|
|
|
|||
Loading…
Reference in a new issue