pyscript
pyscript copied to clipboard
Element.classes doesn't appear to work properly w/ the MicroPython runtime
Checklist
- [X] I added a descriptive title
- [X] I searched for other issues and couldn't find a solution or duplication
- [X] I already searched in Google and didn't find any good information or help
What happened?
If I create a new element via
new_div = pydom.create("div", classes=['test-class'])
then new_div.classes just returns an empty list. Doing the same thing w/ the Pyodide runtime works properly (returns ['test-class']).
Element.add_class() and .remove_class() work in both cases (I see the classes change in the browser's web inspector), but the results don't show up in .classes w/ MicroPython.
MicroPython v1.23.0 on 2024-05-31; JS with Emscripten
Type "help()" for more information.
>>> from pyweb import pydom
>>> new_div = pydom.create("div", classes=['test-class'])
>>> new_div.classes
[]
>>> new_div.remove_class('test-class')
<Element object at 33b10>
>>> new_div.classes
[]
>>> new_div.add_class('test-class')
<Element object at 33b10>
>>> new_div.classes
[]
>>>
I'm using the 2024.6.1 release.
What browsers are you seeing the problem on? (if applicable)
No response
Console info
No response
Additional Context
I reported this in the Discord channel and was asked to create a ticket here. @ntoll then said it'd be fixed in the next release, but I didn't see a ticket for it yet, so I'm submitting this now. If it's fixed in main, by all means close this ticket! Thanks.