Skip to content

Commit 612635a

Browse files
$.fn.attr: doing nothing when the value equals undefined
Closes #277
1 parent 3160d8a commit 612635a

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/attributes/attr.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ function attr ( this: Cash, attr?: string | plainObject, value?: string ) {
3131

3232
}
3333

34+
if ( value === undefined ) return this;
35+
3436
if ( value === null ) return this.removeAttr ( attr );
3537

3638
return this.each ( ( i, ele ) => { ele.setAttribute ( attr, value ) } );

0 commit comments

Comments
 (0)