Re: [csswg-drafts] [font-loading] "pending on the environment" not clear about what "document is still loading" means (#1081)

> But that would also wait for all subframes to be loaded. Is that what's intended here?

Probably not. Is there something I can hook which would say "all the DOM, scripts, and styles have loaded (but I don't care about subframes)"?

If not, "loaded" is still probably the best, just pessimistic. DOMContentLoaded fires before stylesheets finish loading, which is definitely too early.

> What's really bad is that ready is an attribute, which returns a different value each time. It's really bizarre.

That is incorrect. The interface has an internal slot specifically for holding onto the promise that is given out by .ready; some of the spec algorithms replace that promise at certain times, but the following code should work:

```js
let x = document.fonts.ready;
let y = document.fonts.ready;
console.log(x === y); // true per spec
```

> But that could definitely happen because of DOM mutations, right? There is no guarantee that the DOM will stop changing at any given point.

Yup, which is why the third bullet refers to *pending* layout operations (not theoretical future ones) (aka styles that haven't been flushed yet, and the layout and potential font loads that would result from them), and the following note says "as long as nothing further changes the document".

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1081#issuecomment-579560226 using your GitHub account

Received on Wednesday, 29 January 2020 02:10:08 UTC