sciter-sdk/pysciter

Question about adding classes/removing classes

martinlombana opened this issue · 3 comments

I see that I can use:

	element.set_attribute('class', 'dn')

To set a class. But is there any exposed function in the python api in order to replicate:

$(#element).attributes.removeClass("ClassOne");
$(#element).attributes.addClass("ClassTwo");

Or I have to do it myself? (It's trivial, but I don't want to replicate existing functions, and I haven't found this one). There is no exposed "attributes" property to the Element class.

If it is not added (and I am looking in the wrong place/methods), but exists in native C api, could you add it or point me how to add it?

BTW: Is there a complete set specifications for the underlying native API so I can take a look?

Thanks!

No, only get and set methods:

element.set_style_attribute('class', 'dn')
dn = element.style_attribute('class')

There is no anything for add/remove/toggle/has class operations in C API, so you need to implement it yourself (unless Andrew adds those methods to API).

BTW: Is there a complete set specifications for the underlying native API so I can take a look?

https://github.com/c-smile/sciter-sdk/blob/master/include/sciter-x-dom.h only this.

And a rendered version (but outdated): https://sciter.com/sdk/doc.api/html/sciter-x-dom_8h.html