Skip to content

fix Don't create " in inline CSS attributes#16660

Open
ShreySinha02 wants to merge 5 commits intoprettier:mainfrom
ShreySinha02:issue-16655
Open

fix Don't create " in inline CSS attributes#16660
ShreySinha02 wants to merge 5 commits intoprettier:mainfrom
ShreySinha02:issue-16655

Conversation

@ShreySinha02
Copy link

@ShreySinha02 ShreySinha02 commented Sep 14, 2024

Description

Fix the issue where <div style="font-family: 'Arial';"></div> is converted to <div style="font-family: &quot;Arial&quot;"></div>. The expected result is <div style='font-family: "Arial"'></div>.

Checklist

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory).
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

Try the playground for this PR

@ShreySinha02 ShreySinha02 changed the title fixed Don't create &quot; in inline CSS attributes fix Don't create &quot; in inline CSS attributes Sep 14, 2024

valueDoc = mapDoc(valueDoc, (doc) =>
typeof doc === "string" ? doc.replaceAll('"', "&quot;") : doc,
typeof doc === "string" ? doc.replaceAll('"', '"') : doc,

Check warning

Code scanning / CodeQL

Replacement of a substring with itself

This replaces '"' with itself.
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.

1 participant