@@ -630,13 +630,6 @@ export function run(conf) {
630
630
) ;
631
631
}
632
632
633
- if ( conf . isTagFinding && ! conf . additionalContent ) {
634
- pub (
635
- "warn" ,
636
- "ReSpec does not support automated SotD generation for TAG findings, " +
637
- "please add the prerequisite content in the 'sotd' section"
638
- ) ;
639
- }
640
633
// Requested by https://github.com/w3c/respec/issues/504
641
634
// Makes a record of a few auto-generated things.
642
635
pub ( "amend-user-config" , {
@@ -645,25 +638,36 @@ export function run(conf) {
645
638
} ) ;
646
639
}
647
640
641
+ /**
642
+ * @param {* } conf
643
+ * @param {HTMLElement } sotd
644
+ */
648
645
function populateSoTD ( conf , sotd ) {
649
646
const sotdClone = sotd . cloneNode ( true ) ;
650
- const additionalNodes = document . createDocumentFragment ( ) ;
651
- const additionalContent = document . createElement ( "temp" ) ;
647
+ const additionalContent = document . createDocumentFragment ( ) ;
652
648
// we collect everything until we hit a section,
653
649
// that becomes the custom content.
654
650
while ( sotdClone . hasChildNodes ( ) ) {
655
651
if (
656
652
sotdClone . firstChild . nodeType !== Node . ELEMENT_NODE ||
657
653
sotdClone . firstChild . localName !== "section"
658
654
) {
659
- additionalNodes . appendChild ( sotdClone . firstChild ) ;
655
+ additionalContent . appendChild ( sotdClone . firstChild ) ;
660
656
continue ;
661
657
}
662
658
break ;
663
659
}
664
- additionalContent . appendChild ( additionalNodes ) ;
665
- conf . additionalContent = additionalContent . innerHTML ;
666
- // Whatever sections are left, we throw at the end.
667
- conf . additionalSections = sotdClone . innerHTML ;
668
- return ( conf . isCGBG ? cgbgSotdTmpl : sotdTmpl ) ( conf ) ;
660
+ if ( conf . isTagFinding && ! additionalContent . hasChildNodes ( ) ) {
661
+ pub (
662
+ "warn" ,
663
+ "ReSpec does not support automated SotD generation for TAG findings, " +
664
+ "please add the prerequisite content in the 'sotd' section"
665
+ ) ;
666
+ }
667
+ const template = conf . isCGBG ? cgbgSotdTmpl : sotdTmpl ;
668
+ return template ( conf , {
669
+ additionalContent,
670
+ // Whatever sections are left, we throw at the end.
671
+ additionalSections : sotdClone . childNodes ,
672
+ } ) ;
669
673
}
0 commit comments