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

Fixed a bug that could cause regexp to issue an error #165

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -608,12 +608,39 @@ test("Save the parent's comment", () => {
run('a { /*i*/ b {} }', 'a { /*i*/ } a b {}')
})

test("Save the parent's comment", () => {
run(
`
div {
/* Comment with ^ $ . | ? * + () */
&[data-roots-all^=1] * #id .class {}
}`,
'/* Comment with ^ $ . | ? * + () */ div[data-roots-all^=1] * #id .class {}')
})

// !
// test("Save the parent's comment with newline", () => {
// run(
// `
// a {
// /*i*/

// /*i2*/
// b {}
// /*i3*/
// s {}
// }`,
// `a { /*i*/ } /*i2*/ a b {} /*i3*/ a s {}`
// )
// })

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this test to see what happens if there are several rules with comments in the description.

The test does not work - it does not connect selectors for the second nested one.
I tried to fix it, but in your code, the devil will break my leg.

Does it make sense to fix it?

test("Save the parent's comment with newline", () => {
run(
`a {
/*i*/

b {} }`,
b {}
}`,
`a { /*i*/ } a b {}`
)
})
Expand Down