Why one should prefer using CSS over XPath in IE?

后端 未结 4 483
再見小時候
再見小時候 2020-12-03 02:18

I am working on an application which is compatible only with IE7 and IE8. I didn\'t know why but some suggested to use CSS over XPath while identifying the elements in IE. W

4条回答
  •  佛祖请我去吃肉
    2020-12-03 02:51

    Brevity and Clarity are other reasons, in addition to speed.

    In addition to speed, I find that css is usually shorter and cleaner and easier to read. For example:

    xpath:

     //ol[@class='choice-group'//li//label//input
    

    vs

    css:

     css=ol.choices-group li label input
    

提交回复
热议问题