css - *[data-some-id ='XX' ] 和 [data-some-id ='XX' ] 在性能方面有区别吗?

标签 css css-selectors

正如标题所述,两者之间是否存在性能差异

*[data-some-id='XX'] {
...
}

对比

[data-some-id='XX'] {
...
}

最佳答案

Per specs , 它们是一样的。

Unless an element is featureless, the presence of a universal selector has no effect on whether the element matches the selector.

Note: In some cases, adding a universal selector can make a selector easier to read, even though it has no effect on the matching behavior.[...]

强调我的

关于css - *[data-some-id ='XX' ] 和 [data-some-id ='XX' ] 在性能方面有区别吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55447723/

相关文章:

css - 如何仅在前面的元素可见时才有边距?

css - 如何使用自定义类设置选项卡的样式?

CSS Not Selector 不选择单个页面

python - 是否可以从多个同名元素中获取 get_attribute() ?

html - Last-Child Margin-Bottom 不起作用

javascript - JavaScript 和 CSS 应该放在 View 中吗?

css - 如何将无序列表堆叠成 2 个单独的行

html - margin-left : max(40px); and how does this works? 是什么意思

CSS:怎么说 .class:last-of-type [类,而不是元素!]

JQuery CSS 从 UL 列表中选择第一个和最后一个 LI