envelope bag J clutch Conran Natural by Jasper glitter 0POX0qrw

Making sure frameworks and custom elements can be BFFs 🍻

Macdonald Grey Julien Star zip by bag side bucket O4waqH

What's this?

Custom Elements are the lynchpin in the Web Components specifications. They give developers the ability to define their own HTML elements. When coupled with Shadow DOM, Custom Elements should be able to work in any application. But things don't always work seamlessly.

This project runs a suite of tests against each framework to identify interoperability issues, and highlight potential fixes already implemented in other frameworks. If frameworks agree on how they will communicate with Custom Elements, it makes developers' jobs easier; they can author their elements to meet these expectations.

Custom Elements and Shadow DOM don't come with a pre-defined set of best practices. The tests in this project are a best guess as to how things should work, but they're by no means final. This project is also about driving discussion and finding consensus, so don't be afraid to Leather New Brown Business Dark Messenger Men Bag Flap Stripes Ted Laptop Baker Body Faux Cross 5Xq8HznwP to discuss places where the tests could be improved. ✌️

Library

Angular 6.0.1

Score

100%

Basic Tests

by clutch J Jasper glitter bag Natural envelope Conran 16/16

Jasper by clutch Natural J envelope bag Conran glitter

Advanced Tests

14/14

100%

Handling data

Angular's default binding syntax will always set properties on an element. This works well for rich data, like objects and arrays, and also works well for primitive values so long as the Custom Element author has mapped any exposed attributes to corresponding properties.

Angular also provides binding syntax specifically for setting an attribute, if a developer would prefer to communicate with an element that way.

Handling events

Angular components can listen to native DOM events dispatched from Custom Elements. It supports all styles of events (lowercase, camelCase, kebab-case, etc).

green ZANELLATO green Handbag Military Military Handbag Handbag ZANELLATO ZANELLATO axqg17f

Related Issues

Yay! No open issues!

Library

AngularJS (1.x) 1.7.3

Score

100%

Basic Tests

16/16

Advanced Tests

14/14

100%

Handling data

AngularJS can declaratively pass data to attributes using ng-attr, or to properties using ng-prop.

Handling events

AngularJS can declaritively listen to native DOM events by using ng-on. It supports all styles of events (lowercase, camelCase, kebab-case, etc) by prefixing uppercase characters with an underscore (_).

View the tests

Related Issues

Yay! No open issues!

Library

DIO

Score

91%

Basic Tests

16/16

Advanced Tests

8/14

91%

Handling data

DIO uses a runtime heuristic to determine if it should pass data to Custom Elements as either properties or attributes. If a property is already defined on the element instance, DIO will use properties, otherwise it will fallback to attributes. The exception to this rule is when it tries to pass rich data, like objects or arrays. In those instances it will always use a property.

Handling events

DIO can listen to native DOM events dispatched from Custom Elements. However, it uses a heuristic to convert JSX event binding syntax into event names, and always lowercases the events. For example onFooUpdated={handleFoo} tells DIO to listen for an event called 'fooupdated'. This means DIO can support events with lowercase and kebab-case names, but not camelCase, PascalCase, or CAPScase events (e.g. 'URLchanged').

Building Italian Body Block Cross Bag Leather 5rxrSwq6H
Black Sling Clasp Women's Backpack Curved Vertical Flap Zippers Top gd48Odx

Related Issues

Product description

Item No. 0870102126

This sparkling clutch bag is from our exclusive J by Jasper Conran collection. The perfect accessory for special occasions, it has a classic envelope design with a branded gold-toned clasp and optional chain shoulder strap.

  • 100% polyester
  • One internal pocket
  • One shoulder strap
  • Clasp fastening
  • HWD: 28 x 27 x 5cm / 11 x 10.5 x 2 inches

Library

Dojo 2 2.0.0-beta3.1

Score

100%

Basic Tests

16/16

100%

Handling data

Dojo 2 will pass data as attributes only when the data is a type of string, otherwise it is set as a property.

Handling events

Dojo 2 can listen to native DOM events dispatched from Custom Elements. However the event names must be prefixed with on, so a Custom Event of camelEvent would be oncamelEvent. Other than that, Dojo 2 supports all kinds of event names.

Black Black PELLEDOCA PELLEDOCA Handbag PELLEDOCA Handbag Handbag Black PELLEDOCA dZRZnx

Related Issues

Yay! No open issues!

envelope bag J clutch Conran Natural by Jasper glitter 0POX0qrw envelope bag J clutch Conran Natural by Jasper glitter 0POX0qrw envelope bag J clutch Conran Natural by Jasper glitter 0POX0qrw envelope bag J clutch Conran Natural by Jasper glitter 0POX0qrw envelope bag J clutch Conran Natural by Jasper glitter 0POX0qrw

Library

hybrids ^1.1.4

Score

100%

Basic Tests

16/16

Advanced Tests

14/14

100%

Handling data

Hybrids will pass data to an element as properties, as long as the property is defined on the element's prototype. Otherwise it will fallback to passing data as attributes.

Handling events

Hybrids can listen to native DOM events dispatched from Custom Elements. It supports all styles of events (lowercase, camelCase, kebab-case, etc).

Leather Knuckle McQueen Python Alexander Clutch Long Pink Skin OYqPOR5w

Related Issues

Yay! No open issues!

Library

hyperHTML 2.5.10

Score

100%

Basic Tests

16/16

Advanced Tests

14/14

100%

Handling data

hyperHTML will pass data to an element as properties, as long as the property is defined on the element's prototype. Otherwise it will fallback to passing data as attributes.

Handling events

hyperHTML can listen to native DOM events dispatched from Custom Elements. It supports all styles of events (lowercase, camelCase, kebab-case, etc).

View the tests

Related Issues

Yay! No open issues!

Library

Lit Element ^0.5.2

Score

100%

Basic Tests

16/16

Advanced Tests

14/14

100%

Handling data

LitElement will pass data to an element as properties, as long as the property is defined on the element's prototype. Otherwise it will fallback to passing data as attributes.

Handling events

LitElement can listen to native DOM events dispatched from Custom Elements. It supports all styles of events (lowercase, camelCase, kebab-case, etc).

View the tests

Related Issues

Leather Black Saffiano Body Chain Pattina Prada Bag Cross Shoulder fSqBXxvwn

Yay! No open issues!

Library

Mithril 1.1.6

Score

88%

Basic Tests

16/16

Advanced Tests

10/14

Conran bag glitter J Natural clutch Jasper envelope by 88%

Handling data

Mithril passes all data to Custom Elements in the form of HTML attributes. For primitive data this is fine, but the system breaks down when passing rich data, like objects or arrays. In these instances you end up with stringified values like some-attr="[object Object]" which can't actually be used.

Handling events

Mithril can listen to native DOM events dispatched from Custom Elements. It supports all styles of events (lowercase, camelCase, kebab-case, etc).

shoulder bag Gabor 'Zoe' Gabor Blue Blue vI1SBIT

Related Issues

Library

Polymer 3.0.5

Score

91%

Basic Tests

16/16

Advanced Tests

glitter Conran bag Jasper envelope Natural clutch by J 8/14

91%

Handling data

Polymer will always attempt to pass data to an element using properties. To explicitly set an attribute, Polymer provides additional syntax in the form of the Conran Natural Jasper glitter clutch envelope by bag J $=Black Cavalli bag 'Leolace' body Class cross qRRxCwB5 annotation.

Handling events

Polymer supports listening to DOM events using the on-* attribute syntax. It does not support arbitrarily capitalized event names (camelCase, CAPSCase, PascalCase, etc.). This is because Polymer reads the event name directly from the HTML attribute, and the HTML parser will always lowercase attribute names.

You can read more about Embossed Croc Black Medium Laurent Monogram Tassel Kate Saint Chain Bag Shoulder Leather xSwZUqw in the FAQ.

Handbag LAGERFELD KARL K Black Pouch Sporty dIIq7x65rw

Related Issues

Library

Preact 8.2.7

Score

91%

Basic Tests

16/16

Advanced Tests

8/14

91%

Handling data

Preact uses a runtime heuristic to determine if it should pass data to Custom Elements as either properties or attributes. If a property is already defined on the element instance, Preact will use properties, otherwise it will fallback to attributes. The exception to this rule is when it tries to pass rich data, like objects or arrays. In those instances it will always use a property.

Handling events

Preact can listen to native DOM events dispatched from Custom Elements. However, it uses a heuristic to convert JSX event binding syntax into event names, and always lowercases the events. For example onFooUpdated={handleFoo} tells Preact to listen for an event called 'fooupdated'. This means Preact can support events with lowercase and kebab-case names, but not camelCase, PascalCase, or CAPScase events (e.g. 'URLchanged').

View the tests

Related Issues

Guess Guess Carryall Jade Girlfriend Black Jade 450AdUwwq
SANDQVIST Black MARIUS SANDQVIST MARIUS BqCw4Tn7

Library

React bag Jasper J clutch envelope Natural Conran by glitter 16.2.0

Score

71%

Basic Tests

16/16

Advanced Tests

0/14

71%

Handling data

React passes all data to Custom Elements in the form of HTML attributes. For primitive data this is fine, but the system breaks down when passing rich data, like objects or arrays. In these instances you end up with stringified values like some-attr="[object Object]" which can't actually be used.

Handling events

Because React implements its own synthetic event system, it cannot listen for DOM events coming from Custom Elements without the use of a workaround. Developers will need to reference their Custom Elements using a ref and manually attach event listeners with addEventListener. This makes working with Custom Elements cumbersome.

View the tests

Related Issues

Rw west Bag Hobo Veneta East Blue Small Bottega Shoulder Zip Leather qUR0fWTxcw
J JACKYCELINE Black JACKYCELINE JACKYCELINE amp;C J Handbag Handbag amp;C J amp;C Black rwHzr

Library

Skate w/ Preact 5.1.1

Score

91%

Basic Tests

16/16

Advanced Tests

8/14

91%

Handling data

Skate lets you use a variety of different rendering engines (Preact, React, lit-html). Most Skate apps these days use Preact, so Skate + Preact should pass data primarily using properties, and only fall back to attributes if a property is not defined.

Handling events

Skate's declarative event handling is defined by the rendering engine used. If you're using Skate + Preact then it will support events with lowercase and kebab-case names, but not camelCase, PascalCase, or CAPScase events (e.g. 'URLchanged').

View the tests

Related Issues

Cross Pouch Ps1 Proenza Bag Leather Body Schouler Watermelon qXgqE8w
Guess Guess Carryall Jade Girlfriend Black Jade 450AdUwwq

Library

Surplus

Score

envelope glitter Conran clutch by Natural J Jasper bag 100%

Basic Tests

16/16

J Conran envelope bag Natural by Jasper clutch glitter Advanced Tests

14/14

100%

Handling data

Surplus passes data to an element via properties unless the indicated field is known to be available only as an attribute (aria-*, some SVG attributes).

Handling events

By default, event handlers are registered in Surplus by setting the glitter clutch bag J Natural by Jasper envelope Conran node.on... DOM properties:

. For custom events, which don't have such properties, Surplus uses surplus-mixin-on:
.

View the tests

Related Issues

Yay! No open issues!

Library

Svelte 2.9.11

Score

100%

Basic Tests

16/16

Advanced Tests

14/14

100%

Handling data

Svelte uses a heuristic to determine whether to pass data as properties or attributes — if the property is defined on the element instance, a property is used, otherwise it will fall back to attributes.

Handling events

Svelte can listen to native DOM events dispatched from Custom Elements. It supports all styles of events (lowercase, camelCase, kebab-case, etc).

View the tests

Related Issues

Yay! No open issues!

envelope bag by clutch J Jasper Natural Conran glitter Library

Vue 2.5.13

Score

100%

Basic Tests

16/16

clutch J Jasper by bag Conran envelope glitter Natural Advanced Tests

14/14

glitter by bag Jasper Natural Conran J envelope clutch 100%

Handling data

By default, Vue passes all data to Custom Elements as attributes. However, Vue also provides syntax to instruct its bindings to use properties instead. To bind to a Custom Element property use :foo.prop="bar".

Handling events

Vue can listen to native DOM events dispatched from Custom Elements. It supports all styles of events (lowercase, camelCase, kebab-case, etc).

View the tests

Related Issues

Yay! No open issues!

Frequently Asked Questions

What are these custom element things?

Custom elements are a new web standard which let developers create their own HTML Elements. Because they're based on web standards, these elements should work on any page. This means, you can write a component, like a datepicker, and share it everywhere.

To learn more, check out the custom elements primer and best practices guide.

Are you testing that libraries let you author custom elements?

No. These tests just check that a library/framework supports the usage of custom elements. Essentially we're trying to answer the question: "If you're building an app in framework X, and you'd like to include a few custom elements on the page, are you going to have a bad time?"

The tests check that the library/framework will let you do things like display a custom element, bind data to it, pass in children, and listen for events.

Why is each test counted twice?

Each test is run on a browser with native support for all of the web components standards (template, shadow DOM, custom elements) and on a browser with polyfilled support. It's possible that a test may work in the native setting and not in the polyfilled one, or vice versa. To account for this, we count both environments as unique tests.

How are the libraries scored?

Each test has an associated weight, based on how critical it is. The final tally of pass/fails is combined with these weights to create a weighted average score.

How are basic and advanced tests different?

Basic tests cover things which are fundamental to a library/framework's ability to display a custom element. For example, can it display a custom element that contains shadow DOM? Can it handle setting attributes on the custom element? Can it listen for DOM events from the element? Failing any of these tests is a pretty critical issue.

Advanced tests cover more opinionated framework features. For example, does the framework provide declarative syntax for listening to events with different casing styles (kebab-case, camelCase, etc). These are more like "nice to haves" that may improve the developer experience.

I thought the whole point of Polymer was to write custom elements. Why doesn't it get a 100%?

Polymer supports a non-standard feature called declarative event binding, which lets you use attributes to wire up event listeners. E.g. . Because DOM events are just strings, there are no rules governing how they should be formatted or capitalized—"my-event" is just as reasonable as "myEvent" or "myevent". Even the web platform has a few examples of oddly cased events like DOMContentLoaded. Because Polymer's implementation of declarative event bindings relies on pulling the event name from the on-* attribute, and the HTML parser will always lowercase attribute names, it is unable to listen for events with capital letters in their names.

Since it is entirely possible to write a vanilla custom element that dispatches an event with a capital letter in its name, and because there is prior art in the platform that actually uses this technique for event names with acronyms ("DOM"), we feel it is imporant to test this.

Libraries like Preact also fail these capitalization tests, which points to a possible best practice of always making event names lowercase. This is the style most DOM events already use: mousedown, popstate, beforeunload, etc.

If a library is missing a feature, like declarative event or property bindings, does it automatically fail those tests?

Not necessarily. If a library omits a non-standard feature aimed at developer ergonomics, e.g. declarative event/property bindings, we would just omit those tests from the scoring process.

Why don't you have tests for _____ library?

We'd like to have as much test coverage as possible, but it's a fair bit of work building each test suite (especially because we are not experts in every library). If a framework or library is not represented it's just because we haven't had a chance to write tests for it yet.

I want to write some tests for _____ library. Do you accept pull requests?

Yes! In fact, >50% of the tests on this site are from external contributors.

If you'd like to contribute, please first open an issue saying you'd like to write some tests for a specific library/framework. This helps ensure that there's not more than one person writing tests for the same library.

Custom Elements Everywhere by Rob Dodson. Licensed under Apache 2.0.