Skip to content

Commit

Permalink
Manual merge of #988. Closes #988, fixes #987.
Browse files Browse the repository at this point in the history
  • Loading branch information
Golmote committed Jul 3, 2016
1 parent 268d01e commit c9bdcd3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion components/prism-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,11 @@ if (script) {

if (document.addEventListener && !script.hasAttribute('data-manual')) {
if(document.readyState !== "loading") {
requestAnimationFrame(_.highlightAll, 0);
if (window.requestAnimationFrame) {
window.requestAnimationFrame(_.highlightAll);
} else {
window.setTimeout(_.highlightAll, 16);
}
}
else {
document.addEventListener('DOMContentLoaded', _.highlightAll);
Expand Down
2 changes: 1 addition & 1 deletion components/prism-core.min.js

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

6 changes: 5 additions & 1 deletion prism.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,11 @@ if (script) {

if (document.addEventListener && !script.hasAttribute('data-manual')) {
if(document.readyState !== "loading") {
requestAnimationFrame(_.highlightAll, 0);
if (window.requestAnimationFrame) {
window.requestAnimationFrame(_.highlightAll);
} else {
window.setTimeout(_.highlightAll, 16);
}
}
else {
document.addEventListener('DOMContentLoaded', _.highlightAll);
Expand Down

1 comment on commit c9bdcd3

@LeaVerou
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather we kept polyfills separate so we can remove them easily when it's time. In addition, in this case it might have been better to just tell the person with the problem to include a polyfill than to modify Prism's source.

Please sign in to comment.