ampproject / ampproject/amp-react-prototype
Children attribute mutations
- Langage dominant
- JavaScript
- Étoiles
- 36
- Forks
- 6
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
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.
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
L’issue ne nomme aucun fichier, test ni point d’entrée. Commencez par les exemples de composite-element et MutationObserver du rapport ; la finalisation nécessite un périmètre décidé et exploitable pour gérer les changements d’attributs des éléments enfants sans observation inutile.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- javascript, react
- Domaine
- frontend
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 25/100