is-webcomponents-supported

1.0.0 • Public • Published

is-webcomponents-supported.js

does this JavaScript environment support WebComponents?

npm module

What is this?

I made this after reading Polymer for the Performance obsessed by Paul Lewis, who mentions a "good little check" devised by Glen Maddern.

Supported Environments

I've manually tested in a range of environments:

  • true: Chrome (43)

  • false: Node.js (0.12), Firefox (38)

Usage

  • CommonJS (e.g. Node.js, Browserify, etc) use index.js
var isWebComponentsSupported = require('is-webcomponents-supported');
console.log(isWebComponentsSupported()); // `true` or `false`
<script src="dist/index.js"></script>
<script>
console.log(isWebComponentsSupported()); // `true` or `false`
</script> 

API

isWebComponentsSupported(doc)

  • @param {Document} [doc] a DOM Document to run tests against
  • @returns {Boolean} does this JavaScript environment support WebComponents?

This project uses the global document object if you do not provide one. If you are performing other tests against non-global implementations for some reason, then this allows you to pass in any such object.

Readme

Keywords

Package Sidebar

Install

npm i is-webcomponents-supported

Weekly Downloads

1

Version

1.0.0

License

BSD-2-Clause

Last publish

Collaborators

  • jokeyrhyme