Escaping class names with square brackets and other unusual characters

This issue has been tracked since 2022-09-27.

I've got a class like: bg-rose-50/[87.5%] (from the very popular Tailwind CSS framework).

When I try to do:

on click remove .bg-rose-50/[87.5%] from #some_div then...

hyperscript complains:

Unexpected Token : /

Is there anyway to escape characters like /[] (I'm guessing that is what's tripping hyperscript)

dz4k wrote this answer on 2022-10-09
set class to "bg-rose-[87.5%]"
remove .{class} from #some_div

Or more tersely:

remove .{"bg-rose-[87.5%]"} from #some_div
SHxKM wrote this answer on 2022-10-09

@dz4k worked beautifully, thank you!

I wonder if this also resolves #185 ..?

More Details About Repo
Owner Name bigskysoftware
Repo Name _hyperscript
Full Name bigskysoftware/_hyperscript
Language JavaScript
Created Date 2020-05-27
Updated Date 2022-11-25
Star Count 1265
Watcher Count 18
Fork Count 75
Issue Count 86

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date