为什么NodeList / HtmlCollection无法排序? [英] Why aren't NodeList / HtmlCollection seqable?

查看:71
本文介绍了为什么NodeList / HtmlCollection无法排序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为Clojurescript的新手,在我看来,每个Clojurescript项目都会有如下代码片段:

As a newcomer to Clojurescript it appears to me that every Clojurescript project will have some snippet of code like this:

(extend-type js/NodeList
  ISeqable
  (-seq [array] (array-seq array 0)))

为什么这不是核心库的一部分?

Why isn't this part of the core library?

推荐答案

您必须认为clojurescript是将javascript作为一种语言的编译器,不仅限于浏览器JavaScript。您还可以在其他平台(例如,nodejs)或不存在NodeList的QT库中使用它(因为它是Dom api的一部分,而不是标准语言)。

You have to think that clojurescript is a compiler to javascript as a language, not only browser JavaScript. You can also use it in other platforms like nodejs or with the QT library where NodeList does not exist (because it is part of the Dom api and not the standard language).

这篇关于为什么NodeList / HtmlCollection无法排序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆