Closed dbaynard closed 6 years ago
good analysis, good plan!
This is not a high priority for us, but we would welcome PRs. The breaking change is benign IMO, since the type checker will catch it.
The elements. Some use term'
or term
inappropriately, others manually implement the same repeated pattern.
Elements | Wrongly requires child | Manual implementation |
---|---|---|
area | ✓ | |
base | ✓ | |
br | ✓ | |
col | ✓ | |
embed | ✓ | |
hr | ✓ | |
img | ✓ | |
input | ✓ | |
link | ✓ | |
meta | ✓ | |
param | ✓ | |
source | ✓ | |
track | ✓ | |
wbr | ✓ |
I think in the long run we should essentially replicate the HTML spec in the type system (and then perhaps have a few unsafe functions that can bypass it, lets say if you are targetting some quirky older browser). So requiring required attributes and only allowing attributes that can actually be used. Even going as far as having ADTs for each CSS property and stuff like that would IMO be very cool. But not super high priority. Perhaps if others agree with me I could look into doing such a thing if I have enough free time.
img_
as implemented requires a child element, but unless that element ismempty
there is a runtime error.This is mentioned on the react-flux issue tracker; the proposed fix is to replace
with
but
src
is mandatory, yet that is not reflected in the type.So I propose
Required "src"
) as a separate issue, if desired.See https://bitbucket.org/wuzzeb/react-flux/issues/27/dom-element-img_ for original issue and solution.