【发布时间】:2017-01-19 21:04:27
【问题描述】:
当执行以下代码时,我收到“Uncaught DOMException: Failed to set the 'child-count' property on 'DOMStringMap': 'child-count' is not a valid property name.” :
elem.dataset['child-count'] = "test";
其中 elem 是一个 HTMLElement。
认为在数据属性名称中使用“-”字符是合法的,还是我遗漏了其他内容?
【问题讨论】:
-
你能发布你的代码吗?
标签: javascript html typescript