@schalkneethling/css-media-pseudo-polyfill 1.0.11 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -0
- package/dist/fn.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{polyfill-CiJgx85h.mjs → polyfill-D0PMITQS.mjs} +3 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,6 +25,28 @@ The polyfill runs in four stages:
|
|
|
25
25
|
|
|
26
26
|
The `"./fn"` entry point is useful when you need to run the polyfill earlier (e.g., from a synchronous `<script>` in `<head>`) to minimize the flash of unstyled content (FOUC).
|
|
27
27
|
|
|
28
|
+
**Default entry point** — auto-applies on `DOMContentLoaded`:
|
|
29
|
+
|
|
30
|
+
```js
|
|
31
|
+
import "@schalkneethling/css-media-pseudo-polyfill";
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**`"./fn"` entry point** — call `polyfill()` manually, e.g. from a synchronous `<script>` in `<head>` to minimize FOUC:
|
|
35
|
+
|
|
36
|
+
```html
|
|
37
|
+
<script type="module">
|
|
38
|
+
import { polyfill } from "@schalkneethling/css-media-pseudo-polyfill/fn";
|
|
39
|
+
polyfill();
|
|
40
|
+
</script>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Or from a module bundler:
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
import { polyfill } from "@schalkneethling/css-media-pseudo-polyfill/fn";
|
|
47
|
+
polyfill();
|
|
48
|
+
```
|
|
49
|
+
|
|
28
50
|
## Spec references
|
|
29
51
|
|
|
30
52
|
The pseudo-class definitions and their DOM conditions come from the [WHATWG HTML spec](https://html.spec.whatwg.org/multipage/semantics-other.html#selector-muted):
|
package/dist/fn.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as polyfill } from "./polyfill-
|
|
1
|
+
import { t as polyfill } from "./polyfill-D0PMITQS.mjs";
|
|
2
2
|
export { polyfill };
|
package/dist/index.mjs
CHANGED
|
@@ -295,13 +295,9 @@ function rewriteLinkStylesheets(unsupported) {
|
|
|
295
295
|
function computeStates(element, isStalledFlag) {
|
|
296
296
|
const states = /* @__PURE__ */ new Set();
|
|
297
297
|
if (element.paused) states.add("paused");
|
|
298
|
-
else
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
states.add("buffering");
|
|
302
|
-
if (isStalledFlag) states.add("stalled");
|
|
303
|
-
}
|
|
304
|
-
}
|
|
298
|
+
else if (element.readyState < element.HAVE_FUTURE_DATA) if (isStalledFlag) states.add("stalled");
|
|
299
|
+
else states.add("buffering");
|
|
300
|
+
else states.add("playing");
|
|
305
301
|
if (element.seeking) states.add("seeking");
|
|
306
302
|
if (element.muted) states.add("muted");
|
|
307
303
|
return states;
|
package/package.json
CHANGED