Skip to content

Commit

Permalink
Allow any value types in Attributor#add()
Browse files Browse the repository at this point in the history
  • Loading branch information
luin committed Jan 16, 2024
1 parent e05da28 commit a5460d4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/attributor/attributor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ export default class Attributor {
}
}

public add(node: HTMLElement, value: string | number): boolean {
public add(node: HTMLElement, value: any): boolean {
if (!this.canAdd(node, value)) {
return false;
}
node.setAttribute(this.keyName, String(value));
node.setAttribute(this.keyName, value);
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/attributor/class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ClassAttributor extends Attributor {
.map((name) => name.split('-').slice(0, -1).join('-'));
}

public add(node: HTMLElement, value: string | number): boolean {
public add(node: HTMLElement, value: any): boolean {
if (!this.canAdd(node, value)) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/attributor/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class StyleAttributor extends Attributor {
});
}

public add(node: HTMLElement, value: string | number): boolean {
public add(node: HTMLElement, value: any): boolean {
if (!this.canAdd(node, value)) {
return false;
}
Expand Down

0 comments on commit a5460d4

Please sign in to comment.