Open daattali opened 1 year ago
Now that tagQuery(div(class = "foo"))$hasClass("foo")
is a thing, it doesn't seem worth adding (pinging @schloerke to see if he agrees)
That's true, if you think it's redundant then I'd understand. Although I still think it's a bit verbose for doing an operation that is common. Perhaps it's not common for other users though.
Similarly to https://github.com/rstudio/htmltools/issues/389 , parsing out the classes of a tag in order to know if it contains a specific class is something I do often. I've seen in some clients code that they also try to do it, but I've seen it implemented wrongly many times (often people do a simple grep search within the classes string, which is incorrect).
I have the following function:
Would you accept a PR for this function, or would you prefer not to? I'm also open to changing the behaviour (when to error vs return false / what to do when the class is an empty string / doing less error checking)