StyledElement: a subclass takes over the cached style sheets of its parent class and never adds its own
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript
- Ambito
- frontend
Direzione di ricerca
Inizia da StyledElement.connectedCallback() e segui come legge e inizializza elementStyleSheets per le sottoclassi. Aggiungi test per entrambi gli ordini di connessione nella suite di test esistente, verificando che ogni classe riceva i propri stili nello shadow DOM e nel light DOM. Il lavoro è completato quando entrambi gli ordini superano i test e la sottoclasse mantiene i propri fogli di stile.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Goal
Every element class gets its own style sheets, whichever class of its hierarchy connected first.
Context
StyledElement.connectedCallback() caches the sheets with if (!this.constructor['elementStyleSheets']) { this.constructor['elementStyleSheets'] = … }. The read goes through the prototype chain of the constructor, so a subclass finds the cache of a parent class that connected earlier and never builds its own. In @webtides/element-library 0.2.0 PasswordField extends InputField: when an el-input-field connects before the first el-password-field on a client-rendered page, appendStyleSheets() writes the input field's CSS into <style id="EL-PASSWORD-FIELD0">, and the password toggle is left without its layout (a large icon on a line of its own below the input). A server-rendered page looks right; it shows after a client-side navigation from a page without fields to one with both. element-js 1.3.0. Hit in loewen-digital/sveltekit-ai-starter-template (issue #22 there); the template defines an own, empty elementStyleSheets on every component class before the class is defined as an element.
Acceptance criteria
- With
class B extends A, each with styles of its own: connect anAfirst, then aB.Bgets its own sheets (shadow DOM:adoptedStyleSheets; light DOM: the appended<style>), not those ofA. - The order
Bfirst, thenA, keeps working. - A test covers both orders.
Proposal (non-binding)
Check Object.hasOwn(this.constructor, 'elementStyleSheets') instead of the value's truthiness.
Out of scope
Merging the styles of a parent class into its subclass.
- Lingua principale
- JavaScript
- Stelle
- 30
- Fork
- 5
- Merge medio
- 1h 57m
- PR unite (30g)
- 10
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di webtides/element-js
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
webtides/element-js#201 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
webtides/element-js#194 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
webtides/element-js#193 ·
I maintainer di solito rispondono entro 1 giorno
-
[RENDERER]: only the first raw text element with interpolations is handled, a line break inside one breaks it tooForse già presa @eddyloewen l’ha presa 28 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
webtides/element-js#185 ·
I maintainer di solito rispondono entro 1 giorno
-
[RENDERER]: a line break at the start of a <textarea> differs between toString() and a client renderAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 58/100
webtides/element-js#200 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di webtides/element-js
Issue simili
-
area:testing bug effort:low model:light plan planner:gpt-6-2-sol tests
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
Agent360dk/browser-mcp#124 ·
I maintainer di solito rispondono entro 2 giorni
-
area:site feature good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
pacocartones/free-llm-api-hub#829 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 1/5 1-3 ore Idoneità per principianti 78/100
Jason-Vaughan/TangleClaw#3270 ·
I maintainer di solito rispondono entro 1 giorno