哈拉德·柯施纳的狡猾

    技术2022-07-11  134

    Back in December when the Sizzle selector engine was announced, John Resig's creation was thought to be the end game. Four months later it seems as though it was just the beginning.

    早在12月,当Sizzle选择器引擎发布时 ,约翰·雷西格(John Resig)的创作就被认为是最后的比赛。 四个月后,这似乎仅仅是个开始。

    Harald Kirschner has released Sly, a standalone JavaScript selector engine that absolutely tears through the DOM. Sly is a tiny 3KB minified and gzipped, supports all CSS3 selectors, and provides functionality to create your own custom combinators. Don't believe me? Read Harald's documentation.

    Harald Kirschner发布了Sly ,这是一个绝对会破坏DOM的独立JavaScript选择器引擎。 Sly是一个3KB的小文件,压缩并压缩,支持所有CSS3选择器,并提供创建自己的自定义组合器的功能。 不相信我吗 阅读Harald的文档 。

    支持 (Support)

    Sly's Slickspeed (note that Sizzle is represented as jQuery 1.3.2)

    Sly的Slickspeed (请注意,Sizzle表示为jQuery 1.3.2)

    Sly Download Page

    狡猾的下载页面

    Clientcide Review

    客户评估

    使用范例 (Usage Examples)

    // Finds all div blocks blocks = Sly.search('div'); // Finds all anchors with `href` attribute that starts with `"http://"` anchors = Sly.search('a[href^="http://"]'); // Finds all list item that are direct descendants of the list item with id `"navigation"` items = Sly.search('ul#navigation > li'); // Finds all heading elements heads = Sly.search('h1, h2, h3, h4, h5, h6'); // Finds all odd rows in all tables with the class `"zebra"` rows = Sly.search('table.zebra tr:odd'); // Finds something and looks really complex inputs = Sly.search('form[action$=/send/] label~span+input[type=text]:first-child');

    That last one was something special, eh?

    最后一个很特别,是吗?

    恭喜你! (Congratulations!)

    Join me in extending a huge congratulations and thank you to Harald! While Sizzle got the ball rolling, the selector engine game isn't over by any means!

    和我一起表示巨大的祝贺,并感谢哈拉尔德! 当Sizzle滚球时,选择器引擎游戏还没有结束!

    翻译自: https://davidwalsh.name/sly-selector-engine

    相关资源:拉德戈夫-源码
    Processed: 0.010, SQL: 9