File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change 11
22const  loadCopyButton  =  ( )  =>  { 
3-     /* Add a [>>>] button on  the top-right corner of code samples to hide 
3+     /* Add a [>>>] button in  the top-right corner of code samples to hide 
44     * the >>> and ... prompts and the output and thus make the code 
55     * copyable. */ 
66    const  hide_text  =  'Hide the prompts and output' 
@@ -19,6 +19,8 @@ const loadCopyButton = () => {
1919        if  ( buttonEl . dataset . hidden  ===  'false' )  { 
2020            // hide the code output 
2121            codeEl . querySelectorAll ( '.go, .gp, .gt' ) . forEach ( el  =>  el . hidden  =  true ) 
22+             // tracebacks (.gt) contain bare text elements that need to be 
23+             // wrapped in a span to hide or show the element 
2224            codeEl . querySelectorAll ( '.gt' ) . forEach ( el  =>  { 
2325                while  ( ( el  =  el . nextSibling )  &&  el . nodeType  !==  Node . DOCUMENT_NODE )  { 
2426                    if  ( el . nodeType  ===  Node . ELEMENT_NODE  &&  el . matches ( ".gp, .go" ) )  { 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments