• Stars
    star
    259
  • Rank 157,669 (Top 4 %)
  • Language
    CSS
  • License
    Apache License 2.0
  • Created over 10 years ago
  • Updated over 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

HTML as Custom Elements

HTML as Custom Elements

This project aims to re-build the elements of HTML as custom elements. This accomplishes two goals:

  • Find missing platform APIs necessary to do the same things native HTML elements are able to do, thus producing a better layering story
  • Validate the design of custom elements with regard to how they explain the platform as a bedrock API

For now, this project is largely exploratory in nature. But eventually, its code may serve as the basis for something that can be incorporated into rendering engines. (The project is led by members of the Blink team, and the Servo team has also expressed interest.)

A demo is available, which shows implementation efforts for a number of fairly simple elements, and outlines the missing platform features each of them highlights. Even these simple elements have highlighted one major area of missing functionality in custom elements, which has been written up in the document "Gap Analysis: Accessibility".

Layering the Platform

One of the axioms of the extensible web project is that high-level, declarative APIs should be able to be explained in terms of lower-level, imperative APIs. Not just lower-level algorithms, but APIs: the capabilities that we encapsulate inside a given HTML element should also be exposed directly to JavaScript authors. And those APIs should be factored into small, composable pieces, that build on each other to eventually produce the declarative edifice that is HTML. In this way, authors can reuse these platform capabilities without jumping through hoops (like instantiating a HTMLAnchorElement just to parse a URL) or rebuilding large parts of the platform for themselves (like creating their own scrolling logic just to get pull-to-refresh behavior).

HTML as Custom Elements envisions rebuilding all of HTML using custom elements—and of course, a custom element can only be as powerful as the JavaScript behind it. So if, while rebuilding a HTML element as a custom element, we find that we cannot accomplish something the native HTML version can do, then we have found a missing platform API.

One of the major goals of this project is to find, enumerate, and categorize these absentee APIs. And once we've done so, we can create experimental versions in Chromium behind a flag, build a custom element over here using them to validate that they actually work, and then propose them for standardization.

Explaining the Platform

Custom elements gives us a lot. Crucially, it gives us a story for how the parser turns tags and attributes in your HTML source into instances that exist in the JavaScript-exposed DOM. It also gives hooks into the element lifecycle.

But native elements have at least one major property that custom elements do not: true encapsulation. This appears in various forms, but in general the story is that the code used to implement a HTML element (much of which currently lives in C++) cannot be interfered with or even observed by user code. For example, today changes to window.Number or Element.prototype.getAttribute will affect any custom elements coded to use those functions. Similarly, any DOM structures used to represent the "innards" of the element's on-screen representation (such as a <video> element's controls, or a <input type="range"> element's slider) are exposed to the outside world. Shadow DOM provides the shape of a solution, but in its current form is very much a permeable boundary.

One longer-term goal of this project is to come up with solutions for this problem. Roughly, we are thinking about something involving membranes, plus additions to shadow DOM.

More Repositories

1

promises-unwrapping

The ES6 promises spec, as per September 2013 TC39 meeting
JavaScript
1,238
star
2

svg2png

Converts SVGs to PNGs, using PhantomJS
JavaScript
573
star
3

count-to-6

An intro to some ES6 features via a set of self-guided workshops.
JavaScript
326
star
4

restify-oauth2

A simple OAuth 2 endpoint for Restify
CoffeeScript
294
star
5

opener

Opens stuff, like webpages and files and executables, cross-platform
JavaScript
293
star
6

proposal-blocks

Former home of a proposal for a new syntactic construct for serializable blocks of JavaScript code
215
star
7

zones

Former home of the zones proposal for JavaScript
205
star
8

worm-scraper

Scrapes the web serial Worm and its sequel Ward into an eBook format
JavaScript
179
star
9

jadeify

A simple browserify transform for turning .jade files into template functions
JavaScript
162
star
10

mocha-as-promised

Adds “thenable” promise support to the Mocha test runner.
JavaScript
132
star
11

especially

Abstract operations and other functions drawn from the ECMAScript specification
JavaScript
91
star
12

dict

A lightweight but safe dictionary, for when Object won't cut it
CoffeeScript
75
star
13

infinite-list-study-group

Moved to WICG/virtual-scroller
72
star
14

understanding-node

Material for the "Understanding the Node.js Platform" class at General Assembly
JavaScript
66
star
15

promise-tests

DEPRECATED: use https://github.com/promises-aplus/promises-tests instead!
JavaScript
61
star
16

proposal-arraybuffer-transfer

Former home of the now-withdrawn ArrayBuffer.prototype.transfer() proposal for JavaScript
60
star
17

path-is-inside

Tests whether one path is inside another path
JavaScript
40
star
18

streams-demo

Demo for Fetch + Streams
HTML
40
star
19

sorted-object

Returns a copy of an object with its keys sorted
JavaScript
35
star
20

traceur-runner

Runs JavaScript.next code in Node by compiling it with Traceur on the fly, seamlessly
JavaScript
35
star
21

last

A small helper for getting only the latest result of an asynchronous operation you perform multiple times in a row.
JavaScript
31
star
22

get-originals

A web platform API that allows access to the "original" versions of the global built-in objects' properties and methods
28
star
23

webidl-class-generator

Generates classes from WebIDL plus implementation code
JavaScript
28
star
24

pubit

Responsible publish/subscribe. Hide the event publisher, only exposing the event emitter.
CoffeeScript
28
star
25

browserify-deoptimizer

Transforms browserify bundles into a collection of single files
CoffeeScript
26
star
26

unhandled-rejections-browser-spec

Spec patches for HTML and ES for tracking unhandled promise rejections with events
22
star
27

wpt-runner

Runs web platform tests in Node.js using jsdom
JavaScript
21
star
28

template-parts

Brainstorming a <template> parts proposal
20
star
29

cooperatively-sized-iframes

A proposal for iframes which can resize according to their content
20
star
30

client-side-packages-demo

A demo application that shows recent commits to npm, using npm packages on the client side via browserify
JavaScript
18
star
31

es6isnigh

A presentation on the future of the JavaScript language.
JavaScript
17
star
32

specgo

A command-line tool for opening web specifications
JavaScript
16
star
33

element-constructors

Some ideas for how to implement constructors for Element, HTMLElement, etc.
JavaScript
15
star
34

html-dashboard

A dashboard for issue and pull request management in whatwg/html
JavaScript
14
star
35

amd-wrap

Wraps CommonJS files in `define(function (require, exports, module) { ... })`.
JavaScript
11
star
36

dynamo-as-promised

A promise-based client for Amazon's DynamoDB.
CoffeeScript
11
star
37

chromiumizer

Convert an image into the Chromium color pallette
JavaScript
10
star
38

domains-tragedy

An illustration of how Node.js domains can fail you when EventEmitters get involved.
JavaScript
10
star
39

rewrapper

A web application for rewrapping text to fit a column limit
HTML
9
star
40

extensions

Useful extension methods from my own projects
C#
8
star
41

webidl-html-reflector

Implements the algorithms to reflect HTML content attributes as WebIDL attributes
JavaScript
8
star
42

grunt-amd-wrap

Grunt task to wrap CommonJS files in `define(function (require, exports, module) { ... })`.
JavaScript
8
star
43

remember-to-eat

My personal meal/calorie/protein tracker
JavaScript
6
star
44

global-wrap

Exposes your CommonJS-based libraries as a global.
JavaScript
6
star
45

origin-agent-cluster-demo.dev

Some Origin-Agent-Cluster demos
HTML
6
star
46

v8-extras-geometry

An exploration of using V8 extras to implement the Geometry spec
JavaScript
6
star
47

jake-diagram-generator

Generates "Jake diagrams", i.e. browser session history timeline diagrams
JavaScript
6
star
48

blog.domenic.me

Hidden Variables: my infrequently-updated blog
Nunjucks
6
star
49

eslint-config

My personal base ESLint config
JavaScript
6
star
50

jsdom-proxy-benchmark

Benchmark for proxies that uses jsdom to build the ECMAScript spec
JavaScript
6
star
51

unownbot-filtered

A daemon that will filter @UnownBot to specific areas and text you about it
JavaScript
6
star
52

cs4h

Homework for General Assembly's CS for Hackers course (Summer 2012)
JavaScript
5
star
53

gmify

A simple interface to GraphicsMagick for streaming image processing.
JavaScript
4
star
54

wk-scripts

My userscripts for WaniKani
JavaScript
4
star
55

emu-algify

Use Ecmarkup's <emu-alg> elements in your HTML
JavaScript
3
star
56

warmup-reps

Initial work on an algorithmically-sound warmup rep calculator
JavaScript
3
star
57

grunt-global-wrap

Grunt task to expose your CommonJS-based libraries as a global.
JavaScript
3
star
58

domains-romance

An illustration of how domains can catch errors on your Node.js server
JavaScript
3
star
59

corrigibility

Corrigibility with Utility Preservation, in TypeScript
TypeScript
3
star
60

throw-catch-cancel-syntax

SweetJS macros for throw cancel and catch cancel
JavaScript
2
star
61

streaming-mediastreams

A spec for extracting the contents of a MediaStream object as a ReadableStream
Shell
2
star
62

diplomacy-visualizer

A visualizer for the Diplomacy board game
JavaScript
1
star
63

test262-to-mjsunit

Converts test262 tests to mjsunit tests
JavaScript
1
star
64

whatwg-participant-data-test

A dumping ground test repository for developing whatwg/participate.whatwg.org
1
star
65

baseline-tester

Runs a function against given inputs and tests the result against baseline outputs
JavaScript
1
star
66

pidgey-calc

A progressive web app that calculates how many Pidgeys you need for your next evolution spree in in Pokémon Go.
HTML
1
star