- From: Oriol Brufau via GitHub <sysbot+gh@w3.org>
- Date: Tue, 13 Feb 2018 20:32:21 +0000
- To: public-css-archive@w3.org
`CSS.escape` is not a magical function. It just serializes a string as a CSS identifier. `:nth-child` does not expect an identifier argument so it won't work.
I would just do something like
```js
a = a >> 0; // ToInt32(a)
b = b >> 0; // ToInt32(b)
querySelector(`div:nth-child(${a}n ${b < 0 ? "-" : "+"} ${Math.abs(b)})`);
```
--
GitHub Notification of comment by Loirooriol
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2306#issuecomment-365394810 using your GitHub account
Received on Tuesday, 13 February 2018 20:32:27 UTC