diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/util/html.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/util/html.js b/src/util/html.js index a21d373f..85464b72 100644 --- a/src/util/html.js +++ b/src/util/html.js @@ -329,7 +329,7 @@ export function metatag(identifier, ...args) { return new Tag(null, {[chunkwrap]: true, ...opts}, content); case 'imaginary-sibling': - return new Tag(null, {[imaginarySibling]: true}); + return new Tag(null, {[imaginarySibling]: true}, content); default: throw new Error(`Unknown metatag "${identifier}"`); @@ -413,6 +413,10 @@ export class Tag { throw new Error(`Tag <${this.tagName}> is self-closing but got content`); } + if (this.imaginarySibling && contentful) { + throw new Error(`html.metatag('imaginary-sibling') can't have content`); + } + const contentArray = (Array.isArray(value) ? value.flat(Infinity).filter(Boolean) @@ -572,6 +576,12 @@ export class Tag { set imaginarySibling(value) { this.#setAttributeFlag(imaginarySibling, value); + + try { + this.content = this.content; + } catch (error) { + this.#setAttributeFlag(imaginarySibling, false); + } } get imaginarySibling() { |