I am adding CSS styles using JavaScript (specifically with GreaseMonkey's GM_addStyle
).
I'd like to put a Unicode character in a CSS property. I've seen a lot of questions like this one and the answer always seems to be along the lines of
#target:before {
content: "\2611";
}
Now, as I said, this style is being specified in GM_addStyle
, and the calling function has Strict mode enabled. When my script runs, I get an error on the console with the message octal literals and octal escape sequences are deprecated
.
I think the conflict here is between doing the operation in JavaScript (i.e. putting a Unicode character into a JavaScript string) and the operation in CSS (escaping the character when declaring a CSS property). What syntax should I use to have the character escaped without generating an error?