ampproject / ampproject/amp-react-prototype
Children attribute mutations
- Vorherrschende Sprache
- JavaScript
- Sterne
- 36
- Forks
- 6
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
Most of composite elements would want to know their children, which can be easily monitored using mutation observer:
```
mutationObserver.observe(this.element, {childList: true});
```
This works well when the component does not differentiate the types of children. E.g. "all children are carousel's slides". When children have different designations we can use attributes to assign them different roles. For instance, a customized "next" button in the carousel can be marked up as ``. If these attributes can change after the initialization, we may need to observe each child for attribute changes as well. E.g.
```
mutationObserver.observe(child, {attributes: true, attributesFilter: ...});
```
The goal is to avoid this as much as possible given the additional performance and code management cost.
Beitragsleitfaden
Rechercherichtung
Der Issue nennt keine Dateien, Tests oder Einstiegspunkte. Beginne mit den composite-element- und MutationObserver-Beispielen im Bericht; für den Abschluss ist ein festgelegter, umsetzbarer Umfang für den Umgang mit Änderungen an Attributen von Kind-Elementen erforderlich, ohne unnötige Beobachtung.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, react
- Bereich
- frontend
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100