Best way to find DOM elements with css selectors

后端 未结 5 845
感情败类
感情败类 2020-11-29 06:19

What\'s the easiest way to find Dom elements with a css selector, without using a library?

function select( selector ) {
 return [ /* some magic here please          


        
5条回答
  •  时光说笑
    2020-11-29 06:35

    Creating a selector engine is no easy task. I would suggest learning from what already exists:

    • Sizzle (Created by Resig, used in jQuery)
    • Peppy (Created by James Donaghue)
    • Sly (Created by Harald Kirschner)

提交回复
热议问题