From 6f995ef2e2a64db8fdafea1ee0879fbec09b3ef8 Mon Sep 17 00:00:00 2001 From: Chris Wells Date: Tue, 29 Dec 2015 17:44:06 -0500 Subject: [PATCH] Defer File Highlight until the full DOM has loaded. --- plugins/file-highlight/prism-file-highlight.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/file-highlight/prism-file-highlight.js b/plugins/file-highlight/prism-file-highlight.js index 6a2a540635..ba01920f4f 100644 --- a/plugins/file-highlight/prism-file-highlight.js +++ b/plugins/file-highlight/prism-file-highlight.js @@ -71,6 +71,10 @@ }; - self.Prism.fileHighlight(); + if (document.addEventListener) { + document.addEventListener('DOMContentLoaded', self.Prism.fileHighlight); + } else { + self.Prism.fileHighlight(); + } })();