highlight: to much simplification #169

This commit is contained in:
Sören Weber 2023-06-21 22:27:33 +02:00
parent 90db4823dc
commit 73fdfb5ea6
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D

View file

@ -557,11 +557,12 @@ function initCodeClipboard(){
code.parentNode.classList.add( 'pre-code' ); code.parentNode.classList.add( 'pre-code' );
} }
else{ else{
var parent = code.parentNode; var clone = code.cloneNode( true );
var span = document.createElement( 'span' ); var span = document.createElement( 'span' );
span.classList.add( 'copy-to-clipboard' ); span.classList.add( 'copy-to-clipboard' );
span.appendChild( code ); span.appendChild( clone );
parent.appendChild( span ); code.parentNode.replaceChild( span, code );
code = clone;
} }
var button = document.createElement( 'span' ); var button = document.createElement( 'span' );
button.classList.add( 'copy-to-clipboard-button' ); button.classList.add( 'copy-to-clipboard-button' );