更新时间:2023-12-06 15:05:52
元素不会得到它的 currentStyle
属性,直到它被添加到文档,这是有道理的:直到元素被添加到文档,浏览器不能知道哪些现有的样式规则将适用于它。
An element doesn't get its currentStyle
property populated until it's added to the document, which makes some sense: until the element's been added to the document, the browser cannot know which existing style rules will apply to it.