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.

moderatestaticfe-web-components

Why

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.

Fix

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.

Examples

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

Sources

Facts

Id
webc/no-customized-builtins
Severity
moderate
Check
static checked in the source by audit
Applies to
jsx html vue svelte astro angular
Taught by the skill
fe-web-components Web components and Lit
Since version
0.1.0

Rule file on GitHub

Read it in the terminal

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