Skip to content

Commit 3f4ae00

Browse files
File Highlight: Fixed IE compatibility problem (#2656)
The File Highlight plugin used the `Element#matches` which isn't supported by IE11, so a small polyfill was added.
1 parent deb238a commit 3f4ae00

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

plugins/file-highlight/prism-file-highlight.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
return;
44
}
55

6+
// https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill
7+
if (!Element.prototype.matches) {
8+
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
9+
}
10+
611
var Prism = window.Prism;
712

813
var LOADING_MESSAGE = 'Loading…';

plugins/file-highlight/prism-file-highlight.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

prism.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,6 +1566,11 @@ Prism.languages.js = Prism.languages.javascript;
15661566
return;
15671567
}
15681568

1569+
// https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill
1570+
if (!Element.prototype.matches) {
1571+
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
1572+
}
1573+
15691574
var Prism = window.Prism;
15701575

15711576
var LOADING_MESSAGE = 'Loading…';

0 commit comments

Comments
 (0)