Both style and class are HTML attributes and as such they can be made into options in their own right.
See the coding above.
When writing a style replacement, recall that the entire style expression needs rewritten, and that no outside containing quotes should be used. The other attributes are handled as separate options, as you would expect.
For the class declaration as an option, simply type e.g. class=collapsible selected as an option entry to open the box as a drop-box and already open.