Skip to content

Commit

Permalink
File Highlight: Fixed IE compatibility problem (#2656)
Browse files Browse the repository at this point in the history
The File Highlight plugin used the `Element#matches` which isn't supported by IE11, so a small polyfill was added.
  • Loading branch information
dreammaster82 committed Nov 24, 2020
1 parent deb238a commit 3f4ae00
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions plugins/file-highlight/prism-file-highlight.js
Expand Up @@ -3,6 +3,11 @@
return;
}

// https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill
if (!Element.prototype.matches) {
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
}

var Prism = window.Prism;

var LOADING_MESSAGE = 'Loading…';
Expand Down
2 changes: 1 addition & 1 deletion plugins/file-highlight/prism-file-highlight.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions prism.js
Expand Up @@ -1566,6 +1566,11 @@ Prism.languages.js = Prism.languages.javascript;
return;
}

// https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill
if (!Element.prototype.matches) {
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
}

var Prism = window.Prism;

var LOADING_MESSAGE = 'Loading…';
Expand Down

0 comments on commit 3f4ae00

Please sign in to comment.