Web Components

webc/no-customized-builtins

Build autonomous custom elements that wrap a native element; do not extend built-ins with is=, which Safari does not support.

umiarkowanastatycznefe-web-components

Dlaczego

A customized built-in (customElements.define('fancy-button', FancyButton, { extends: 'button' }) used as <button is="fancy-button">) is not supported in Safari, and its maker has said it does not plan to add it. On every iPhone and Mac with Safari the element stays a plain button: the behaviour you added is silently missing.

Poprawka

Define an autonomous element (<fancy-button>) and put a real <button> inside its shadow root, or keep the native element and add the behaviour with a small script or a framework directive. If you depend on is=, load a polyfill and test in Safari.

Przykłady

// bad
customElements.define('fancy-button', FancyButton, { extends: 'button' })
// good
customElements.define('fancy-button', FancyButton) // renders <button> in its shadow root

Źródła

Fakty

Identyfikator
webc/no-customized-builtins
Waga
umiarkowana
Sprawdzanie
statyczne sprawdzane w kodzie źródłowym przez audit
Dotyczy plików
jsx html vue svelte astro angular
Uczy jej skill
fe-web-components Web components and Lit
Od wersji
0.1.0

Plik reguły na GitHubie

Przeczytaj w terminalu

npx github:dawidolko/frontend-skills explain webc/no-customized-builtins