• Stars
    star
    260
  • Rank 152,195 (Top 4 %)
  • Language
    CSS
  • License
    Apache License 2.0
  • Created about 10 years ago
  • Updated over 8 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

chai-as-promised

Extends Chai with assertions about promises.
JavaScript
1,417
star
2

promises-unwrapping

The ES6 promises spec, as per September 2013 TC39 meeting
JavaScript
1,219
star
3

sinon-chai

Extends Chai with assertions for the Sinon.JS mocking framework.
JavaScript
1,087
star
4

svg2png

Converts SVGs to PNGs, using PhantomJS
JavaScript
573
star
5

count-to-6

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

restify-oauth2

A simple OAuth 2 endpoint for Restify
CoffeeScript
295
star
7

opener

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

proposal-blocks

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

zones

Former home of the zones proposal for JavaScript
204
star
10

worm-scraper

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

jadeify

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

mocha-as-promised

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

especially

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

dict

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

infinite-list-study-group

Moved to WICG/virtual-scroller
72
star
16

understanding-node

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

promise-tests

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

proposal-arraybuffer-transfer

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

path-is-inside

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

streams-demo

Demo for Fetch + Streams
HTML
40
star
21

sorted-object

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

traceur-runner

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

last

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

get-originals

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

webidl-class-generator

Generates classes from WebIDL plus implementation code
JavaScript
28
star
26

pubit

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

browserify-deoptimizer

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

unhandled-rejections-browser-spec

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

wpt-runner

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

template-parts

Brainstorming a <template> parts proposal
20
star
31

cooperatively-sized-iframes

A proposal for iframes which can resize according to their content
19
star
32

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
33

es6isnigh

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

specgo

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

element-constructors

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

html-dashboard

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

dynamo-as-promised

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

amd-wrap

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

domains-tragedy

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

rewrapper

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

chromiumizer

Convert an image into the Chromium color pallette
JavaScript
9
star
42

webidl-html-reflector

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

grunt-amd-wrap

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

extensions

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

remember-to-eat

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

global-wrap

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

origin-agent-cluster-demo.dev

Some Origin-Agent-Cluster demos
HTML
6
star
48

v8-extras-geometry

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

jake-diagram-generator

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

blog.domenic.me

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

eslint-config

My personal base ESLint config
JavaScript
6
star
52

jsdom-proxy-benchmark

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

unownbot-filtered

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

cs4h

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

wk-scripts

My userscripts for WaniKani
JavaScript
4
star
56

gmify

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

emu-algify

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

warmup-reps

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

grunt-global-wrap

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

domains-romance

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

corrigibility

Corrigibility with Utility Preservation, in TypeScript
TypeScript
3
star
62

throw-catch-cancel-syntax

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

streaming-mediastreams

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

whatwg-participant-data-test

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

test262-to-mjsunit

Converts test262 tests to mjsunit tests
JavaScript
1
star
66

baseline-tester

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

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