Re: [webcomponents] Permit retrieval of registered classes from window.customElements (#445)

Let's consider an example for the iterator:

```javascript
// somewhere else were defined MyElement1, MyElement2... and so on
window.customElements.define('my-element1', MyElement1);
window.customElements.define('my-element2', MyElement2);

// then, let's play with Iterator...
var alreadyDefined = window.customElements; // 
for (customElement in alreadyDefined) {
  console.dir(customElement);   // should I see here MyElement1, MyElement2?
}
```

What about if somewhere else we've imported a custom element that registers some new custom elements?

```html
<link rel="import" href="myExamples.html"> <!-- here we define more custom elements? -->
```

Remember that all [imports don't have context](https://github.com/w3c/webcomponents/issues/197).


What are the pros and cons if have a table with all registered custom elements?
If it's needed I'd like to check this table from a clear place... for example

```javascript
var defined = window.customElements.definitions;
for (var customElement in defined) {
   console.dir(customElement);
}
```

And if check if an element already was registered. The above is following the convention given for [Attributes](https://dom.spec.whatwg.org/#dom-element-attributes).
```javascript
if (!window.customElements.definitions.getItem('my-element1')) { 
  // ...
}
```

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/445#issuecomment-199182205

Received on Monday, 21 March 2016 09:00:09 UTC