ampproject / ampproject/amp-react-prototype

Children attribute mutations

Aperta
#53 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
TBD
Lingua principale
JavaScript
Stelle
36
Fork
6
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

L'issue non nomina file, test o punti di ingresso. Parti dagli esempi di composite-element e MutationObserver nel report; per considerare il lavoro completato è necessario definire un ambito deciso e attuabile per gestire le modifiche agli attributi degli elementi figli senza osservazione non necessaria.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, react
Ambito
frontend
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.