Re: [w3c/webcomponents] Custom Element - untrackable upgrade (#671)

> not at all. You can set properties to any DOM node,

Right, but I meant that we at least need an official _proper_ way to set properties, and as I understand it based on the above examples you wrote, relying on a single call to `whenDefined` is not currently the proper way to do it, but rather having to add the additional hacks inside of the outer `whenDefined` is required as the currently proper solution.

Basically, what I'm saying is, your example should just work:

```js
check('sync template'); // fails
customElements.whenDefined('test-case').then(() => {
  check('async template');  // OK
})
```

This would lead to programs that are more reliable. The downside is that all "inert" template elements will be upgraded, but so? Most people define and upgrade all elements right when the page loads anyways.

Perhaps _not_ upgrading template elements is a premature optimization. Furthermore, if

```js
template.appendChild(document.createElement('test-case'))
```

doesn't create an `instanceof TestCase` but

```js
template.appendChild(new TestCase)
```

does, then we have an inconsistent API.

-- 
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/671#issuecomment-335632833

Received on Tuesday, 10 October 2017 23:01:39 UTC