diff --git a/package.json b/package.json index 70015d4..2f8d30c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wkit", - "version": "1.11.3", + "version": "1.11.4", "type": "module", "description": "A library for building fast, lightweight web components.", "main": "dist/index.js", diff --git a/src/constants.js b/src/constants.js index 0ea5289..3dcafc4 100644 --- a/src/constants.js +++ b/src/constants.js @@ -83,16 +83,14 @@ function getType(v) { let type = String let attribute = true if (v.includes('!')) { - v = v.split('!') - let _t = v.shift() - if (_t === 'str') { - v = v.join('!') - } else if (_t === 'num') { + if (v.startsWith('str!')) { + v = v.slice(4) + } else if (v.startsWith('num!')) { type = Number - v = +v.shift() || 0 - } else if (_t === 'bool') { + v = +v.slice(4) || 0 + } else if (v.startsWith('bool!')) { type = Boolean - v = v.shift() + v = v.slice(5) v = v !== 'false' && v !== '' } attribute = false