File tree 1 file changed +11
-1
lines changed
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -329,7 +329,7 @@ export function metatag(identifier, ...args) {
329
329
return new Tag ( null , { [ chunkwrap ] : true , ...opts } , content ) ;
330
330
331
331
case 'imaginary-sibling' :
332
- return new Tag ( null , { [ imaginarySibling ] : true } ) ;
332
+ return new Tag ( null , { [ imaginarySibling ] : true } , content ) ;
333
333
334
334
default :
335
335
throw new Error ( `Unknown metatag "${ identifier } "` ) ;
@@ -413,6 +413,10 @@ export class Tag {
413
413
throw new Error ( `Tag <${ this . tagName } > is self-closing but got content` ) ;
414
414
}
415
415
416
+ if ( this . imaginarySibling && contentful ) {
417
+ throw new Error ( `html.metatag('imaginary-sibling') can't have content` ) ;
418
+ }
419
+
416
420
const contentArray =
417
421
( Array . isArray ( value )
418
422
? value . flat ( Infinity ) . filter ( Boolean )
@@ -572,6 +576,12 @@ export class Tag {
572
576
573
577
set imaginarySibling ( value ) {
574
578
this . #setAttributeFlag( imaginarySibling , value ) ;
579
+
580
+ try {
581
+ this . content = this . content ;
582
+ } catch ( error ) {
583
+ this . #setAttributeFlag( imaginarySibling , false ) ;
584
+ }
575
585
}
576
586
577
587
get imaginarySibling ( ) {
You can’t perform that action at this time.
0 commit comments