-
Notifications
You must be signed in to change notification settings - Fork 24
Description
Consider when CSSStyleSheet.replace() needs to create a promise to either resolve or reject. In most cases, we can create a promise with the global object that we retrieve from the sheet's associated document. For constructed style sheets, the associated document would be the sheet's constructor document.
There are some edge cases, however, where the sheet may not have an associated document from which to retrieve a global object:
let style = document.createElement("style");
document.head.appendChild(style);
let sheet = style.sheet;
style.remove(); // sheet's associated document becomes null.
sheet.replace(''); Ideally, this code should still return a rejected promise with a NotAllowedError since this is not a constructed sheet. But it should be well-defined in the spec which global object should be used to create the promise in the event that there is no associated document.
It appears that Blink uses the caller's global object in this case.