Query selectors must use css syntax, which means things like semicolons and backslashes need a backslash to precede them.
Example where this causes failure:
(sel "#:0.inp")
This will produce a SYNTAX_ERR (== DOM Exception 12). The crazy-looking ":0.inp" is the typical format of ids produced by goog.ui.Component/makeId which are regularly inserted into id attributes of dom elements (which is how it bit me).
An at least partial fix is to use an escaping function like this (cljs):
I think dommy.macros/selector will need a similar transformation.
However you can only safely use this on keywords since strings may use css characters for their intended meaning. This argues for making "css-escape" or "selector-escape" a public function users can use.
Query selectors must use css syntax, which means things like semicolons and backslashes need a backslash to precede them.
Example where this causes failure:
This will produce a
SYNTAX_ERR
(==DOM Exception 12
). The crazy-looking":0.inp"
is the typical format of ids produced bygoog.ui.Component/makeId
which are regularly inserted into id attributes of dom elements (which is how it bit me).An at least partial fix is to use an escaping function like this (cljs):
And then patch
dommy.core/selector
:I think
dommy.macros/selector
will need a similar transformation.However you can only safely use this on keywords since strings may use css characters for their intended meaning. This argues for making "css-escape" or "selector-escape" a public function users can use.