Is there any reason to use selector '*.class' over '.class'?

前端 未结 4 683
Happy的楠姐
Happy的楠姐 2021-01-20 22:08

I found it in code and don\'t know what\'s the point of using *.class selector over .class selector.

4条回答
  •  情话喂你
    2021-01-20 22:54

    No, there's no reason to specify *.class over .class

    * is a wildcard character, and means "apply this to anything" but that's just the native selector behavior.

    However, it could have been added by someone who was trying to be explicitly documentary in the face of:

    Don't select a particular element type, but match all element types

    But this only holds true if your internal normal code-organization is of the type:

    $('div.class')
    $('a.class')
    $('a:first')
    

    etc

提交回复
热议问题