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