parent
afac6fddb2
commit
47090149f8
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "wkit",
|
||||
"version": "1.10.14",
|
||||
"version": "1.11.0",
|
||||
"type": "module",
|
||||
"description": "A library for building fast, lightweight web components.",
|
||||
"main": "dist/index.js",
|
||||
|
|
|
@ -101,7 +101,7 @@ function getType(v) {
|
|||
return { type, default: v, attribute }
|
||||
|
||||
default:
|
||||
return { type: String, default: v + '' }
|
||||
return { type: null, default: '' }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,6 +131,10 @@ export function parsePropsDeclaration(options) {
|
|||
options = { type: Array }
|
||||
break
|
||||
|
||||
case String:
|
||||
options = { type: String }
|
||||
break
|
||||
|
||||
default:
|
||||
options = getType(options)
|
||||
break
|
||||
|
@ -174,6 +178,9 @@ export function fixedValue(value, options) {
|
|||
}
|
||||
}
|
||||
|
||||
case null:
|
||||
return value
|
||||
|
||||
default:
|
||||
return value === null || value === void 0 ? null : value + ''
|
||||
}
|
||||
|
|
|
@ -296,7 +296,7 @@ export class Component extends HTMLElement {
|
|||
let options = this.#getPropOptions(name) || {}
|
||||
let attrName = options.attrName
|
||||
|
||||
if (options.attribute === false) {
|
||||
if (options.attribute === false || options.type === null) {
|
||||
this.removeAttribute(attrName)
|
||||
return
|
||||
}
|
||||
|
@ -340,7 +340,7 @@ export class Component extends HTMLElement {
|
|||
if (options) {
|
||||
value = fixedValue(value, options)
|
||||
|
||||
if (options.attribute === false) {
|
||||
if (options.attribute === false || options.type === null) {
|
||||
if (value === null) {
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue