Re: [w3c/webcomponents] Anonymous custom elements 匿名自定义组件 (#842)

To me, the main thing I love about Custom Elements is that it offers a standardized way for authors to extend the browser's functionalities in a declarative way. Just like when you add some form element to your HTML document, you magically get some dynamic functionalities. Adding JS to HTML essentially is to extend the browser's abilities, and I feel being able to do it declaratively is very important, it's the only way we can progressively enhance our webpages.

HTML already has somewhat anonymous elements like `div` and `span`, it might make more sense to extend the spec of Custom Built-in Elements, e.g. instead of upgrading a `div` with `is` attribute, create an imperative way of upgrading a built-in element to a custom element without requiring an element name, very similar to what we already do with some frameworks:

```js
@Component({
  selector: 'div.my-element`,
})
export class MyElement extends HTMLElement {
  // ...
}
```

-- 
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/842#issuecomment-633726960

Received on Monday, 25 May 2020 21:59:20 UTC