=> (doseq [file lastFileList] (.-name file))
Error: [object FileList] is not ISeqable
at Error (native)
at cljs.core.seq (http://localhost:8080/app.js:3164:67)
=> (doseq [file (array-seq lastFileList)] (.log js/console (.-name file)))
This works. It logs the filename. In case you're curious, this FileList is
coming from drag-drop events)
Here's the ClojureScript that I would hope would catch this:
(array? coll)
(when-not (zero? (alength coll))
(IndexedSeq. coll 0))
The resulting js is:
if (a instanceof Array || "string" === typeof a) {
return 0 === a.length ? null : new cljs.core.IndexedSeq(a, 0);
}
Is there any reason not to make other array-like types ISeqable? I'm sure there
are better examples than FileList. For example, the same issue can be seen with
HTMLCollection:
=> (seq (.getElementsByTagName js/document.body "div"))
Error: [object HTMLCollection] is not ISeqable
at Error (native)
at cljs.core.seq (http://localhost:8080/app.js:3164:67)
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.