Closed geddski closed 8 years ago
Hi Dave, yes that's correct. This calculator does not currently support escaped characters.
Out of interest, do you really use square brackets in classnames?
@keeganstreet yep, I'm about to release a new CSS method similar to OOCSS/BEM that relies on escaped characters heavily. Your tool doesn't seem to mind other cases like .\--awesome
, just the brackets. As for my use case, I'm using this project in my unit tests for my framework. Pretty slick little project, nicely done.
Aren't you worried the classnames will be difficult to select with jQuery or the Selector API? Or is the idea that they are used exclusively in CSS, not JavaScript?
nah it isn't bad. with querySelectorAll you do have to escape the special chars.
document.querySelectorAll('.--cool');
getElementByClassName handles them unchanged
This could be tricky to implement without introducing regression defects.
Some example selectors with unicode escape sequences below.
.\3A \`\( { } /* matches elements with class=":`(" */
.\31 a2b3c { } /* matches elements with class="1a2b3c" */
.\000031a2b3c { } /* matches elements with class="1a2b3c" */
.\000031 a2b3c { } /* matches elements with class="1a2b3c" */
#\#fake-id {} /* matches the element with id="#fake-id" */
Some helpful references below if we decide to go ahead and implement this: https://mathiasbynens.be/notes/css-escapes https://www.w3.org/TR/CSS21/syndata.html#characters
Actually this wasn't hard at all. Its been fixed and is ready to merge in. Sorry its taken two years @geddski
Awesome thank you! On Tue, Jun 14, 2016 at 4:47 AM Keegan Street notifications@github.com wrote:
Actually this wasn't hard at all. Its been fixed and is ready to merge in. Sorry its taken two years @geddski https://github.com/geddski
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/keeganstreet/specificity/issues/10#issuecomment-225845864, or mute the thread https://github.com/notifications/unsubscribe/AAfeinswUDAoLQA5U7WtACT4jOVJRuTnks5qLobUgaJpZM4CZFIh .
this is a valid class (using character escaping)
specificity should be 0,1,1,0 (one id and one class). But it's being reported as 0,1,2,0 which makes me think it is incorrectly treating the brackets [] as an attribute selector even though they're escaped.