[RENDERER]: clean up the renderer ahead of the part model rework
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Refactoring
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript
- Ambito
- frontend
Direzione di ricerca
Start with the named files in src/dom-parts/ and src/util/, especially ChildNodePart.js, TemplatePart.js, and TemplateResult.js; the issue also points to #184 and #185. Run the existing tests first, then benchmark with npm run bench:compare against main. Done means the tests pass, the listed cleanup and fixes are complete, clear rows is at least as fast as create rows, no other benchmark regresses, and changelog entries are added under Unreleased.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Goal
Remove what is dead, fix what is quadratic and tighten the error handling in src/dom-parts/ and src/util/, without touching the marker format or the part semantics. Everything that #184 rewrites anyway stays as it is, so nothing here is done twice.
Tasks
Dead code
-
src/util/DOMHelper.js:diffNodes,diffAttributes,hasChildNodes,getNodePathanddecodeHTMLhave no callers left, they are the renderer from before the dom-parts. Remove them. -
src/util/DOMHelper.js:isOfSameNodeType()checks!nodeA && !nodeA.localName, which throws fornullinstead of returning false. Should be||. -
src/dom-parts/directives.js: the importsdecodeAttributeandconvertStringToTemplateare unused.
Performance
-
clear rowsis slower thancreate rows, 19.4 ms against 8.1 ms for 1000 rows in the last local benchmark run.getNodesBetweenComments()inChildNodePart.jswalks backwards and builds its list withunshift, which is quadratic, then removes node by node. Walk forward, or delete with aRangefrom the start to the end marker.TemplatePart.refreshChildNodes()calls the same function after every update when a part sits at the template root. -
ChildNodePart.arrayPartsnever shrinks. A list that once had 10,000 items and now has 10 keeps 9,990 template parts and their detached DOM. Trim to the array length. -
unsafeHTML()parses with DOMParser on every call and returns fresh nodes. The diff keeps the rendered nodes becauseisEqualNodematches, but the parse and the deep compare are paid on every render even when the string did not change. Compare the string in the part before resolving the value. -
processNodePart()creates the reserve text node for every child node part up front, also for parts that only ever render templates. Create it on first use. -
TemplateResult.renderInto()runsArray.from(childNodes).find()for the template-part marker on every render. Only needed when there is no cached part for the node yet.
Errors
-
throw { name: 'ParseTemplateError', … }inTemplateResult.jsthrows plain objects: no stack, noinstanceof. OneErrorsubclass. -
getValue()logs an unknown object withconsole.logand writes[object Object]into the SSR output. Warn with a message that says what to pass instead. The client renders such an object as text as well, both paths change together in #184. -
render()with a string goes throughinnerHTMLand leaves the cachedTemplatePartof the node in place. Atemplate()that switches between a string and aTemplateResultrenders against stale state.renderInto()checks that the markers of the cached instance are still in the node.
Bug
- #185, with the two tests.
Not in here
Comment walker consolidation, the multi-interpolation counters, the constructor cache in AttributePart and RawTextNodePart, the six WeakMaps: all of it is replaced by #184.
Done when
- tests pass
npm run bench:compareagainstmain:clear rowsis at least as fast ascreate rows, nothing else slower- changelog entries under Unreleased
- 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 78/100
webtides/element-js#198 ·
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
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