Skip to content

Commit a6918b6

Browse files
committed
Define __CE_registry as using the polyfilled CustomElementRegistry type, not the built-in type.
1 parent 1daf9e1 commit a6918b6

File tree

4 files changed

+4
-11
lines changed

4 files changed

+4
-11
lines changed

packages/custom-elements/ts_src/CustomElementInternals.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,7 @@ export default class CustomElementInternals {
413413
return;
414414
}
415415

416-
return ((registry as unknown) as CustomElementRegistry).internal_localNameToDefinition(
417-
localName
418-
);
416+
return registry.internal_localNameToDefinition(localName);
419417
}
420418

421419
/**

packages/custom-elements/ts_src/Patch/HTMLElement.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
import AlreadyConstructedMarker from '../AlreadyConstructedMarker.js';
1313
import CustomElementInternals from '../CustomElementInternals.js';
14-
import CustomElementRegistry from '../CustomElementRegistry.js';
1514
import CEState from '../CustomElementState.js';
1615
import * as Native from './Native.js';
1716

@@ -25,9 +24,7 @@ export default function (internals: CustomElementInternals) {
2524

2625
// Always look up the definition from the global registry.
2726
const registry = document.__CE_registry!;
28-
const definition = ((registry as unknown) as CustomElementRegistry).internal_constructorToDefinition(
29-
constructor
30-
);
27+
const definition = registry.internal_constructorToDefinition(constructor);
3128
if (!definition) {
3229
throw new Error(
3330
'Failed to construct a custom element: ' +

packages/custom-elements/ts_src/custom-elements.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function installPolyfill() {
4343
const customElements = new CustomElementRegistry(internals);
4444

4545
// The main document is associated with the global registry.
46-
(document.__CE_registry as unknown) = customElements;
46+
document.__CE_registry = customElements;
4747

4848
Object.defineProperty(window, 'customElements', {
4949
configurable: true,

packages/custom-elements/ts_src/env.d.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
* rights grant found at http://polymer.github.io/PATENTS.txt
1010
*/
1111

12-
// When building externally, this file is always assumed to be a module, but by
13-
// default it isn't when building internally, so we need this export statement.
14-
export {};
12+
import CustomElementRegistry from './CustomElementRegistry.js';
1513

1614
declare global {
1715
interface AlreadyConstructedMarkerType {

0 commit comments

Comments
 (0)