RE: [Custom Elements] They are globals.

I think you are being misled by a superficial similarity with React's JSX.

JSX's `<Foo>` desugars to `React.createElement(Foo)`, which creates a `<div>` element with some of its behavior derived from the `Foo` class, found in JavaScript lexical scope. The `Foo` token has no impact on the DOM tree.

Custom elements' `<x-foo>` is completely unlike that. In that case, `x-foo` is a tag name, and a full participant in the DOM tree structure. It affects CSS selector matching, APIs like querySelector and getElementsByTagName, and more. It's not just a div.

As Ryosuke notes, it's very hard to imagine how "scoped tag names" would work. Both for implementation reasons, like the HTMLElement constructor, but also for cases like CSS or the DOM APIs, which operate fundamentally on a global mapping.

Received on Monday, 11 April 2016 18:25:32 UTC