You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default, html attributes that have the false value are omitted completely in the resulting HTML. Specifically for data-attributes we want to prevent this; we like explicit true/false values to be there – allowing the default value to take affect when it's missing.
The propType.boolean should not have the option to set a default value. Because if a boolean prop has the default value of true, it won't be possible to set the value back to false. This is due to the way how Muban renders the HTML:
html`<div test=${false} ></div>;
will be rendered as:
<div></div>
as false props are not added to the HTML.
The text was updated successfully, but these errors were encountered:
This could be done relatively straight-forward in the muban-template package by modifying the parsed props before rendering the HTML; when the property-name begins with data-, and the value is false, change the value to "false".
By default, html attributes that have the
false
value are omitted completely in the resulting HTML. Specifically for data-attributes we want to prevent this; we like explicit true/false values to be there – allowing the default value to take affect when it's missing.Inside the following function;
muban-template/src/lib/mtl.ts
Lines 10 to 14 in e690e0d
For any node we can loop over the props, and if its name starts with
data-
and the value is=== false
, we can change the value to"false"
.Tasks:
Example test:
Original request
ThepropType.boolean
should not have the option to set a default value. Because if a boolean prop has the default value oftrue
, it won't be possible to set the value back tofalse
. This is due to the way how Muban renders the HTML:will be rendered as:asfalse
props are not added to the HTML.The text was updated successfully, but these errors were encountered: