Changes in API
More HTML tags available from the box:
- Content sectioning:
Address, Article, Aside, Header
- Multimedia:
Area, Audio, HTMLMap (<map>), Track, Video
- Form:
Datalist, Fieldset, Legend, Meter, Output, Progress
- Embedded:
Embed, Iframe, Object, Param, Picture, Source
The attr
method no longer accepts nullable values (breaking)
Null values were used only to tell API to skip attribute assignment at all. The other, closely related, change is that
Boolean attributes no longer accept Boolean flag as parameter (breaking)
before | 0.5.0-build225 |
---|---|
attrs { disabled(value = isDisabled) }
| attrs { if (isDisabled) disabled() }
|
The change affects the following attributes: autoFocus, disabled, formNoValidate, autoComplete, noValidate, autoComplete, checked, multiple, readOnly, selected, required
.
The thing is that whenever we wrote code like this
Button({ disabled(false) })
it takes some mental effort to realize that this attribute was just not added at all. This is rather tricky (and non-idiomatic) way not to add an attribute. So, we've decided to just, well, not call anything in such cases.
Tag interface has been removed (breaking)
If you haven't extended any DOM entities you can just skip this section, these changes won't affect you.
Initially, we introduced the Tag
interface to separate attribute scopes (so that one, for instance, won't call href
on div
etc.).
Having hard times with CSSOM, we just weren't sure that the standard DOM API provided in browsers would be sufficient for our purposes.
However, now we are lucky enough to acknowledge that we can rely completely on standard DOM types hierarchy.
If you have some tags declared in your code, just choose HTMLElement
subtype that you will use as context:
before | 0.5.0-build225 |
---|---|
fun AttrsBuilder<Tag.A>.href(value: String?) = attr("href", value)
| fun AttrsBuilder<HTMLAnchorElement>.href(value: String) = attr("href", value)
|
This week in Compose for Web
We've decided to add small section on news about the ecosystem.
We are very excited to see some project build upon Compose for Web.
Here are the most recent contributions announced at #compose-web channel:
- Compose Chrome extension template by @theapache64
- The experimental routing library for compose-web by @hfhbd
Thank you, #compose-web community!