atlassian-labs / compiled

A familiar and performant compile time CSS-in-JS library for React.
https://compiledcssinjs.com
Apache License 2.0
1.98k stars 68 forks source link

Replace increase specificity selector as JSDOM breaks with `#\\9`. #1661

Closed kylorhall-atlassian closed 4 months ago

kylorhall-atlassian commented 4 months ago

Without this, jsdom (via nswapi) throws an error: SyntaxError: \8 and \9 are not allowed in strict mode.

Refer to https://github.com/dperini/nwsapi/issues/92 for the problem statement and background.

We're instead using what stylex uses for specificity as it appears to work fine with the conflicting jsdom config we encountered: https://github.com/facebook/stylex/blob/c9216385d40c53612848040ab4d96ff133304203/packages/stylex/src/StyleXSheet.js#L352C16-L352C28

-._u5f3ftgi:not(#\\9){padding-right:8px}
+._u5f3ftgi:not(#\\#){padding-right:8px}

Additionally, I realize the direction of adding the increasedSpecificity selector when using a target option was incorrect.

changeset-bot[bot] commented 4 months ago

🦋 Changeset detected

Latest commit: 79c3847856d8ab34fb7595ec9da3ee9d05c8c733

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages | Name | Type | | ------------------------------------ | ----- | | @compiled/utils | Minor | | @compiled/jest | Patch | | @compiled/css | Minor | | @compiled/babel-plugin-strip-runtime | Patch | | @compiled/babel-plugin | Patch | | @compiled/codemods | Patch | | @compiled/eslint-plugin | Patch | | @compiled/parcel-optimizer | Patch | | @compiled/parcel-transformer | Patch | | @compiled/webpack-loader | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR