Skip to content

Commit

Permalink
Use document.currentScript instead of
Browse files Browse the repository at this point in the history
document.getElementsByTagName()
  • Loading branch information
zeitgeist87 committed Jan 26, 2016
1 parent 6ba9183 commit fa98743
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions components/prism-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,8 @@ if (!_self.document) {
return _self.Prism;
}

// Get current script and highlight
var script = document.getElementsByTagName('script');

script = script[script.length - 1];
//Get current script and highlight
var script = document.currentScript || [].slice.call(document.getElementsByTagName("script")).pop();

if (script) {
_.filename = script.src;
Expand Down

0 comments on commit fa98743

Please sign in to comment.