Skip to content

fix(css): parse css selectors with escape sequences#7689

Merged
manoldonev merged 3 commits intoNativeScript:masterfrom
rigor789:fix-7688
Aug 26, 2019
Merged

fix(css): parse css selectors with escape sequences#7689
manoldonev merged 3 commits intoNativeScript:masterfrom
rigor789:fix-7688

Conversation

@rigor789
Copy link
Copy Markdown
Member

PR Checklist

What is the current behavior?

#7688

What is the new behavior?

With the changes, the escaped css selectors are parsed correctly and can be applied to elements.

Fixes/Implements/Closes #7688.

@cla-bot cla-bot bot added the cla: yes label Aug 17, 2019
const end = simpleIdentifierSelectorRegEx.lastIndex;
const type = <"#" | "." | ":" | "">result[1];
const identifier: string = result[2];
const identifier: string = result[2].replace(/\\/g, '');

This comment was marked as abuse.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@NathanaelA Unfortunately not!

For example, if the input is

.w-6\/12 {
  width: 50%
}

The parser receives both the \ backslash and the / forward slash. If the regex doesn't match the \ anything after it gets ignored, including the /12 part, so we actually need to allow it, but later remove it, since it is just an escape character.

I don't think it's possible to capture a group with skipping characters in the middle.

This comment was marked as abuse.

@manoldonev
Copy link
Copy Markdown
Contributor

test

@manoldonev manoldonev self-assigned this Aug 23, 2019
@manoldonev manoldonev changed the title fix(CSS): correctly parse CSS selectors with escape sequences (fixes #7688) fix(css): parse css selectors with escape sequences Aug 26, 2019
@manoldonev manoldonev merged commit 5520213 into NativeScript:master Aug 26, 2019
manoldonev added a commit that referenced this pull request Sep 12, 2019
* feat(android): fix tab resource icon size based on spec (#7737)

* feat(ios): add icon rendering mode for bottom navigation (#7738)

* fix(ios-tabs): crash when add tabstrip in loaded event (#7743)

* fix(css): parse css selectors with escape sequences (#7689) (#7732)

* fix(ios-tabs): handle nesting proxy view container (#7755)

* fix-next(css): className to preserve root views classes (#7725)

* docs: cut the 6.1.0 release (#7773)

* fix(android-list-picker): NoSuchFieldException on api29 (#7790)

* chore: hardcode tslib version to 1.10.0 (#7776)

* fix(css-calc): reduce_css_calc_1.default is not a function (#7787) (#7801)
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.

CSS selectors don't support escape sequence

4 participants