avoid errors in old ie from code highlighting
This commit is contained in:
parent
78c4bf420e
commit
f210e7b1b5
|
@ -1,16 +1,22 @@
|
||||||
// START CUSTOM REVEAL.JS INTEGRATION
|
// START CUSTOM REVEAL.JS INTEGRATION
|
||||||
(function() {
|
(function() {
|
||||||
[].slice.call( document.querySelectorAll( 'pre code' ) ).forEach( function( element ) {
|
if( typeof window.addEventListener === 'function' ) {
|
||||||
// trim whitespace if data-trim attribute is present
|
var hljs_nodes = document.querySelectorAll( 'pre code' );
|
||||||
if( element.hasAttribute( 'data-trim' ) && typeof element.innerHTML.trim === 'function' ) {
|
|
||||||
element.innerHTML = element.innerHTML.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
// re-highlight when focus is lost (for edited code)
|
for( var i = 0, len = hljs_nodes.length; i < len; i++ ) {
|
||||||
element.addEventListener( 'focusout', function( event ) {
|
var element = hljs_nodes[i];
|
||||||
hljs.highlightBlock( event.currentTarget );
|
|
||||||
}, false );
|
// trim whitespace if data-trim attribute is present
|
||||||
} );
|
if( element.hasAttribute( 'data-trim' ) && typeof element.innerHTML.trim === 'function' ) {
|
||||||
|
element.innerHTML = element.innerHTML.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
// re-highlight when focus is lost (for edited code)
|
||||||
|
element.addEventListener( 'focusout', function( event ) {
|
||||||
|
hljs.highlightBlock( event.currentTarget );
|
||||||
|
}, false );
|
||||||
|
}
|
||||||
|
}
|
||||||
})();
|
})();
|
||||||
// END CUSTOM REVEAL.JS INTEGRATION
|
// END CUSTOM REVEAL.JS INTEGRATION
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue