Skip to content

Commit

Permalink
createNumberAttribute(name, initial, min, max, parse)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephband committed Oct 20, 2024
1 parent 1035020 commit 690e082
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/element/create-attribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function createProperty(name, initial, parse = id) {
export function createAttributeProperty(name, initial, parse = id) {
return assign(createProperty(name, initial, parse), {
attribute: function(value) {
this[name] = value === null ? undefined : value ;
this[name] = value === null ? undefined : value.trim() ;
}
});
}
Expand All @@ -68,8 +68,8 @@ export function createStringAttribute(name, parse = id) {
});
}

export function createNumberAttribute(name, min, max, parse = id) {
return createAttrProp(name, 0, (value) => {
export function createNumberAttribute(name, initial, min, max, parse = id) {
return createAttrProp(name, initial, (value) => {
const number = parse(value);

if (Number.isNaN(number)) {
Expand Down

0 comments on commit 690e082

Please sign in to comment.