json
json copied to clipboard
Make HTMLCollection and NodeList valid array types
SSCCE: https://ellie-app.com/8zCdXgf99qCa1
On the SSCCE above I would expect the decoders for both childNodes (NodeList) and children (HTMLCollection) to decode correctly to a list - this is similar to how it currently handles FileList.
Found this issue when trying to implement a flexible data table, similar to the one shown here: https://adamlynch.com/flexible-data-tables-with-css-grid/#resizing-columns-with-grid
This is similar to #9.
as mentioned on a conversation on elm-slack about this issue, a known workaround is to use https://package.elm-lang.org/packages/debois/elm-dom/latest/DOM#childNodes or to adapt it to our needs
I create an Ellie which logs the fail outputs of the decoders, to make it clearer what this Ellie is testing.
https://ellie-app.com/gFrTm87Fz6wa1
Does this patch fix both of the decoders in the Ellie?
Out of the lines added in this patch, which line fixes which decoder in the Ellie?
|| (typeof FileList !== 'undefined' && value instanceof FileList)
|| (typeof HTMLCollection !== 'undefined' && value instanceof HTMLCollection)
|| (typeof NodeList !== 'undefined' && value instanceof NodeList);
And am I right in thinking that the Ellie does not test the FileList
one? Is there some code to test that?
Should the FileList one go in a separate PR? Since it is specific to working with file lists, and the other 2 are standard DOM traversal?