Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugins: Consistent Prism check #2788

Merged
merged 2 commits into from
Mar 21, 2021

Conversation

RunDevelopment
Copy link
Member

Here is a fix for something that bugged me for a long time. All of Prism's plugins now use the same check to determine whether Prism is loaded.

The new check is a simple typeof Prism === 'undefined'. The self variable is now completely ignored.

Checks for DOM access are similar: typeof document === 'undefined'.

I also made the formatting of the check consistent with one empty line before and after it.

@github-actions
Copy link

github-actions bot commented Mar 6, 2021

JS File Size Changes (gzipped)

A total of 25 files have changed, with a combined diff of -157 B (-0.7%).

file master pull size diff % diff
plugins/autolinker/prism-autolinker.min.js 617 B 595 B -22 B -3.6%
plugins/autoloader/prism-autoloader.min.js 2.21 KB 2.2 KB -9 B -0.4%
plugins/command-line/prism-command-line.min.js 948 B 944 B -4 B -0.4%
plugins/copy-to-clipboard/prism-copy-to-clipboard.min.js 715 B 711 B -4 B -0.6%
plugins/custom-class/prism-custom-class.min.js 296 B 276 B -20 B -6.8%
plugins/data-uri-highlight/prism-data-uri-highlight.min.js 611 B 590 B -21 B -3.4%
plugins/download-button/prism-download-button.min.js 272 B 267 B -5 B -1.8%
plugins/file-highlight/prism-file-highlight.min.js 944 B 943 B -1 B -0.1%
plugins/filter-highlight-all/prism-filter-highlight-all.min.js 439 B 440 B +1 B +0.2%
plugins/highlight-keywords/prism-highlight-keywords.min.js 145 B 123 B -22 B -15.2%
plugins/inline-color/prism-inline-color.min.js 601 B 595 B -6 B -1.0%
plugins/jsonp-highlight/prism-jsonp-highlight.min.js 1.26 KB 1.26 KB -4 B -0.3%
plugins/keep-markup/prism-keep-markup.min.js 601 B 598 B -3 B -0.5%
plugins/line-highlight/prism-line-highlight.min.js 1.43 KB 1.43 KB -5 B -0.3%
plugins/line-numbers/prism-line-numbers.min.js 1.12 KB 1.11 KB -4 B -0.4%
plugins/match-braces/prism-match-braces.min.js 853 B 848 B -5 B -0.6%
plugins/normalize-whitespace/prism-normalize-whitespace.min.js 1.08 KB 1.1 KB +19 B +1.8%
plugins/previewers/prism-previewers.min.js 2.98 KB 2.98 KB -3 B -0.1%
plugins/remove-initial-line-feed/prism-remove-initial-line-feed.min.js 239 B 238 B -1 B -0.4%
plugins/show-invisibles/prism-show-invisibles.min.js 364 B 344 B -20 B -5.5%
plugins/show-language/prism-show-language.min.js 2.32 KB 2.31 KB -4 B -0.2%
plugins/toolbar/prism-toolbar.min.js 751 B 746 B -5 B -0.7%
plugins/treeview/prism-treeview.min.js 416 B 432 B +16 B +3.8%
plugins/unescaped-markup/prism-unescaped-markup.min.js 514 B 511 B -3 B -0.6%
plugins/wpd/prism-wpd.min.js 1.3 KB 1.28 KB -22 B -1.7%

Generated by 🚫 dangerJS against 1d52591

@RunDevelopment RunDevelopment merged commit 9633564 into PrismJS:master Mar 21, 2021
@RunDevelopment RunDevelopment deleted the plugin-req-check branch March 21, 2021 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant