0.0.5 • Published 8 years ago

customelements-v1 v0.0.5

Weekly downloads
-
License
BSD-3-Clause
Repository
-
Last release
8 years ago

customelements-v1 NPM version

The Custom Elements v1 polyfills with shims for new.target for browsers that need it.

Installation

Simply do: npm install customelements-v1.

What is it?

This is a NPM port of the official Web Components v1 polyfill including the shim for new.target compatible browsers. This implementation additionally corrects a bug in the official version where the constructor of custom elements can be called more than once. Please read this for better understanding how the polyfill works. Know that the shim and HTMLElement instanceof checks are being taken care of by this package.

Changelog:

v0.0.5:

  • Splitted the polyfill into three separate files: - full.js contains the full polyfill and automatically sets the correct window state. - polyfill.js only contains the polyfill and the upgrader of builtin elements, but not the native shim. It applies it if necessary. - shim.js only contains the native shim and the upgrader of builtin elements. It applies it if necessary.

  • Minified by default.

v0.0.4:

  • Added a new lifecycle callback: 'createdCallback'. It will be called after the constructor has executed. Though not spec-compliant, it solves issues with not being able to upgrade elements before appending them to the DOM.

v0.0.3:

  • Fixed more bugs with element constructors.

v0.0.2:

  • Fixed a bug where element constructors can be called more than once.

v0.0.1:

  • Initial release, based on the official v1.0.0-alpha 3.

Usage

Import it in your project like this:

import "customelements-v1";