Bug 17213

Summary: The querySelectorAll method on an element node does not search only the element's descendants
Product: WebKit Reporter: Andrew Dupont <webkit>
Component: DOMAssignee: Sam Weinig <sam>
Status: RESOLVED FIXED    
Severity: Major CC: webkit
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   
URL: http://andrewdupont.net/test/test_query_selector.html
Attachments:
Description Flags
patch hyatt: review+

Description Andrew Dupont 2008-02-07 22:03:10 PST
From the W3C Selectors API draft:

"The querySelectorAll() methods on the ElementSelector interface must, when invoked, return a StaticNodeList of all the Element nodes, in document order, that are descendants of the element on which the method was invoked and matches the group of selectors (selectors), if any. Otherwise it must return an empty StaticNodeList."

The testcase shows that anyElement.querySelectorAll always behaves like document.querySelectorAll — it'll search document-wide. This is incorrect.
Comment 1 Sam Weinig 2008-02-08 11:57:36 PST
Created attachment 19006 [details]
patch
Comment 2 Sam Weinig 2008-02-08 11:58:33 PST
<rdar://problem/5732491>
Comment 3 Dave Hyatt 2008-02-08 12:00:23 PST
Comment on attachment 19006 [details]
patch

r=me
Comment 4 Sam Weinig 2008-02-08 12:22:03 PST
Fixed in r30096.