document.createElement多个参数 [英] document.createElement multiple arguments

查看:416
本文介绍了document.createElement多个参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读聚合物文档,我看到这样:

I was reading through the polymer documentation, and I saw this:

var el2 = document.createElement ('input','my-input'); 来源

再次忘记聚合物,可以 document.createElement 目前有2个参数?是否与Polymer的类型扩展有关?

Forgetting about polymer for a second, can document.createElement currently take 2 arguments? Is it related to Polymer's type-extensions?

旁注:
网络风暴当我用2个参数调用它时,抱怨。

Side note: Webstorm was "complaining" when I called it with 2 arguments.

推荐答案

document.createElement 只会占用一个参数(忽略第二个)。看来有一个规范可以让你传递一个 typeExtension ,你可以阅读关于 here 此规格仍在作品中,并且在任何浏览器上仍未以任何形式实施。

At the moment, document.createElement will only take one parameter (Ignoring the second). It does appear that there is a spec that will allow you to pass a typeExtension which you can read about here. This spec is still in the works, and is not implemented in any form on any browser as of yet.

快速编辑:它出现该chrome stable确实包含 typeExtension 参数,可以找到 here 。感谢@ScottMiles进行澄清。

Quick edit: It does appear that chrome stable does contain the typeExtension parameter, which can be found here. Thanks @ScottMiles for the clarification.

这篇关于document.createElement多个参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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