dfahlander / typeson-registry

The type registry for typeson
MIT License
6 stars 5 forks source link

FileList polyfill known issue #21

Closed septs closed 4 years ago

septs commented 4 years ago

https://github.com/dfahlander/typeson-registry/blob/ee6234e78b672c50a5764f929e4ef8e6466b3c41/types/filelist.js#L16-L43

  1. Cannot implement [[index]] internal slot e.q: filelist[0] === filelist.item(0)
  2. Not implement iterator e.q: Array.from(filelist)

see https://www.w3.org/TR/FileAPI/#filelist-section

solution: use https://npm.im/create-file-list package

septs commented 4 years ago

@brettz9

septs commented 4 years ago

@brettz9

brettz9 commented 4 years ago

Sounds good if it can pass our tests. From source, however, it looks like we would need other Node polyfills, or we could only use it for the browser.

septs commented 4 years ago

I think Blob, File and FileList is browser specific feature.

brettz9 commented 4 years ago

They can work in Node with jsdom. See our tests.

septs commented 4 years ago

headless browser is not it a better choice?

brettz9 commented 4 years ago

See https://github.com/dfahlander/typeson-registry/pull/18#issuecomment-671004853

brettz9 commented 4 years ago

Btw, if you meant to suggest headless testing was better than normal Node tests, I think it is good that we have a special environment to show how it can work in regular Node.

Also, this looked like a fine item to add. Just need to see if we can get Node polyfills. Looks like the DataTransfer API (and the clipboard API) was requested in https://github.com/jsdom/jsdom/issues/1568 where create-file-list just relies on one of these.