We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9e9ad40 commit d2eeb0cCopy full SHA for d2eeb0c
src/util/html.js
@@ -401,13 +401,15 @@ export class Tag {
401
}
402
403
set content(value) {
404
- if (
405
- this.selfClosing &&
406
- !(value === null ||
407
- value === undefined ||
408
- !value ||
409
- Array.isArray(value) && value.filter(Boolean).length === 0)
410
- ) {
+ const contentful =
+ value !== null &&
+ value !== undefined &&
+ value &&
+ (Array.isArray(value)
+ ? !empty(value.filter(Boolean))
+ : true);
411
+
412
+ if (this.selfClosing && contentful) {
413
throw new Error(`Tag <${this.tagName}> is self-closing but got content`);
414
415
0 commit comments