Fix error when passing undefined
into tag generator
This commit is contained in:
parent
b476b8651e
commit
f79e7a9c14
2 changed files with 4 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "skooma",
|
"name": "skooma",
|
||||||
"version": "1.6.0",
|
"version": "1.6.1",
|
||||||
"author": "darkwiiplayer",
|
"author": "darkwiiplayer",
|
||||||
"license": "Unlicense",
|
"license": "Unlicense",
|
||||||
"main": "skooma.js",
|
"main": "skooma.js",
|
||||||
|
|
|
@ -49,6 +49,8 @@ const getCustom = args => args.reduce(
|
||||||
,undefined
|
,undefined
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const isElement = object => HTMLElement.prototype.isPrototypeOf(object)
|
||||||
|
|
||||||
const isReactive = object => object
|
const isReactive = object => object
|
||||||
&& (typeof object == "object")
|
&& (typeof object == "object")
|
||||||
&& ("addEventListener" in object)
|
&& ("addEventListener" in object)
|
||||||
|
@ -57,7 +59,7 @@ const isReactive = object => object
|
||||||
const toChild = arg => {
|
const toChild = arg => {
|
||||||
if (typeof arg == "string" || typeof arg == "number") {
|
if (typeof arg == "string" || typeof arg == "number") {
|
||||||
return document.createTextNode(arg)
|
return document.createTextNode(arg)
|
||||||
} else if ("nodeName" in arg) {
|
} else if (isElement(arg)) {
|
||||||
return arg
|
return arg
|
||||||
} else if (isReactive(arg)) {
|
} else if (isReactive(arg)) {
|
||||||
return reactiveChild(arg)
|
return reactiveChild(arg)
|
||||||
|
|
Loading…
Reference in a new issue