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

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

Merged
merged 3 commits into from
Aug 26, 2019
Merged

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

merged 3 commits into from
Aug 26, 2019

Conversation

rigor789
Copy link
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
@@ -743,7 +743,7 @@ export function parseSimpleIdentifierSelector(text: string, start: number = 0):
}
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
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
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