How should I escape attributes in the css/js attibute selector [attr=value]
?
Specifically, is this correct?
document.querySelector('input[name="test[33]"]')
I'm looking for the "standard way" of doing this, if any, because I don't want Sizzle using a heavy-to-execute fallback function
Yes, that is one correct approach. The Selectors Level 3 specification states the following:
The example in your question uses a string as the attribute value. An "identifier" is defined as follows:
So following that, it is also legal to escape the special characters and omit the quotes: