removeCss: Bug?

In my continued effort to change a Webix Button’s background color, I got it working using webix.html.addCss/removeCss. In order for the button to actually change color, I had to remove the class webixtype_base.

When I try to use removeCss on webixtype_base, it will not remove. The “bug” here is the RegExp in removeCss, which is:

node.className.replace(RegExp(" “+name,“g”),”");

Since webixtype_base does not have a leading space, this regular expression will never work, and my button will never change color.

I do realize that I can force the styles by using “!important”. So my guess is that the RexExp being used is to preserve all Webix classes in the HTML.

Hello,

The removeCss() method is used to remove the CSS classes added with the addCss() and the latter prepends a space character to the class name.

I know what removeCss is used for. My post was about a potential bug in removeCss. Please read again.

No, it is not a bug. The leading space in the removeCss() regexp corresponds to the space character added by the addCss() method.

To change the style of a single button, you can add an extra CSS class to it and style it accordingly: https://webix.com/snippet/2d6bd30d

Forget it.