@srfnstack/fntags 0.3.7 → 0.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/fntags.mjs +12 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@srfnstack/fntags",
3
- "version": "0.3.7",
3
+ "version": "0.3.8",
4
4
  "author": "Robert Kempton <r@snow87.com>",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/srfnstack/fntags",
package/src/fntags.mjs CHANGED
@@ -29,9 +29,21 @@ export function h (tag, ...children) {
29
29
  if (isAttrs(children[firstChildIdx])) {
30
30
  const attrs = children[firstChildIdx]
31
31
  firstChildIdx += 1
32
+ let hasValue = false
32
33
  for (const a in attrs) {
34
+ // set value last to ensure value constraints are set before trying to set the value to avoid modification
35
+ // For example, when using a range and specifying a min and max
36
+ // if the value is set first and is outside the default 1 to 100 range
37
+ // the value will be adjusted to be within the range, even though the value attribute will be set correctly
38
+ if (a === 'value') {
39
+ hasValue = true
40
+ continue
41
+ }
33
42
  setAttribute(a, attrs[a], element)
34
43
  }
44
+ if (hasValue) {
45
+ setAttribute('value', attrs.value, element)
46
+ }
35
47
  }
36
48
  for (let i = firstChildIdx; i < children.length; i++) {
37
49
  const child = children[i]