@domql/render
Advanced tools
Comparing version 2.5.51 to 2.5.61
13
cache.js
'use strict' | ||
import { report } from '@domql/report' | ||
import { canRender } from '@domql/event' | ||
import { canRenderTag } from '@domql/event' | ||
import { exec, isObject, isString, isValidHtmlTag } from '@domql/utils' | ||
@@ -35,7 +35,8 @@ | ||
if (isString(tag)) { | ||
const tagExists = isValidHtmlTag(tag) | ||
if (tagExists) return tag | ||
if (isValidHtmlTag(tag)) return tag | ||
} else { | ||
const isKeyATag = isValidHtmlTag(key) | ||
if (isKeyATag) return key | ||
let keyAsTag = key.toLowerCase() | ||
if (keyAsTag.includes('.')) keyAsTag = keyAsTag.split('.')[0] | ||
if (keyAsTag.includes('_')) keyAsTag = keyAsTag.split('_')[0] | ||
if (isValidHtmlTag(keyAsTag)) return keyAsTag | ||
} | ||
@@ -49,3 +50,3 @@ | ||
if (!canRender(element)) { | ||
if (!canRenderTag(tag)) { | ||
return report('HTMLInvalidTag', element.tag, element) | ||
@@ -52,0 +53,0 @@ } |
@@ -56,9 +56,12 @@ "use strict"; | ||
if ((0, import_utils.isString)(tag)) { | ||
const tagExists = (0, import_utils.isValidHtmlTag)(tag); | ||
if (tagExists) | ||
if ((0, import_utils.isValidHtmlTag)(tag)) | ||
return tag; | ||
} else { | ||
const isKeyATag = (0, import_utils.isValidHtmlTag)(key); | ||
if (isKeyATag) | ||
return key; | ||
let keyAsTag = key.toLowerCase(); | ||
if (keyAsTag.includes(".")) | ||
keyAsTag = keyAsTag.split(".")[0]; | ||
if (keyAsTag.includes("_")) | ||
keyAsTag = keyAsTag.split("_")[0]; | ||
if ((0, import_utils.isValidHtmlTag)(keyAsTag)) | ||
return keyAsTag; | ||
} | ||
@@ -69,3 +72,3 @@ return "div"; | ||
const tag = element.tag = detectTag(element); | ||
if (!(0, import_event.canRender)(element)) { | ||
if (!(0, import_event.canRenderTag)(tag)) { | ||
return (0, import_report.report)("HTMLInvalidTag", element.tag, element); | ||
@@ -72,0 +75,0 @@ } |
{ | ||
"name": "@domql/render", | ||
"version": "2.5.51", | ||
"version": "2.5.61", | ||
"license": "MIT", | ||
@@ -31,3 +31,3 @@ "type": "module", | ||
}, | ||
"gitHead": "75eb8c4728c904ec9f050a2eb9816502196caef9" | ||
"gitHead": "c6aea56536fc17cf5176fed238cf77da99965ed8" | ||
} |
11992
270