Implement Element.closest() API
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 4 Oct 2014 22:24:21 +0000 (22:24 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 4 Oct 2014 22:24:21 +0000 (22:24 +0000)
commita1205be380f6c2939f63004a399e5b81f075f2dd
treefed714ee20a879658f00f281b91774bfec995fa0
parentb78c9b8b286aeeb2b1d2877a3b4ddab331cd635a
Implement Element.closest() API
https://bugs.webkit.org/show_bug.cgi?id=137418

Patch by Dhi Aurrahman <diorahman@rockybars.com> on 2014-10-04
Reviewed by Benjamin Poulain.

Source/WebCore:

Implement Element.closest() API as specified in [1].

[1]: https://dom.spec.whatwg.org/#dom-element-closest

Tests: fast/selectors/closest-general.html
       fast/selectors/closest-scope.html

* dom/Element.cpp:
(WebCore::Element::closest):
* dom/Element.h:
* dom/Element.idl:
* dom/SelectorQuery.cpp:
(WebCore::SelectorDataList::selectorClosest):
(WebCore::SelectorDataList::closest):
* dom/SelectorQuery.h:
(WebCore::SelectorQuery::closest):

LayoutTests:

Add test cases for Element.closest() API

* fast/selectors/closest-general-expected.txt: Added.
* fast/selectors/closest-general.html: Added.
* fast/selectors/closest-scope-expected.txt: Added.
* fast/selectors/closest-scope.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/selectors/closest-general-expected.txt [new file with mode: 0644]
LayoutTests/fast/selectors/closest-general.html [new file with mode: 0644]
LayoutTests/fast/selectors/closest-scope-expected.txt [new file with mode: 0644]
LayoutTests/fast/selectors/closest-scope.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h
Source/WebCore/dom/Element.idl
Source/WebCore/dom/SelectorQuery.cpp
Source/WebCore/dom/SelectorQuery.h