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

Improve extractor for arbitrary values with quotes #4817

Merged
merged 1 commit into from
Jun 26, 2021
Merged

Conversation

adamwathan
Copy link
Member

Fixes #4801.

This PR improves our default extractor regex to handle arbitrary values that are wrapped in quotes more precisely.

Previously, given this input:

<h1 class="<?php echo wrap(['class' => 'max-w-[16rem]']); ?>">Hello world</h1>

...we would find a class named max-w-[16rem]']. This PR makes sure we find max-w-[16rem] instead, while preserving the ability to match things like content-['hello'] and even content-[']'].

We don't match this properly yet: content-['hello[]'], but we also didn't before this PR, so this is still purely an improvement over what was there before.

Since the regex is getting long, I've also broken it up into 4 parts with a few comments for each piece to explain what it's for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JIT includes quotes in class names when classes are followed by ' and ] characters
1 participant