Not deleting attributes.className.#36
Not deleting attributes.className.#36saboya wants to merge 2 commits intodevelopit:masterfrom saboya:className
Conversation
|
|
||
| function setClass(attributes, value, append) { | ||
| let cl = getClass(attributes); | ||
| if (attributes.className) delete attributes.className; |
There was a problem hiding this comment.
Not sure if this will mess up rendering. Likely will render class twice (since its aliased)
There was a problem hiding this comment.
From my tests, here's what happens (post-patch):
If only className is set, works as intended (class rendered once, correctly).
If only class is set, works as intended (class rendered once, correctly)
If both class and className are set, class is ignored and className is rendered correctly (as the class attribute).
There was a problem hiding this comment.
just wondering if it overwrites preact-mdl's class modifications. I can set up a test if needed, could just be this test but with added class and className variants to verify that the MDL button classes still make it out to the DOM:
https://github.com/developit/preact-mdl/blob/master/test/index.js#L27
Hi. I came across an issue that, if I use className, when the preact components re-renders, the class attributes in my elements are lost. If I use "class", everything just works. I realize that preact recommends class over className, but since className was supposed to work as well (at least according to preactjs/preact#103), I'd consider this a bug.
This is a simple change, but I imagine this code is here for a reason.
Thanks in advance!