diff options
Diffstat (limited to 'src/util/html.js')
-rw-r--r-- | src/util/html.js | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/util/html.js b/src/util/html.js index 35703d4a..a21d373f 100644 --- a/src/util/html.js +++ b/src/util/html.js @@ -401,13 +401,15 @@ export class Tag { } set content(value) { - if ( - this.selfClosing && - !(value === null || - value === undefined || - !value || - Array.isArray(value) && value.filter(Boolean).length === 0) - ) { + const contentful = + value !== null && + value !== undefined && + value && + (Array.isArray(value) + ? !empty(value.filter(Boolean)) + : true); + + if (this.selfClosing && contentful) { throw new Error(`Tag <${this.tagName}> is self-closing but got content`); } |