-
Notifications
You must be signed in to change notification settings - Fork 169
Shady Parts: Parsing and formatting functions #326
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
Conversation
dee6d36
to
671373b
Compare
inner = split[0]; | ||
outer = split[1]; | ||
} else { | ||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When will this happen? If the string is poorly formatted? Add comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, if there are >2 colons. Matches Chrome native behavior. Comment added.
* parsePartSelector for description of pieces. | ||
* [0 ][1 ][2 ] [3 ] [4 ] | ||
*/ | ||
const PART_REGEX = /(.*?)([a-z]+-\w+)([^\s]*?)::part\((.*)?\)(::.*)?/; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pseudo-classes are written with a single :
so this regex won't catch them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah, oops. Need to match both pseudo-classes and pseudo-elements, so now it matches ::?
.
test("all components", () => { | ||
assert.deepEqual( | ||
shadowParts.parsePartSelector( | ||
"#parent > my-button.fancy::part(foo bar)::hover" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pseudo-classes like hover
are written with a single :
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Start with some the parsing and formatting functions for shadow parts support in ShadyCSS.
(Note this is merging into the
shady-parts
branch, notmaster
).See #306 for design.
Part of #252 and #311.