Skip to content

Commit 85463db

Browse files
committed
move error
1 parent 423d443 commit 85463db

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/dom/src/CustomAttribute.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ export class CustomAttribute<E extends Element = Element> {
2828
}
2929

3030
constructor(ownerElement: E, name: string, value: string) {
31-
if (!name.includes('-')) throw new Error(`Custom attribute '${name}' must include a hyphen.`);
32-
3331
this.#name = name;
3432
this.#value = value;
3533
this.#ownerElement = ownerElement;
@@ -135,6 +133,8 @@ export class CustomAttributeRegistry {
135133
}
136134

137135
define(attrName: string, Class: typeof CustomAttribute) {
136+
if (!attrName.includes('-')) throw new Error(`Custom attribute '${name}' must include a hyphen.`);
137+
138138
this.#attrMap.set(attrName, Class);
139139
this.#upgradeAttr(attrName);
140140
this.#observer.disconnect();

0 commit comments

Comments
 (0)