- From: Ryosuke Niwa via GitHub <sysbot+gh@w3.org>
- Date: Fri, 31 Jan 2020 02:30:27 +0000
- To: public-css-archive@w3.org
> Can you elaborate? You mean that the promise will be resolved if you add a stylesheet between `DOMContentLoaded` and `load`? I don't think that's the case (though it's subtle).
In the following example, Firefox would sometimes resolves "ready" before `DOMContentLoaded` is fired.
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
@font-face {
font-family: Ahem;
src: url("./fonts/Ahem.ttf");
}
</style>
<script>
window.addEventListener("load", () => {
document.getElementById('log').textContent += 'loaded: ' + document.fonts.check('10px Ahem') + '\n';
document.getElementById('log').textContent += 'document.fonts.size: ' + document.fonts.size + '\n';
});
window.addEventListener("DOMContentLoaded", () => {
document.getElementById('log').textContent += 'DOMContentLoaded: ' + document.fonts.check('10px Ahem') + '\n';
});
document.fonts.ready.then(() => {
document.getElementById('log').textContent += 'ready: ' + document.fonts.check('10px Ahem') + '\n';
});
</script>
</head>
<body>
<pre id="log"></pre>
<div id="element1" style="font-size: 10px; font-family: Ahem;">hello</div>
</body>
</html>
```
--
GitHub Notification of comment by rniwa
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4248#issuecomment-580554964 using your GitHub account
Received on Friday, 31 January 2020 02:30:28 UTC