Ruby's Louvre

每天学习一点点算法

导航

queryScopedSelector

17:32

querySelector と queryScopedSelector の違いがよくわからなかったんだけど、こんな感じだそうな。

 
element.queryScopedSelectorAll("div") generally becomes
element.parentNode.querySelectorAll(":scope div", element) which is the same as
element.querySelectorAll(":scope div", element) or even
element.querySelectorAll(":scope div")
 
element.queryScopedSelectorAll(":scope > div") generally becomes
element.parentNode.querySelectorAll(":scope > div", element) which is the same as
element.querySelectorAll(":scope > div", element) or even
element.querySelectorAll(":scope > div")
 
element.queryScopedSelectorAll(":scope + div") generally becomes
element.parentNode.querySelectorAll(":scope + div", element)
 
element.queryScopedSelectorAll("div, div:scope") generally becomes
element.parentNode.querySelectorAll(":scope div, div:scope", element)
Re: Publishing Selectors API Level 2 as an FPWD?

引用元では queryScopedSelector を無くそうとか名前を変えようという議論の真っ最中だけど。

それ以上に、仕様は jQuery を元に作られてるんだなあと実感するスレッドだな。

posted on 2010-02-22 18:47  司徒正美  阅读(1024)  评论(1编辑  收藏  举报