Skip to content

Commit

Permalink
fix: should remove attribute when attr-value is nil
Browse files Browse the repository at this point in the history
  • Loading branch information
bubkoo committed Feb 27, 2020
1 parent c3cb92d commit 5da0e77
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/x6/src/v/attr.ts
Expand Up @@ -39,7 +39,7 @@ export function setAttribute(

export function setAttributes(
elem: Element,
attrs: { [attr: string]: string | number | null },
attrs: { [attr: string]: string | number | null | undefined },
) {
Object.keys(attrs).forEach(name => {
setAttribute(elem, name, attrs[name])
Expand All @@ -50,17 +50,17 @@ export function attr(elem: Element): { [attr: string]: string }
export function attr(elem: Element, name: string): string
export function attr(
elem: Element,
attrs: { [attr: string]: string | number | null },
attrs: { [attr: string]: string | number | null | undefined },
): void
export function attr(
elem: Element,
name: string,
value: string | number | null,
value: string | number | null | undefined,
): void
export function attr(
elem: Element,
name?: string | { [attr: string]: string | number | null },
value?: string | number | null,
name?: string | { [attr: string]: string | number | null | undefined },
value?: string | number | null | undefined,
) {
if (name == null) {
const attrs = elem.attributes
Expand Down

0 comments on commit 5da0e77

Please sign in to comment.