File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -160,15 +160,19 @@ function replaceDetailSections() {
160160
161161 // move all children of the detail tag to the new section tag, except the <summary> tag
162162 const children = Array . from ( detailTag . children ) ;
163- children . forEach ( function ( child ) {
164- if ( child . tagName . toLocaleUpperCase ( ) === "SUMMARY" ) {
165- return ;
166- }
167- // only add the child if it has content
168- if ( child . innerHTML . trim ( ) ) {
169- sectionTag . appendChild ( child ) ;
170- }
171- } ) ;
163+ if ( children . length > 0 ) {
164+ children . forEach ( function ( child ) {
165+ if ( child . tagName . toLocaleUpperCase ( ) === "SUMMARY" ) {
166+ return ;
167+ }
168+ // only add the child if it has content
169+ if ( child . innerHTML . trim ( ) ) {
170+ sectionTag . appendChild ( child ) ;
171+ }
172+ } ) ;
173+ } else {
174+ sectionTag . innerHTML = detailTag . innerHTML ;
175+ }
172176
173177 // remove the detail tag
174178 detailTag . parentNode . removeChild ( detailTag ) ;
You can’t perform that action at this time.
0 commit comments