Conversation
Naive in the sense that it duplicates reactive attributes.
|
I'd like to also add reactive properties... This would be useful when implementing reactive UI elements: for instance, setting the I can do that in this PR or another, or not do it at all, which do you prefer? |
|
|
Thanks. This is indeed something that should be improved. lwd/lib/tyxml-lwd/tyxml_lwd.ml Lines 194 to 205 in 0fdf2e8 It's a bit annoying that the same surface notion translates to different setters but we have to live with that. I am not familiar enough with the difference between attributes and properties and the web customs to know how this should be exposed. Styles have their own syntax so it is less-surprising to treat them differently. |
Here are some information I think are relevant: HTMLI think attributes are "syntactic" and defined in the HTML syntax. Elements of the DOM access the corresponding attributes via From tests and what I understand, all standard attributes have a corresponding property:
Non-standard attributes do not have a corresponding attribute:
Conversely, some properties like SVG(SVG is not really yet supported in brr-lwd because we cannot decide the namespace because we cannot do it in brr. However, I have a patch for brr and brr-lwd that I use in slipshow to allow this, so being nice to svg is very relevant to me!) Many attributes don't have a corresponding property. So for instance if
I think this would be ideal indeed! However, I find it not so easy to make it work nicely in all contexts:
So in conclusion it's possible to have a single merged Keeping attributes and properties separate (in Sorry for the wall of text! |
|
Superseded by #60 |
It is sometimes useful to have reactive styles. In particular for "continuous" properties such as
widthandtop/left, as one cannot rely on a continuum infinite number of classes.This PR adds to elements constructors a
stargument with a collection of styles ((Brr.El.Style.prop * Jstr.v) col) which are applied to the element. Example of use:It also adds an example in the example folder, as well as changelog entries (for #53 and this one).