RESOLVED FIXED 16587
Implement the W3C Selectors API
https://bugs.webkit.org/show_bug.cgi?id=16587
Summary Implement the W3C Selectors API
David Smith
Reported 2007-12-23 13:21:04 PST
http://www.w3.org/TR/selectors-api/ Would be very handy for authors.
Attachments
In-progress patch (12.88 KB, patch)
2007-12-23 13:24 PST, David Smith
no flags
another in-progress patch (adds StaticNodeList) (53.54 KB, patch)
2007-12-23 15:25 PST, Sam Weinig
no flags
more fun (54.63 KB, patch)
2007-12-23 22:36 PST, Sam Weinig
no flags
Stop leaking a bunch of CSS stuff every query (55.36 KB, patch)
2007-12-24 13:33 PST, David Smith
no flags
Much much faster (55.16 KB, patch)
2007-12-24 17:41 PST, David Smith
no flags
Fixes selectors with commas (55.49 KB, patch)
2007-12-24 18:44 PST, David Smith
no flags
Updated (58.92 KB, patch)
2007-12-24 19:23 PST, David Smith
no flags
Handle null and undefined according to the spec (59.23 KB, patch)
2007-12-24 22:31 PST, David Smith
no flags
Now with tests :) (86.56 KB, patch)
2007-12-25 13:34 PST, David Smith
oliver: review+
David Smith
Comment 1 2007-12-23 13:24:25 PST
Created attachment 18074 [details] In-progress patch There are quite a few issues with this patch, so I'm not requesting review yet. It leaks memory, uses NodeList instead of StaticNodeList, and doesn't implement the functions other than querySelectorAll. Other than that it appears to work nicely, though :)
Sam Weinig
Comment 2 2007-12-23 15:25:57 PST
Created attachment 18079 [details] another in-progress patch (adds StaticNodeList)
Sam Weinig
Comment 3 2007-12-23 22:36:31 PST
Created attachment 18088 [details] more fun
David Smith
Comment 4 2007-12-24 11:18:54 PST
Adding a link to a version of Dean Edward's tests for his cssQuery function modified to tolerate exceptions and use querySelector/querySelectorAll instead of cssQuery. With the latest patch we pass for all selectors WebKit supports.
David Smith
Comment 5 2007-12-24 13:33:14 PST
Created attachment 18095 [details] Stop leaking a bunch of CSS stuff every query
David Smith
Comment 6 2007-12-24 17:41:40 PST
Created attachment 18097 [details] Much much faster Benchmarking + Sharking + Weinig making good suggestions == Speedy
David Smith
Comment 7 2007-12-24 18:44:50 PST
Created attachment 18098 [details] Fixes selectors with commas Previously things like a, b { } would fail, since we weren't checking all the selectors. There are now no test failures on the slickspeed test, except those due to webkit not supporting the relevant selector.
David Smith
Comment 8 2007-12-24 19:23:01 PST
Created attachment 18100 [details] Updated Fixed comma selectors for querySelector as well as querySelectorAll, made a tiny optimization, and added a changelog.
David Smith
Comment 9 2007-12-24 22:31:25 PST
Created attachment 18103 [details] Handle null and undefined according to the spec This also makes it so that if you put in syntactically valid CSS that is not a selector, it throws a syntax error as it should (for example: "@font-face").
David Smith
Comment 10 2007-12-25 00:44:27 PST
Ken Ferry points out that although the CSS spec does define an empty selector as invalid, it's possibly a reasonable interpretation to say that null/undefined are just not selectors at all, valid or invalid. I think we should probably get this clarified. I'm also not convinced that throwing is the best behavior for the spec to dictate in this situation, but that's another matter.
David Smith
Comment 11 2007-12-25 13:34:25 PST
Created attachment 18113 [details] Now with tests :) I think this is ready for review.
Oliver Hunt
Comment 12 2007-12-25 16:40:03 PST
Comment on attachment 18113 [details] Now with tests :) With the various formatting fixes i mentioned in irc
David Smith
Comment 13 2007-12-25 16:55:05 PST
Landed in r28981
Note You need to log in before you can comment on or make changes to this bug.