Skip to content

Commit 8e821ca

Browse files
JeanMecheAndrewKushnir
authored andcommitted
refactor(elements): remove unnecessary polyfill deps (#50115)
`webcomponents/custom-elements` and `document-register-element` are unnecessary now that we support only evergreen browsers. PR Close #50115
1 parent 5db170c commit 8e821ca

File tree

5 files changed

+1
-28
lines changed

5 files changed

+1
-28
lines changed

karma-js.conf.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,6 @@ module.exports = function(config) {
4141
{pattern: 'packages/platform-browser/test/static_assets/**/*', included: false},
4242
{pattern: 'packages/platform-browser/test/browser/static_assets/**/*', included: false},
4343

44-
// Serve polyfills necessary for testing the `elements` package.
45-
{
46-
pattern: 'node_modules/@webcomponents/custom-elements/**/*.js',
47-
included: false,
48-
watched: false,
49-
},
50-
5144
'node_modules/reflect-metadata/Reflect.js',
5245

5346
'dist/legacy-test-bundle.spec.js',

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@
9393
"@types/systemjs": "0.19.32",
9494
"@types/uuid": "^9.0.0",
9595
"@types/yargs": "^17.0.3",
96-
"@webcomponents/custom-elements": "^1.1.0",
9796
"angular-1.5": "npm:[email protected]",
9897
"angular-1.6": "npm:[email protected]",
9998
"angular-1.7": "npm:[email protected]",
@@ -110,7 +109,6 @@
110109
"convert-source-map": "^1.5.1",
111110
"d3": "^7.0.0",
112111
"diff": "^5.0.0",
113-
"document-register-element": "^1.7.2",
114112
"domino": "https://github.com/angular/domino.git#aa8de3486307f57a518b4b0d9e5e16d9fbd998d1",
115113
"graceful-fs": "4.2.11",
116114
"hammerjs": "~2.0.8",

packages/elements/src/create-custom-element.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,6 @@ export function createCustomElement<P>(
140140
static readonly['observedAttributes'] = Object.keys(attributeToPropertyInputs);
141141

142142
protected override get ngElementStrategy(): NgElementStrategy {
143-
// NOTE:
144-
// Some polyfills (e.g. `document-register-element`) do not call the constructor, therefore
145-
// it is not safe to set `ngElementStrategy` in the constructor and assume it will be
146-
// available inside the methods.
147-
//
148143
// TODO(andrewseguin): Add e2e tests that cover cases where the constructor isn't called. For
149144
// now this is tested using a Google internal test suite.
150145
if (!this._ngElementStrategy) {

packages/elements/test/create-custom-element_spec.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ describe('createCustomElement', () => {
6767
});
6868

6969
it('should work even if the constructor is not called (due to polyfill)', () => {
70-
// Some polyfills (e.g. `document-register-element`) do not call the constructor of custom
71-
// elements. Currently, all the constructor does is initialize the `injector` property. This
70+
// Currently, all the constructor does is initialize the `injector` property. This
7271
// test simulates not having called the constructor by "unsetting" the property.
7372
//
7473
// NOTE:
@@ -256,8 +255,6 @@ describe('createCustomElement', () => {
256255
function createAndRegisterTestCustomElement(strategyFactory: NgElementStrategyFactory) {
257256
const {selector, ElementCtor} = createTestCustomElement(strategyFactory);
258257

259-
// The `@webcomponents/custom-elements/src/native-shim.js` polyfill allows us to create
260-
// new instances of the NgElement which extends HTMLElement, as long as we define it.
261258
customElements.define(selector, ElementCtor);
262259

263260
return ElementCtor;

yarn.lock

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4120,11 +4120,6 @@
41204120
"@webassemblyjs/ast" "1.11.6"
41214121
"@xtuc/long" "4.2.2"
41224122

4123-
"@webcomponents/custom-elements@^1.1.0":
4124-
version "1.6.0"
4125-
resolved "https://registry.yarnpkg.com/@webcomponents/custom-elements/-/custom-elements-1.6.0.tgz#5ecde1c332464ff00612f51874484b78395d504d"
4126-
integrity sha512-CqTpxOlUCPWRNUPZDxT5v2NnHXA4oox612iUGnmTUGQFhZ1Gkj8kirtl/2wcF6MqX7+PqqicZzOCBKKfIn0dww==
4127-
41284123
"@xmldom/xmldom@^0.8.0", "@xmldom/xmldom@^0.8.5":
41294124
version "0.8.7"
41304125
resolved "https://registry.yarnpkg.com/@xmldom/xmldom/-/xmldom-0.8.7.tgz#8b1e39c547013941974d83ad5e9cf5042071a9a0"
@@ -7217,11 +7212,6 @@ [email protected]:
72177212
esutils "^1.1.6"
72187213
isarray "0.0.1"
72197214

7220-
document-register-element@^1.7.2:
7221-
version "1.14.10"
7222-
resolved "https://registry.yarnpkg.com/document-register-element/-/document-register-element-1.14.10.tgz#a7bd025e6b73bd827fec2d8e90aba755e99387f5"
7223-
integrity sha512-w5UA37hEIrs+9pruo2yR5UD13c4UHDlkqqjt4qurnp7QsBI9b1IOi8WXUim+aCqKBsENX3Z/cso7XMOuwJH1Yw==
7224-
72257215
dom-serialize@^2.2.1:
72267216
version "2.2.1"
72277217
resolved "https://registry.yarnpkg.com/dom-serialize/-/dom-serialize-2.2.1.tgz#562ae8999f44be5ea3076f5419dcd59eb43ac95b"

0 commit comments

Comments
 (0)