-
Notifications
You must be signed in to change notification settings - Fork 74
Closed
Description
I wanted to use <style ...> tags instead of <link rel="stylesheet" ...> but this didn't work.
Here is my example:
<style media="(prefers-color-scheme: light)">body {color: red;}</style>
<style media="(prefers-color-scheme: dark)">body {color: blue;}</style>
I think this code is responsible for that.
dark-mode-toggle/src/dark-mode-toggle.mjs
Lines 126 to 133 in b6723cd
| // We need to support `media="(prefers-color-scheme: dark)"` (with space) | |
| // and `media="(prefers-color-scheme:dark)"` (without space) | |
| this._darkCSS = doc.querySelectorAll( | |
| `${LINK_REL_STYLESHEET}[${MEDIA}*=${PREFERS_COLOR_SCHEME}][${MEDIA}*="${DARK}"]`, | |
| ); | |
| this._lightCSS = doc.querySelectorAll( | |
| `${LINK_REL_STYLESHEET}[${MEDIA}*=${PREFERS_COLOR_SCHEME}][${MEDIA}*="${LIGHT}"]`, | |
| ); |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels