File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -378,6 +378,10 @@ function convert(infile, outfile) {
378378
379379 for ( const code of document . querySelectorAll ( 'pre > code' ) ) {
380380 const pre = code . parentNode ;
381+ if ( pre . firstChild !== code || pre . lastChild !== code ) {
382+ console . warn ( 'Skipping a <pre><code> with sibling nodes: ' + pre . outerHTML ) ;
383+ continue ;
384+ }
381385 if ( code . hasAttribute ( 'class' ) ) {
382386 switch ( code . className ) {
383387 case 'idl' :
@@ -395,15 +399,11 @@ function convert(infile, outfile) {
395399 default :
396400 console . warn ( 'Unhandled <pre><code> class:' , code . className ) ;
397401 }
398- code . removeAttribute ( 'class' ) ;
399- }
400- if ( code . getAttribute ( kCrossRefAttribute ) === '' ) {
401- code . removeAttribute ( kCrossRefAttribute ) ;
402- }
403- if ( code . hasAttributes ( ) ) {
404- console . warn ( 'Discarding <code> attributes:' , code . outerHTML ) ;
405402 }
406- replaceWithChildren ( code ) ;
403+ // Strip any markup in the code.
404+ // TODO: Indent as much as the <pre> element is indented. This is the
405+ // style in other WHATWG specs using Bikeshed.
406+ pre . textContent = '\n' + pre . textContent . trim ( ) + '\n' ;
407407 }
408408
409409 // Link <code> to the right thing.
You can’t perform that action at this time.
0 commit comments