-
-
Notifications
You must be signed in to change notification settings - Fork 96
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
Prefer attribute style selector when an id starts with a digit #69
base: master
Are you sure you want to change the base?
Prefer attribute style selector when an id starts with a digit #69
Conversation
@@ -356,6 +357,7 @@ function cssesc(string: string, opt: Partial<typeof defaultOptions> = {}) { | |||
} | |||
const quote = options.quotes == 'double' ? '"' : '\'' | |||
const isIdentifier = options.isIdentifier | |||
const isId = options.isId |
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.
isId and isIdentifier seems to be very same. Let's rename on or another.
@@ -188,7 +188,7 @@ function id(input: Element): Knot | null { | |||
const elementId = input.getAttribute('id') | |||
if (elementId && config.idName(elementId)) { | |||
return { | |||
name: '#' + cssesc(elementId, {isIdentifier: true}), | |||
name: cssesc(elementId, {isIdentifier: true, isId: true}), |
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.
Also let's add some test for this case.
Any movement on this? Still a big problem almost a year later |
Any volunteers to refactor this pr? |
I really don't know what was meant by I don't see the problem with having them both. |
This is a quick attempt at #67
Apologies I haven't been able to run test cases on my local machine so this might be all worthless.
(can't run tests due to microsoft/TypeScript#51567 )