domenic / html-as-custom-elements

HTML as Custom Elements
https://domenic.github.io/html-as-custom-elements/
Apache License 2.0
260 stars 20 forks source link

Add initial <custom-a>, with a demo page #36

Closed domenic closed 9 years ago

domenic commented 9 years ago

It isn't terribly functional in a user-facing way right now, but the URLUtils properties all work, which is great. Mostly would be interested in review of the approach.

Commit message:

Makes use of several new webidl-class-generator features: implements, [CustomElementCallbacks], and [NoConversion].

Introduces our first "mixin," URLUtils. This gives us a direct manifestation of the URLUtils interface from the URL Standard, and how it relates to HTMLAnchorElement. In particular, we reify the mixin's "set the input" algorithm and the mixin target's "get the base" and "update steps" algorithms.

Introduces new infrastructure for private methods, used to allow URLUtils to access CustomHTMLAnchorElement's "get the base" and "update steps" algorithms (which are indeed conceptually private methods).

Introduces a wrapper around document.registerElement that deals with a few pitfalls stemming from custom elements' ES6 integration being incomplete, as well as the need to delete the custom element callbacks.

The way private instance state is handled by URLUtils is somewhat disappointing, but will do for now.

Added a demo page, which can be launched with npm run demo. It uses the beefy package to do most of the work. Right now it's very crude, and was mainly used as a way for me to verify that the various properties of the <custom-a> element were working and debug them while they weren't. We can use it to create a more impressive demo of <custom-a> as it evolves capabilities.

dglazkov commented 9 years ago

LGTM!

domenic commented 9 years ago

Couldn't resist pushing a few more commits to make it actually look like a link and be functional before heading home for the weekend. The demo actually shows a working <custom-a> now. Ticking off boxes in #37 as I go.