我正在阅读 polymer 文档,我看到了这个:
var el2 = document.createElement('input', 'my-input');
Source
暂时忘记 polymer,document.createElement
目前可以接受 2 个参数吗?与Polymer的类型扩展有关吗?
边注: Webstorm当我用 2 个参数调用它时,它在“提示”。
最佳答案
目前,document.createElement
只会接受一个参数(忽略第二个)。似乎确实有一个规范允许您传递 typeExtension
,您可以阅读有关 here 的内容。 . 此规范仍在制定中,目前尚未在任何浏览器上以任何形式实现。
快速编辑:chrome stable 确实包含 typeExtension
参数,可以找到 here .感谢@ScottMiles 的澄清。
关于javascript - document.createElement 多个参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30767350/