Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 3x 3x 3x 3x 2x 3x 1x 1x 3x 3x 1x | /**
* Calls customElements.define without breaking flow if an error happens
* @param {string} name - Name for the new custom element. Must be a valid custom element name.
* @param {CustomElementConstructor} constructor - Name for the new custom element. Must be a valid custom element name.
*/
export function registerElement (name, constructor) {
try {
customElements.define(name, constructor)
} catch (error) {
console.error(error)
}
}
/**
* Registers CSS properties to fix Chrome "allow-discrete" transition on Chrome
* @see https://issues.chromium.org/issues/360159391
*/
export function registerCSSProperties () {
for (const [name, inherits] of /** @type {const} */([['--default-ui-mode', false], ['--ui-mode', true]])) {
try {
CSS.registerProperty({ name, inherits })
} catch (e) {
if (e instanceof DOMException) {
// property registered, ignore it
} else {
throw e // re-throw the error
}
}
}
}
|