Skip to content

Account for escaped chars in CSS class names#2260

Merged
westonruter merged 1 commit intodevelopfrom
fix/escaped-class-name-chars
May 7, 2019
Merged

Account for escaped chars in CSS class names#2260
westonruter merged 1 commit intodevelopfrom
fix/escaped-class-name-chars

Conversation

@westonruter
Copy link
Copy Markdown
Member

@westonruter westonruter commented May 5, 2019

CSS class names normally just contain alphanumeric characters, in addition to hyphens and underscores. However, they can include other characters as long as they are escaped with a backslash. This PR fixes the tree shaker class name extraction to account for escaped characters.

Fixes #2259.

Build for testing: amp.zip (v1.1.2-alpha-20190506T022223Z-2b70b363)

@westonruter westonruter added this to the v1.1.2 milestone May 5, 2019
@googlebot googlebot added the cla: yes Signed the Google CLA label May 5, 2019
@westonruter
Copy link
Copy Markdown
Member Author

Note that the use of regular expressions should give way to using an actual CSS selector parser in #2102.

@westonruter westonruter force-pushed the fix/escaped-class-name-chars branch from 03cf8d1 to 18b9dc3 Compare May 6, 2019 02:21
@westonruter
Copy link
Copy Markdown
Member Author

Fix confirmed: #2259 (comment)

@westonruter westonruter requested a review from amedina May 7, 2019 18:35
@westonruter westonruter merged commit f2b270a into develop May 7, 2019
@westonruter westonruter deleted the fix/escaped-class-name-chars branch May 7, 2019 21:18
@westonruter
Copy link
Copy Markdown
Member Author

Cherry-picked onto 1.1 branch: f643c21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Signed the Google CLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sanitizer removes CSS that exists

3 participants