diff --git a/src/controller-registry.js b/src/controller-registry.js index 7b44060..2c45fdf 100644 --- a/src/controller-registry.js +++ b/src/controller-registry.js @@ -126,8 +126,15 @@ export class ControllerRegistry { return this.#defined.get(name) } + #listMap = new WeakMap() list(element) { - return new ControllerList(element, this.#attribute) + if (this.#listMap.has(element)) { + return this.#listMap.get(element) + } else { + const list = new ControllerList(element, this.#attribute) + this.#listMap.set(element, list) + return list + } } getName(controller) {