diff options
-rw-r--r-- | src/util/html.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/util/html.js b/src/util/html.js index f340f9ef..5f4d92c3 100644 --- a/src/util/html.js +++ b/src/util/html.js @@ -1548,14 +1548,16 @@ export class Template { return true; } - if ('validate' in description) { + if (Object.hasOwn(description, 'validate')) { description.validate({ ...commonValidators, ...validators, })(value); + + return true; } - if ('type' in description) { + if (Object.hasOwn(description, 'type')) { switch (description.type) { case 'html': { return isHTML(value); @@ -1566,14 +1568,14 @@ export class Template { } case 'string': { + if (typeof value === 'string') + return true; + // Tags and templates are valid in string arguments - they'll be // stringified when exposed to the description's .content() function. if (value instanceof Tag || value instanceof Template) return true; - if (typeof value !== 'string') - throw new TypeError(`Slot expects string, got ${typeof value}`); - return true; } |