Re: [webcomponents] Custom elements disconnected from a document should not be upgraded (#419)

So if I'm understanding correctly, this snippet's custom element wouldn't be automatically upgraded if registration occurs afterwards:

```javascript
var div = document.createElement('div'),
    el = div.appendChild(document.createElement('my-element');
```

But this snippet's would:

```javascript
var el,
    div = document.createElement('div');

div.innerHTML = '<my-element></my-element>';
el = div.firstChild;
```

Is that correct?  I already dislike the idea of having to explicitly ask for created elements to be upgraded, but wouldn't this inconsistency be a cause for confusion among developers?  If anything, it seems like this is a hurdle put up for developers because there's a potential for a situation where _many_ elements with a hyphenated tag name won't be collected (at least until page unload).  Also, if the second snippet was inside @rniwa's original example loop, you still haven't properly solved the problem.

I really liked the idea of my custom elements being transparent to the third parties using them, asking them to change the way they use `document.createElement()` massively detracts from this, in my opinion.  Is there really no alternative?

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/419#issuecomment-194905641

Received on Thursday, 10 March 2016 15:31:15 UTC