Skip to content

Commit a9ca7e3

Browse files
committed
perf: check presence of sidechannel only once
1 parent 18ce995 commit a9ca7e3

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

core/pfe-core/controllers/internals-controller.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,22 @@ import {
44
type ReactiveControllerHost,
55
} from 'lit';
66

7-
function isARIAMixinProp(key: string): key is keyof ARIAMixin {
8-
return key === 'role' || key.startsWith('aria');
9-
}
10-
117
type FACE = HTMLElement & {
128
formDisabledCallback?(disabled: boolean): void;
139
};
1410

11+
interface InternalsControllerOptions extends Partial<ARIAMixin> {
12+
getHTMLElement?(): HTMLElement;
13+
}
14+
1515
const protos = new WeakMap();
1616

1717
let constructingAllowed = false;
1818

19-
interface InternalsControllerOptions extends Partial<ARIAMixin> {
20-
getHTMLElement?(): HTMLElement;
19+
globalThis._elementInternals ??= new WeakMap<Element, ElementInternals>();
20+
21+
function isARIAMixinProp(key: string): key is keyof ARIAMixin {
22+
return key === 'role' || key.startsWith('aria');
2123
}
2224

2325
/**
@@ -264,7 +266,6 @@ export class InternalsController implements ReactiveController, ARIAMixin {
264266
InternalsController.instances.set(host, this);
265267
this.#polyfillDisabledPseudo();
266268
// Expose internals to aXe Core
267-
globalThis._elementInternals ??= new WeakMap<Element, ElementInternals>();
268269
globalThis._elementInternals.set(this.host, this.internals);
269270
}
270271

0 commit comments

Comments
 (0)