This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
"animation-delay", | |
"animation-direction", | |
"animation-duration", | |
"animation-fill-mode", | |
"animation-iteration-count", | |
"animation-name", | |
"animation-play-state", | |
"animation-timing-function", | |
"background-attachment", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* defining something like this */ | |
@--custom-grammar (at-rule: --demo) { | |
selectors: :--custom(); | |
@--custom-grammar (selector: :--custom()) { | |
properties: --direction, --depth; | |
@--custom-grammar (property: --direction) { | |
value: north | east | south | west; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@--custom-units { | |
--finger-widths: 50px; | |
--smidge: 5px; | |
} | |
div { | |
width: 10--finger-widths; | |
height: 40--finger-widths; | |
margin-top: 1--smidge; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Step 1: Create a <style> tag to use and add it to the document | |
var css = document.body.appendChild(document.createElement('style')) | |
// Empty all custom CSS added so far | |
css.innerHTML = '' | |
// Add new CSS to our <style> tag (replace with your own CSS rules) | |
css.innerHTML += ` | |
p { | |
color: red; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as parseCSS from 'https://tomhodgins.github.io/parse-css/index.js' | |
const input = { | |
css: '', | |
js: '' | |
} | |
const output = { | |
css: '', | |
js: '' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
[ "HTMLElement", "abbr" ], | |
[ "HTMLElement", "address" ], | |
[ "HTMLElement", "aside" ], | |
[ "HTMLElement", "b" ], | |
[ "HTMLElement", "bdi" ], | |
[ "HTMLElement", "bdo" ], | |
[ "HTMLElement", "code" ], | |
[ "HTMLElement", "dd" ], | |
[ "HTMLDetailsElement", "details" ], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// run this code on this page: | |
// https://html.spec.whatwg.org/multipage/ | |
[...document.querySelectorAll('#toc-semantics a')] | |
.filter(tag => tag.querySelector('code')) | |
.filter(({textContent}) => /The .+ element/.test(textContent)) | |
.map(({textContent}) => textContent = textContent.replace(/.+The (.+) element/, '$1')) | |
.sort() | |
.map(name => [document.createElement(name).constructor.name, name]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function replaceWord(element, target, replacement) { | |
var iterable = document.createNodeIterator(element, NodeFilter.SHOW_TEXT) | |
for (var node; node = iterable.nextNode();) { | |
node.data = node.data.replace(new RegExp(target, 'g'), replacement) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
':root' | |
.split('') | |
.map(char => | |
'.#[]:'.includes(char) | |
? char | |
: `\\${char.charCodeAt(0).toString(16)}` | |
) | |
.join('') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// import {filter, all, stringify} from 'https://unpkg.com/cssomtools' | |
// import {parseACommaSeparatedListOfComponentValues} from 'https://tomhodgins.github.io/parse-css/index.js' | |
import('https://unpkg.com/cssomtools').then(({process, all, stringify}) => { | |
import('https://tomhodgins.github.io/parse-css/index.js').then(({parseACommaSeparatedListOfComponentValues}) => { | |
function transplant(target = ':root') { | |
let output = { | |
html: '', |