Skip to content

Normalize Whitespace: Removed unnecessary checks#3017

Merged
RunDevelopment merged 1 commit intoPrismJS:masterfrom
RunDevelopment:issue3016
Aug 2, 2021
Merged

Normalize Whitespace: Removed unnecessary checks#3017
RunDevelopment merged 1 commit intoPrismJS:masterfrom
RunDevelopment:issue3016

Conversation

@RunDevelopment
Copy link
Copy Markdown
Member

This resolves #3016.

The typeof document === 'undefined' was unnecessary. The plugin does interact with the DOM but only in the before-sanity-check hook which is run inside highlightElement which is given a DOM element. So the plugin only tries to interact with the DOM if it is given a DOM element. Therefore, the check is unnecessary.

I also removed a duplicate typeof Prism === 'undefined' check. No idea why that was there.

@github-actions
Copy link
Copy Markdown

JS File Size Changes (gzipped)

A total of 1 files have changed, with a combined diff of -16 B (-1.5%).

Details
file master pull size diff % diff
plugins/normalize-whitespace/prism-normalize-whitespace.min.js 1.1 KB 1.08 KB -16 B -1.5%

Generated by 🚫 dangerJS against 877af6e

@RunDevelopment RunDevelopment merged commit 63edf14 into PrismJS:master Aug 2, 2021
@RunDevelopment RunDevelopment deleted the issue3016 branch August 2, 2021 14:38
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.

Unable to require the normalize-whitespace plugin in node

2 participants