@webcomponents/webcomponentsjs
Advanced tools
Comparing version 2.4.3 to 2.4.4
{ | ||
"name": "@webcomponents/webcomponentsjs", | ||
"version": "2.4.3", | ||
"version": "2.4.4", | ||
"description": "Web Components Polyfills", | ||
"main": "webcomponents-bundle.js", | ||
"repository": "github:webcomponents/polyfills", | ||
"bugs": "https://github.com/webcomponents/polyfills/issues", | ||
"homepage": "https://webcomponents.org/polyfills", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/webcomponents/polyfills.git", | ||
"directory": "packages/webcomponentsjs" | ||
}, | ||
"bugs": "https://github.com/webcomponents/polyfills/issues?q=is%3Aissue+is%3Aopen+label%3A\"Package%3A+webcomponentsjs\"", | ||
"homepage": "https://github.com/webcomponents/polyfills/tree/master/packages/webcomponentsjs", | ||
"author": "The Polymer Project Authors (https://polymer.github.io/AUTHORS.txt)", | ||
@@ -18,3 +22,4 @@ "license": "BSD-3-Clause", | ||
"scripts": { | ||
"build": "gulp", | ||
"build": "tsc && gulp", | ||
"build:watch": "chokidar --initial --follow-symlinks 'src/entrypoints/**/*.js' 'ts_src/**/*.ts' 'node_modules/@webcomponents/**/*.js' -c 'npm run build'", | ||
"lint": "eslint src", | ||
@@ -26,10 +31,11 @@ "regen-package-lock": "rm -rf node_modules package-lock.json; npm install", | ||
"devDependencies": { | ||
"@webcomponents/custom-elements": "^1.4.1", | ||
"@webcomponents/shadycss": "^1.9.6", | ||
"@webcomponents/shadydom": "^1.7.3", | ||
"@webcomponents/template": "^1.4.2", | ||
"@webcomponents/url": "^0.7.5", | ||
"@webcomponents/custom-elements": "^1.4.2", | ||
"@webcomponents/shadycss": "^1.10.1", | ||
"@webcomponents/shadydom": "^1.7.4", | ||
"@webcomponents/template": "^1.4.3", | ||
"@webcomponents/url": "^0.7.6", | ||
"babel-preset-minify": "^0.4.3", | ||
"get-own-property-symbols": "^0.9.2", | ||
"promise-polyfill": "^8.0.0" | ||
"promise-polyfill": "^8.0.0", | ||
"typescript": "^3.8.3" | ||
}, | ||
@@ -46,3 +52,3 @@ "publishConfig": { | ||
], | ||
"gitHead": "9f73cf59a68fcbd789426cb476e6c21946796958" | ||
"gitHead": "34a3d9104a8a4a7a2b4db2ce726cc498be6824a1" | ||
} |
@@ -14,12 +14,12 @@ [![Build Status](https://travis-ci.org/webcomponents/webcomponentsjs.svg?branch=master)](https://travis-ci.org/webcomponents/webcomponentsjs) | ||
- **Custom Elements v1**: allows authors to define their own custom tags ([spec](https://w3c.github.io/webcomponents/spec/custom/), [tutorial](https://developers.google.com/web/fundamentals/getting-started/primers/customelements), [polyfill](https://github.com/webcomponents/custom-elements)). | ||
- **Custom Elements v1**: allows authors to define their own custom tags ([spec](https://w3c.github.io/webcomponents/spec/custom/), [tutorial](https://developers.google.com/web/fundamentals/getting-started/primers/customelements), [polyfill](https://github.com/webcomponents/polyfills/tree/master/packages/custom-elements)). | ||
- **Shadow DOM v1**: provides encapsulation by hiding DOM subtrees under shadow roots ([spec](https://w3c.github.io/webcomponents/spec/shadow/), [tutorial](https://developers.google.com/web/fundamentals/getting-started/primers/shadowdom), | ||
[shadydom polyfill](https://github.com/webcomponents/shadydom), [shadycss polyfill](https://github.com/webcomponents/shadycss)). | ||
[shadydom polyfill](https://github.com/webcomponents/polyfills/tree/master/packages/shadydom), [shadycss polyfill](https://github.com/webcomponents/polyfills/tree/master/packages/shadycss)). | ||
For browsers that need it, there are also some minor polyfills included: | ||
- [`HTMLTemplateElement`](https://github.com/webcomponents/template) | ||
- [`HTMLTemplateElement`](https://github.com/webcomponents/polyfills/tree/master/packages/template) | ||
- [`Promise`](https://github.com/taylorhakes/promise-polyfill) | ||
- `Event`, `CustomEvent`, `MouseEvent` constructors and `Object.assign`, `Array.from` | ||
(see [webcomponents-platform](https://github.com/webcomponents/webcomponents-platform)) | ||
- [`URL constructor`](https://github.com/webcomponents/URL) | ||
- [`URL constructor`](https://github.com/webcomponents/polyfills/tree/master/packages/url) | ||
@@ -157,3 +157,3 @@ ## How to use | ||
### `custom-elements-es5-adapter.js` | ||
According to the spec, only ES6 classes (https://html.spec.whatwg.org/multipage/scripting.html#custom-element-conformance) may be passed to the _native_ `customElements.define` API. For best performnace, ES6 should be served to browsers that support it, and ES5 code should be serve to those that don't. Since this may not always be possible, it may make sense to compile and serve ES5 to all browsers. However, if you do so, ES5-style custom element classes will now **not** work on browsers with native Custom Elements because ES5-style classes cannot properly extend ES6 classes, like `HTMLElement`. | ||
According to the spec, only ES6 classes (https://html.spec.whatwg.org/multipage/scripting.html#custom-element-conformance) may be passed to the _native_ `customElements.define` API. For best performance, ES6 should be served to browsers that support it, and ES5 code should be serve to those that don't. Since this may not always be possible, it may make sense to compile and serve ES5 to all browsers. However, if you do so, ES5-style custom element classes will now **not** work on browsers with native Custom Elements because ES5-style classes cannot properly extend ES6 classes, like `HTMLElement`. | ||
@@ -179,3 +179,25 @@ As a workaround, if your project has been compiled to ES5, load `custom-elements-es5-adapter.js` before defining Custom Elements. This adapter will automatically wrap ES5. | ||
## Known Issues | ||
* [Style encapsulation (inline styling in components) does not work out of the box](#shadycss) | ||
* [Custom element's constructor property is unreliable](#constructor) | ||
* [ShadyCSS: :host(.zot:not(.bar:nth-child(2))) doesn't work](#nestedparens) | ||
### Style encapsulation (inline styling in components) does not work out of the box. <a id="shadycss"></a> | ||
The ShadowDOM polyfill does not properly support CSS in ShadowDoM out of the box: | ||
* Any styles inside components have an effect on the whole document (instead of on the component only - the encapsulation is broken). | ||
* Any shadow-dom specific selectors (like `:host`) do not work. | ||
You can fix those issues by manually calling the `ShadyCSS` APIs. See [ShadyCSS usage](https://github.com/webcomponents/shadycss#usage). | ||
### Custom element's constructor property is unreliable <a id="constructor"></a> | ||
See [#215](https://github.com/webcomponents/webcomponentsjs/issues/215) for background. | ||
In Edge and IE, instances of Custom Elements have a `constructor` property of `HTMLUnknownElementConstructor` and `HTMLUnknownElement`, respectively. It's unsafe to rely on this property for checking element types. | ||
It's worth noting that `customElement.__proto__.__proto__.constructor` is `HTMLElementPrototype` and that the prototype chain isn't modified by the polyfills(onto `ElementPrototype`, etc.) | ||
### ShadyCSS: :host(.zot:not(.bar:nth-child(2))) doesn't work <a id="nestedparens"></a> | ||
ShadyCSS `:host()` rules can only have (at most) 1-level of nested parentheses in its argument selector under ShadyCSS. For example, `:host(.zot)` and `:host(.zot:not(.bar))` both work, but `:host(.zot:not(.bar:nth-child(2)))` does not. | ||
### Manually Building | ||
@@ -214,20 +236,1 @@ | ||
* When using `webcomponents-loader.js` with the `defer` attribute, scripts that rely on the polyfills *must* be loaded using `WebComponents.waitFor(loadCallback)`. | ||
## Known Issues | ||
* [ShadowDOM CSS is not encapsulated out of the box](#shadycss) | ||
* [Custom element's constructor property is unreliable](#constructor) | ||
* [ShadyCSS: :host(.zot:not(.bar:nth-child(2))) doesn't work](#nestedparens) | ||
### ShadowDOM CSS is not encapsulated out of the box <a id="shadycss"></a> | ||
The ShadowDOM polyfill is not able to encapsulate CSS in ShadowDOM out of the box. You need to use specific code from the ShadyCSS library, included with the polyfill. See [ShadyCSS instructions](https://github.com/webcomponents/shadycss). | ||
### Custom element's constructor property is unreliable <a id="constructor"></a> | ||
See [#215](https://github.com/webcomponents/webcomponentsjs/issues/215) for background. | ||
In Edge and IE, instances of Custom Elements have a `constructor` property of `HTMLUnknownElementConstructor` and `HTMLUnknownElement`, respectively. It's unsafe to rely on this property for checking element types. | ||
It's worth noting that `customElement.__proto__.__proto__.constructor` is `HTMLElementPrototype` and that the prototype chain isn't modified by the polyfills(onto `ElementPrototype`, etc.) | ||
### ShadyCSS: :host(.zot:not(.bar:nth-child(2))) doesn't work <a id="nestedparens"></a> | ||
ShadyCSS `:host()` rules can only have (at most) 1-level of nested parentheses in its argument selector under ShadyCSS. For example, `:host(.zot)` and `:host(.zot:not(.bar))` both work, but `:host(.zot:not(.bar:nth-child(2)))` does not. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
2949268
22
2420
233
0
9
1