Changeset 167584 in webkit


Ignore:
Timestamp:
Apr 20, 2014 11:08:05 PM (10 years ago)
Author:
benjamin@webkit.org
Message:

Add Element.matches, the standard name for webkitMatchesSelector
https://bugs.webkit.org/show_bug.cgi?id=131922

Reviewed by Andreas Kling.

Source/WebCore:
This patch just renames webkitMatchesSelector() to matches().

  • bindings/scripts/CodeGeneratorObjC.pm:

(GenerateImplementation):
The Objective-C binding generator only supported ImplementedAs for getters and setters.
This adds support for the option so that Element.matches can be generated for Obj-C.

  • dom/Element.cpp:

(WebCore::Element::matches):
(WebCore::Element::webkitMatchesSelector): Deleted.

  • dom/Element.h:
  • dom/Element.idl:
  • inspector/InspectorCSSAgent.cpp:

(WebCore::InspectorCSSAgent::buildArrayForMatchedRuleList):

LayoutTests:
Update the tests to verify both Element.matches and Element.webkitMatchesSelector

  • fast/dom/SelectorAPI/attrname-case-insensitive-expected.txt:
  • fast/dom/SelectorAPI/attrname-case-insensitive.html:
  • fast/dom/SelectorAPI/attrname-case-sensitive-expected.txt:
  • fast/dom/SelectorAPI/attrname-case-sensitive.xhtml:
  • fast/dom/SelectorAPI/caseID-almost-strict-expected.txt:
  • fast/dom/SelectorAPI/caseID-almost-strict.html:
  • fast/dom/SelectorAPI/caseID-expected.txt:
  • fast/dom/SelectorAPI/caseID-strict-expected.txt:
  • fast/dom/SelectorAPI/caseID-strict.html:
  • fast/dom/SelectorAPI/caseID.html:
  • fast/dom/SelectorAPI/caseTag-expected.txt:
  • fast/dom/SelectorAPI/caseTag.html:
  • fast/dom/SelectorAPI/caseTagX-expected.txt:
  • fast/dom/SelectorAPI/caseTagX.xhtml:
  • fast/dom/SelectorAPI/detached-element-expected.txt:
  • fast/dom/SelectorAPI/not-supported-namespace-in-selector-expected.txt:
  • fast/dom/SelectorAPI/not-supported-namespace-in-selector.html:
  • fast/dom/SelectorAPI/script-tests/detached-element.js:
  • fast/dom/SelectorAPI/script-tests/undefined-null-stringify.js:
  • fast/dom/SelectorAPI/script-tests/viewless-document.js:
  • fast/dom/SelectorAPI/undefined-null-stringify-expected.txt:
  • fast/dom/SelectorAPI/viewless-document-expected.txt:
  • fast/forms/radio/radio-live-validation-style-expected.txt:
  • fast/forms/radio/radio-live-validation-style.html:
  • fast/harness/results.html:
Location:
trunk
Files:
32 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r167583 r167584  
     12014-04-20  Benjamin Poulain  <benjamin@webkit.org>
     2
     3        Add Element.matches, the standard name for webkitMatchesSelector
     4        https://bugs.webkit.org/show_bug.cgi?id=131922
     5
     6        Reviewed by Andreas Kling.
     7
     8        Update the tests to verify both Element.matches and Element.webkitMatchesSelector
     9
     10        * fast/dom/SelectorAPI/attrname-case-insensitive-expected.txt:
     11        * fast/dom/SelectorAPI/attrname-case-insensitive.html:
     12        * fast/dom/SelectorAPI/attrname-case-sensitive-expected.txt:
     13        * fast/dom/SelectorAPI/attrname-case-sensitive.xhtml:
     14        * fast/dom/SelectorAPI/caseID-almost-strict-expected.txt:
     15        * fast/dom/SelectorAPI/caseID-almost-strict.html:
     16        * fast/dom/SelectorAPI/caseID-expected.txt:
     17        * fast/dom/SelectorAPI/caseID-strict-expected.txt:
     18        * fast/dom/SelectorAPI/caseID-strict.html:
     19        * fast/dom/SelectorAPI/caseID.html:
     20        * fast/dom/SelectorAPI/caseTag-expected.txt:
     21        * fast/dom/SelectorAPI/caseTag.html:
     22        * fast/dom/SelectorAPI/caseTagX-expected.txt:
     23        * fast/dom/SelectorAPI/caseTagX.xhtml:
     24        * fast/dom/SelectorAPI/detached-element-expected.txt:
     25        * fast/dom/SelectorAPI/not-supported-namespace-in-selector-expected.txt:
     26        * fast/dom/SelectorAPI/not-supported-namespace-in-selector.html:
     27        * fast/dom/SelectorAPI/script-tests/detached-element.js:
     28        * fast/dom/SelectorAPI/script-tests/undefined-null-stringify.js:
     29        * fast/dom/SelectorAPI/script-tests/viewless-document.js:
     30        * fast/dom/SelectorAPI/undefined-null-stringify-expected.txt:
     31        * fast/dom/SelectorAPI/viewless-document-expected.txt:
     32        * fast/forms/radio/radio-live-validation-style-expected.txt:
     33        * fast/forms/radio/radio-live-validation-style.html:
     34        * fast/harness/results.html:
     35
    1362014-04-20  Alexey Proskuryakov  <ap@apple.com>
    237
  • trunk/LayoutTests/fast/dom/SelectorAPI/attrname-case-insensitive-expected.txt

    r153631 r167584  
    11PASS document.querySelector('div[baR]') is document.getElementById('bar')
     2PASS document.getElementById('bar').matches('div[baR]') is true
    23PASS document.getElementById('bar').webkitMatchesSelector('div[baR]') is true
    34PASS document.querySelector('div[bar]') is document.getElementById('bar')
     5PASS document.getElementById('bar').matches('div[bar]') is true
    46PASS document.getElementById('bar').webkitMatchesSelector('div[bar]') is true
    57PASS document.querySelector('div[BAR]') is document.getElementById('bar')
     8PASS document.getElementById('bar').matches('div[BAR]') is true
    69PASS document.getElementById('bar').webkitMatchesSelector('div[BAR]') is true
    710PASS document.querySelector('div[bAR]') is document.getElementById('bar')
     11PASS document.getElementById('bar').matches('div[bAR]') is true
    812PASS document.getElementById('bar').webkitMatchesSelector('div[bAR]') is true
    913PASS document.querySelector('div[baR="10"]') is document.getElementById('bar')
     14PASS document.getElementById('bar').matches('div[baR="10"]') is true
    1015PASS document.getElementById('bar').webkitMatchesSelector('div[baR="10"]') is true
    1116PASS document.querySelector('div[bar="10"]') is document.getElementById('bar')
     17PASS document.getElementById('bar').matches('div[bar="10"]') is true
    1218PASS document.getElementById('bar').webkitMatchesSelector('div[bar="10"]') is true
    1319PASS document.querySelector('div[BAR="10"]') is document.getElementById('bar')
     20PASS document.getElementById('bar').matches('div[BAR="10"]') is true
    1421PASS document.getElementById('bar').webkitMatchesSelector('div[BAR="10"]') is true
    1522PASS document.querySelector('div[bAR="10"]') is document.getElementById('bar')
     23PASS document.getElementById('bar').matches('div[bAR="10"]') is true
    1624PASS document.getElementById('bar').webkitMatchesSelector('div[bAR="10"]') is true
    1725PASS document.querySelector('path[pathLength]') is document.getElementById('pa')
     26PASS document.getElementById('pa').matches('path[pathLength]') is true
    1827PASS document.getElementById('pa').webkitMatchesSelector('path[pathLength]') is true
    1928PASS content.querySelector('path[pathlength]') is null
    2029PASS content.querySelector('path[pathLengTh]') is null
    2130PASS document.querySelector('path[pathLength="200"]') is document.getElementById('pa')
     31PASS document.getElementById('pa').matches('path[pathLength="200"]') is true
    2232PASS document.getElementById('pa').webkitMatchesSelector('path[pathLength="200"]') is true
    2333PASS content.querySelector('path[pathlength="200"]') is null
  • trunk/LayoutTests/fast/dom/SelectorAPI/attrname-case-insensitive.html

    r155265 r167584  
    1919        function checkMatchingSelector(selector, elementId) {
    2020            shouldBe("document.querySelector('" + selector + "')", "document.getElementById('" + elementId + "')");
     21            shouldBeTrue("document.getElementById('" + elementId + "').matches('" + selector + "')");
    2122            shouldBeTrue("document.getElementById('" + elementId + "').webkitMatchesSelector('" + selector + "')");
    2223        }
  • trunk/LayoutTests/fast/dom/SelectorAPI/attrname-case-sensitive-expected.txt

    r153631 r167584  
    11PASS document.querySelector('div[baR]') is document.getElementById('bar')
     2PASS document.getElementById('bar').matches('div[baR]') is true
    23PASS document.getElementById('bar').webkitMatchesSelector('div[baR]') is true
    34PASS content.querySelector('div[bar]') is null
     
    56PASS content.querySelector('div[bAR]') is null
    67PASS document.querySelector('div[baR="10"]') is document.getElementById('bar')
     8PASS document.getElementById('bar').matches('div[baR="10"]') is true
    79PASS document.getElementById('bar').webkitMatchesSelector('div[baR="10"]') is true
    810PASS content.querySelector('div[bar="10"]') is null
     
    1012PASS content.querySelector('div[bAR="10"]') is null
    1113PASS document.querySelector('path[pathLength]') is document.getElementById('pa')
     14PASS document.getElementById('pa').matches('path[pathLength]') is true
    1215PASS document.getElementById('pa').webkitMatchesSelector('path[pathLength]') is true
    1316PASS content.querySelector('path[pathlength]') is null
    1417PASS content.querySelector('path[pathLengTh]') is null
    1518PASS document.querySelector('path[pathLength="200"]') is document.getElementById('pa')
     19PASS document.getElementById('pa').matches('path[pathLength="200"]') is true
    1620PASS document.getElementById('pa').webkitMatchesSelector('path[pathLength="200"]') is true
    1721PASS content.querySelector('path[pathlength="200"]') is null
  • trunk/LayoutTests/fast/dom/SelectorAPI/attrname-case-sensitive.xhtml

    r155265 r167584  
    2222        function checkMatchingSelector(selector, elementId) {
    2323            shouldBe("document.querySelector('" + selector + "')", "document.getElementById('" + elementId + "')");
     24            shouldBeTrue("document.getElementById('" + elementId + "').matches('" + selector + "')");
    2425            shouldBeTrue("document.getElementById('" + elementId + "').webkitMatchesSelector('" + selector + "')");
    2526        }
  • trunk/LayoutTests/fast/dom/SelectorAPI/caseID-almost-strict-expected.txt

    r48723 r167584  
    33PASS document.querySelector('#UPPER1').textContent is 'UPPER 1'
    44PASS document.querySelector('#upper2') is null
     5PASS document.getElementById('lower1').matches('#lower1') is true
     6PASS document.getElementById('lower2').matches('#LOWER2') is false
     7PASS document.getElementById('UPPER1').matches('#UPPER1') is true
     8PASS document.getElementById('UPPER2').matches('#upper2') is false
    59PASS document.getElementById('lower1').webkitMatchesSelector('#lower1') is true
    610PASS document.getElementById('lower2').webkitMatchesSelector('#LOWER2') is false
  • trunk/LayoutTests/fast/dom/SelectorAPI/caseID-almost-strict.html

    r155265 r167584  
    1717        shouldBeNull("document.querySelector('#upper2')");
    1818
     19        shouldBeTrue("document.getElementById('lower1').matches('#lower1')");
     20        shouldBeFalse("document.getElementById('lower2').matches('#LOWER2')");
     21        shouldBeTrue("document.getElementById('UPPER1').matches('#UPPER1')");
     22        shouldBeFalse("document.getElementById('UPPER2').matches('#upper2')");
    1923        shouldBeTrue("document.getElementById('lower1').webkitMatchesSelector('#lower1')");
    2024        shouldBeFalse("document.getElementById('lower2').webkitMatchesSelector('#LOWER2')");
  • trunk/LayoutTests/fast/dom/SelectorAPI/caseID-expected.txt

    r48723 r167584  
    33PASS document.querySelector('#UPPER1').textContent is 'UPPER 1'
    44PASS document.querySelector('#upper2').textContent is 'UPPER 2'
     5PASS document.getElementById('lower1').matches('#lower1') is true
     6PASS document.getElementById('lower2').matches('#LOWER2') is true
     7PASS document.getElementById('UPPER1').matches('#UPPER1') is true
     8PASS document.getElementById('UPPER2').matches('#upper2') is true
    59PASS document.getElementById('lower1').webkitMatchesSelector('#lower1') is true
    610PASS document.getElementById('lower2').webkitMatchesSelector('#LOWER2') is true
  • trunk/LayoutTests/fast/dom/SelectorAPI/caseID-strict-expected.txt

    r48723 r167584  
    33PASS document.querySelector('#UPPER1').textContent is 'UPPER 1'
    44PASS document.querySelector('#upper2') is null
     5PASS document.getElementById('lower1').matches('#lower1') is true
     6PASS document.getElementById('lower2').matches('#LOWER2') is false
     7PASS document.getElementById('UPPER1').matches('#UPPER1') is true
     8PASS document.getElementById('UPPER2').matches('#upper2') is false
    59PASS document.getElementById('lower1').webkitMatchesSelector('#lower1') is true
    610PASS document.getElementById('lower2').webkitMatchesSelector('#LOWER2') is false
  • trunk/LayoutTests/fast/dom/SelectorAPI/caseID-strict.html

    r155265 r167584  
    1717        shouldBeNull("document.querySelector('#upper2')");
    1818
     19        shouldBeTrue("document.getElementById('lower1').matches('#lower1')");
     20        shouldBeFalse("document.getElementById('lower2').matches('#LOWER2')");
     21        shouldBeTrue("document.getElementById('UPPER1').matches('#UPPER1')");
     22        shouldBeFalse("document.getElementById('UPPER2').matches('#upper2')");
    1923        shouldBeTrue("document.getElementById('lower1').webkitMatchesSelector('#lower1')");
    2024        shouldBeFalse("document.getElementById('lower2').webkitMatchesSelector('#LOWER2')");
  • trunk/LayoutTests/fast/dom/SelectorAPI/caseID.html

    r155265 r167584  
    1616        shouldBe("document.querySelector('#upper2').textContent", "'UPPER 2'");
    1717
     18        shouldBeTrue("document.getElementById('lower1').matches('#lower1')");
     19        shouldBeTrue("document.getElementById('lower2').matches('#LOWER2')");
     20        shouldBeTrue("document.getElementById('UPPER1').matches('#UPPER1')");
     21        shouldBeTrue("document.getElementById('UPPER2').matches('#upper2')");
    1822        shouldBeTrue("document.getElementById('lower1').webkitMatchesSelector('#lower1')");
    1923        shouldBeTrue("document.getElementById('lower2').webkitMatchesSelector('#LOWER2')");
  • trunk/LayoutTests/fast/dom/SelectorAPI/caseTag-expected.txt

    r48723 r167584  
    11PASS document.querySelector('div SPAN').textContent is 'lower'
    22PASS document.querySelector('div p').textContent is 'UPPER'
     3PASS document.getElementById('lower1').matches('div SPAN') is true
     4PASS document.getElementById('UPPER1').matches('div p') is true
    35PASS document.getElementById('lower1').webkitMatchesSelector('div SPAN') is true
    46PASS document.getElementById('UPPER1').webkitMatchesSelector('div p') is true
  • trunk/LayoutTests/fast/dom/SelectorAPI/caseTag.html

    r155265 r167584  
    1212        shouldBe("document.querySelector('div p').textContent", "'UPPER'");
    1313
     14        shouldBeTrue("document.getElementById('lower1').matches('div SPAN')");
     15        shouldBeTrue("document.getElementById('UPPER1').matches('div p')");
    1416        shouldBeTrue("document.getElementById('lower1').webkitMatchesSelector('div SPAN')");
    1517        shouldBeTrue("document.getElementById('UPPER1').webkitMatchesSelector('div p')");
  • trunk/LayoutTests/fast/dom/SelectorAPI/caseTagX-expected.txt

    r48723 r167584  
    11PASS document.querySelector('div SPAN') is null
     2PASS document.getElementById('lower1').matches('div SPAN') is false
    23PASS document.getElementById('lower1').webkitMatchesSelector('div SPAN') is false
    34PASS successfullyParsed is true
  • trunk/LayoutTests/fast/dom/SelectorAPI/caseTagX.xhtml

    r155265 r167584  
    1616        shouldBeNull("document.querySelector('div SPAN')");
    1717
     18        shouldBeFalse("document.getElementById('lower1').matches('div SPAN')");
    1819        shouldBeFalse("document.getElementById('lower1').webkitMatchesSelector('div SPAN')");
    1920    ]]>
  • trunk/LayoutTests/fast/dom/SelectorAPI/detached-element-expected.txt

    r48723 r167584  
    1212PASS noChild.querySelector('div') is null
    1313PASS noChild.querySelectorAll('div').length is 0
     14PASS correctNode.matches('div') is true
     15PASS correctNode.matches('#testId') is true
    1416PASS correctNode.webkitMatchesSelector('div') is true
    1517PASS correctNode.webkitMatchesSelector('#testId') is true
  • trunk/LayoutTests/fast/dom/SelectorAPI/not-supported-namespace-in-selector-expected.txt

    r134879 r167584  
    33PASS: document.querySelector('bbb|pre') throws: Error: NamespaceError: DOM Exception 14
    44PASS: document.querySelectorAll('bbb|pre') throws: Error: NamespaceError: DOM Exception 14
     5PASS: document.body.matches('bbb|pre') throws: Error: NamespaceError: DOM Exception 14
    56PASS: document.body.webkitMatchesSelector('bbb|pre') throws: Error: NamespaceError: DOM Exception 14
    67PASS: document.querySelector('*|pre') did not throw
    78PASS: document.querySelectorAll('*|pre') did not throw
     9PASS: document.body.matches('*|pre') did not throw
    810PASS: document.body.webkitMatchesSelector('*|pre') did not throw
    911PASS: document.querySelector('|pre') did not throw
    1012PASS: document.querySelectorAll('|pre') did not throw
     13PASS: document.body.matches('|pre') did not throw
    1114PASS: document.body.webkitMatchesSelector('|pre') did not throw
    1215PASS: document.querySelector('div bbb|pre') throws: Error: NamespaceError: DOM Exception 14
    1316PASS: document.querySelectorAll('div bbb|pre') throws: Error: NamespaceError: DOM Exception 14
     17PASS: document.body.matches('div bbb|pre') throws: Error: NamespaceError: DOM Exception 14
    1418PASS: document.body.webkitMatchesSelector('div bbb|pre') throws: Error: NamespaceError: DOM Exception 14
    1519PASS: document.querySelector('div *|pre') did not throw
    1620PASS: document.querySelectorAll('div *|pre') did not throw
     21PASS: document.body.matches('div *|pre') did not throw
    1722PASS: document.body.webkitMatchesSelector('div *|pre') did not throw
    1823PASS: document.querySelector('div |pre') did not throw
    1924PASS: document.querySelectorAll('div |pre') did not throw
     25PASS: document.body.matches('div |pre') did not throw
    2026PASS: document.body.webkitMatchesSelector('div |pre') did not throw
    2127PASS: document.querySelector('[bbb|name=value]') throws: Error: NamespaceError: DOM Exception 14
    2228PASS: document.querySelectorAll('[bbb|name=value]') throws: Error: NamespaceError: DOM Exception 14
     29PASS: document.body.matches('[bbb|name=value]') throws: Error: NamespaceError: DOM Exception 14
    2330PASS: document.body.webkitMatchesSelector('[bbb|name=value]') throws: Error: NamespaceError: DOM Exception 14
    2431PASS: document.querySelector('[*|name=value]') did not throw
    2532PASS: document.querySelectorAll('[*|name=value]') did not throw
     33PASS: document.body.matches('[*|name=value]') did not throw
    2634PASS: document.body.webkitMatchesSelector('[*|name=value]') did not throw
    2735PASS: document.querySelector('[|name=value]') did not throw
    2836PASS: document.querySelectorAll('[|name=value]') did not throw
     37PASS: document.body.matches('[|name=value]') did not throw
    2938PASS: document.body.webkitMatchesSelector('[|name=value]') did not throw
    3039PASS: document.querySelector(':-webkit-any(bbb|pre)') throws: Error: NamespaceError: DOM Exception 14
    3140PASS: document.querySelector('div [bbb|name=value]') throws: Error: NamespaceError: DOM Exception 14
    3241PASS: document.querySelectorAll('div [bbb|name=value]') throws: Error: NamespaceError: DOM Exception 14
     42PASS: document.body.matches('div [bbb|name=value]') throws: Error: NamespaceError: DOM Exception 14
    3343PASS: document.body.webkitMatchesSelector('div [bbb|name=value]') throws: Error: NamespaceError: DOM Exception 14
    3444PASS: document.querySelector('div [*|name=value]') did not throw
    3545PASS: document.querySelectorAll('div [*|name=value]') did not throw
     46PASS: document.body.matches('div [*|name=value]') did not throw
    3647PASS: document.body.webkitMatchesSelector('div [*|name=value]') did not throw
    3748PASS: document.querySelector('div [|name=value]') did not throw
    3849PASS: document.querySelectorAll('div [|name=value]') did not throw
     50PASS: document.body.matches('div [|name=value]') did not throw
    3951PASS: document.body.webkitMatchesSelector('div [|name=value]') did not throw
    4052
  • trunk/LayoutTests/fast/dom/SelectorAPI/not-supported-namespace-in-selector.html

    r120792 r167584  
    3434        shouldThrow("document.querySelector('bbb|pre')");
    3535        shouldThrow("document.querySelectorAll('bbb|pre')");
     36        shouldThrow("document.body.matches('bbb|pre')");
    3637        shouldThrow("document.body.webkitMatchesSelector('bbb|pre')");
    3738        shouldNotThrow("document.querySelector('*|pre')");
    3839        shouldNotThrow("document.querySelectorAll('*|pre')");
     40        shouldNotThrow("document.body.matches('*|pre')");
    3941        shouldNotThrow("document.body.webkitMatchesSelector('*|pre')");
    4042        shouldNotThrow("document.querySelector('|pre')");
    4143        shouldNotThrow("document.querySelectorAll('|pre')");
     44        shouldNotThrow("document.body.matches('|pre')");
    4245        shouldNotThrow("document.body.webkitMatchesSelector('|pre')");
    4346
    4447        shouldThrow("document.querySelector('div bbb|pre')");
    4548        shouldThrow("document.querySelectorAll('div bbb|pre')");
     49        shouldThrow("document.body.matches('div bbb|pre')");
    4650        shouldThrow("document.body.webkitMatchesSelector('div bbb|pre')");
    4751        shouldNotThrow("document.querySelector('div *|pre')");
    4852        shouldNotThrow("document.querySelectorAll('div *|pre')");
     53        shouldNotThrow("document.body.matches('div *|pre')");
    4954        shouldNotThrow("document.body.webkitMatchesSelector('div *|pre')");
    5055        shouldNotThrow("document.querySelector('div |pre')");
    5156        shouldNotThrow("document.querySelectorAll('div |pre')");
     57        shouldNotThrow("document.body.matches('div |pre')");
    5258        shouldNotThrow("document.body.webkitMatchesSelector('div |pre')");
    5359
    5460        shouldThrow("document.querySelector('[bbb|name=value]')");
    5561        shouldThrow("document.querySelectorAll('[bbb|name=value]')");
     62        shouldThrow("document.body.matches('[bbb|name=value]')");
    5663        shouldThrow("document.body.webkitMatchesSelector('[bbb|name=value]')");
    5764        shouldNotThrow("document.querySelector('[*|name=value]')");
    5865        shouldNotThrow("document.querySelectorAll('[*|name=value]')");
     66        shouldNotThrow("document.body.matches('[*|name=value]')");
    5967        shouldNotThrow("document.body.webkitMatchesSelector('[*|name=value]')");
    6068        shouldNotThrow("document.querySelector('[|name=value]')");
    6169        shouldNotThrow("document.querySelectorAll('[|name=value]')");
     70        shouldNotThrow("document.body.matches('[|name=value]')");
    6271        shouldNotThrow("document.body.webkitMatchesSelector('[|name=value]')");
    6372
     
    6675        shouldThrow("document.querySelector('div [bbb|name=value]')");
    6776        shouldThrow("document.querySelectorAll('div [bbb|name=value]')");
     77        shouldThrow("document.body.matches('div [bbb|name=value]')");
    6878        shouldThrow("document.body.webkitMatchesSelector('div [bbb|name=value]')");
    6979        shouldNotThrow("document.querySelector('div [*|name=value]')");
    7080        shouldNotThrow("document.querySelectorAll('div [*|name=value]')");
     81        shouldNotThrow("document.body.matches('div [*|name=value]')");
    7182        shouldNotThrow("document.body.webkitMatchesSelector('div [*|name=value]')");
    7283        shouldNotThrow("document.querySelector('div [|name=value]')");
    7384        shouldNotThrow("document.querySelectorAll('div [|name=value]')");
     85        shouldNotThrow("document.body.matches('div [|name=value]')");
    7486        shouldNotThrow("document.body.webkitMatchesSelector('div [|name=value]')");
    7587    }
  • trunk/LayoutTests/fast/dom/SelectorAPI/script-tests/detached-element.js

    r98407 r167584  
    2020shouldBe("noChild.querySelectorAll('div').length", "0");
    2121
     22shouldBeTrue("correctNode.matches('div')");
     23shouldBeTrue("correctNode.matches('#testId')");
    2224shouldBeTrue("correctNode.webkitMatchesSelector('div')");
    2325shouldBeTrue("correctNode.webkitMatchesSelector('#testId')");
  • trunk/LayoutTests/fast/dom/SelectorAPI/script-tests/undefined-null-stringify.js

    r98407 r167584  
    1818shouldBe("document.querySelectorAll(undefined).item(0)", "undefinedNode");
    1919
     20shouldBeTrue("nullNode.matches(null)");
     21shouldBeTrue("undefinedNode.matches(undefined)");
    2022shouldBeTrue("nullNode.webkitMatchesSelector(null)");
    2123shouldBeTrue("undefinedNode.webkitMatchesSelector(undefined)");
  • trunk/LayoutTests/fast/dom/SelectorAPI/script-tests/viewless-document.js

    r98407 r167584  
    2121shouldBe("testDoc.querySelectorAll('p span').length", "1");
    2222
     23shouldBeTrue("p1.matches('p')");
     24shouldBeTrue("s1.matches('p span')");
     25shouldBeTrue("s2.matches('#s2')");
     26shouldBeTrue("d1.matches('.d1')");
    2327shouldBeTrue("p1.webkitMatchesSelector('p')");
    2428shouldBeTrue("s1.webkitMatchesSelector('p span')");
  • trunk/LayoutTests/fast/dom/SelectorAPI/undefined-null-stringify-expected.txt

    r48723 r167584  
    1010PASS document.querySelectorAll(undefined).length is 1
    1111PASS document.querySelectorAll(undefined).item(0) is undefinedNode
     12PASS nullNode.matches(null) is true
     13PASS undefinedNode.matches(undefined) is true
    1214PASS nullNode.webkitMatchesSelector(null) is true
    1315PASS undefinedNode.webkitMatchesSelector(undefined) is true
  • trunk/LayoutTests/fast/dom/SelectorAPI/viewless-document-expected.txt

    r48723 r167584  
    99PASS testDoc.querySelector('.d1') is d1
    1010PASS testDoc.querySelectorAll('p span').length is 1
     11PASS p1.matches('p') is true
     12PASS s1.matches('p span') is true
     13PASS s2.matches('#s2') is true
     14PASS d1.matches('.d1') is true
    1115PASS p1.webkitMatchesSelector('p') is true
    1216PASS s1.webkitMatchesSelector('p span') is true
  • trunk/LayoutTests/fast/forms/radio/radio-live-validation-style-expected.txt

    r137565 r167584  
    77PASS backgroundOf($("radio1")) is validColor
    88PASS parent.removeChild($("radio2")); backgroundOf($("radio1")) is invalidColor
    9 PASS $("radio1").remove(); radio2.webkitMatchesSelector(":valid") is false
     9PASS $("radio1").remove(); radio2.matches(":valid") is false
     10PASS radio2.remove(); radio2.matches(":valid") is true
     11FAIL $("radio1").remove(); radio2.webkitMatchesSelector(":valid") should be false. Threw exception TypeError: null is not an object (evaluating '$("radio1").remove')
    1012PASS radio2.remove(); radio2.webkitMatchesSelector(":valid") is true
    1113
  • trunk/LayoutTests/fast/forms/radio/radio-live-validation-style.html

    r155268 r167584  
    3535    '<input type=radio name=group1 required id=radio3>';
    3636var radio2 = $('radio2');
     37shouldBeFalse('$("radio1").remove(); radio2.matches(":valid")');
     38shouldBeTrue('radio2.remove(); radio2.matches(":valid")');
    3739shouldBeFalse('$("radio1").remove(); radio2.webkitMatchesSelector(":valid")');
    3840shouldBeTrue('radio2.remove(); radio2.webkitMatchesSelector(":valid")');
  • trunk/LayoutTests/fast/harness/results.html

    r159374 r167584  
    274274function matchesSelector(node, selector)
    275275{
     276    if (node.matches)
     277        return node.matches(selector);
     278
    276279    if (node.webkitMatchesSelector)
    277280        return node.webkitMatchesSelector(selector);
  • trunk/Source/WebCore/ChangeLog

    r167582 r167584  
     12014-04-20  Benjamin Poulain  <benjamin@webkit.org>
     2
     3        Add Element.matches, the standard name for webkitMatchesSelector
     4        https://bugs.webkit.org/show_bug.cgi?id=131922
     5
     6        Reviewed by Andreas Kling.
     7
     8        This patch just renames webkitMatchesSelector() to matches().
     9
     10        * bindings/scripts/CodeGeneratorObjC.pm:
     11        (GenerateImplementation):
     12        The Objective-C binding generator only supported ImplementedAs for getters and setters.
     13        This adds support for the option so that Element.matches can be generated for Obj-C.
     14
     15        * dom/Element.cpp:
     16        (WebCore::Element::matches):
     17        (WebCore::Element::webkitMatchesSelector): Deleted.
     18        * dom/Element.h:
     19        * dom/Element.idl:
     20        * inspector/InspectorCSSAgent.cpp:
     21        (WebCore::InspectorCSSAgent::buildArrayForMatchedRuleList):
     22
    1232014-04-20  Zalan Bujtas  <zalan@apple.com>
    224
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm

    r165676 r167584  
    15601560                $content = "${implementedBy}::" . $codeGenerator->WK_lcfirst($functionName) . "(" . join(", ", @parameterNames) . ")";
    15611561            } else {
    1562                 $content = "$caller->" . $codeGenerator->WK_lcfirst($functionName) . "(" . join(", ", @parameterNames) . ")";
     1562                my $functionImplementationName = $function->signature->extendedAttributes->{"ImplementedAs"} || $codeGenerator->WK_lcfirst($functionName);
     1563                $content = "$caller->" . $functionImplementationName . "(" . join(", ", @parameterNames) . ")";
    15631564            }
    15641565
  • trunk/Source/WebCore/dom/Element.cpp

    r167560 r167584  
    22972297}
    22982298
    2299 bool Element::webkitMatchesSelector(const String& selector, ExceptionCode& ec)
     2299bool Element::matches(const String& selector, ExceptionCode& ec)
    23002300{
    23012301    SelectorQuery* selectorQuery = document().selectorQueryForString(selector, ec);
  • trunk/Source/WebCore/dom/Element.h

    r167210 r167584  
    457457    virtual bool matchesReadOnlyPseudoClass() const;
    458458    virtual bool matchesReadWritePseudoClass() const;
    459     bool webkitMatchesSelector(const String& selectors, ExceptionCode&);
     459    bool matches(const String& selectors, ExceptionCode&);
    460460    virtual bool shouldAppearIndeterminate() const;
    461461
  • trunk/Source/WebCore/dom/Element.idl

    r167466 r167584  
    108108    [RaisesException] NodeList querySelectorAll(DOMString selectors);
    109109
    110     // WebKit extension, pending specification.
    111     [RaisesException] boolean webkitMatchesSelector([Default=Undefined] optional DOMString selectors);
     110    [RaisesException] boolean matches([Default=Undefined] optional DOMString selectors);
     111    [ImplementedAs=matches, RaisesException] boolean webkitMatchesSelector([Default=Undefined] optional DOMString selectors);
    112112
    113113    // ElementTraversal API
  • trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp

    r167571 r167584  
    11591159        long index = 0;
    11601160        for (const CSSSelector* selector = selectorList.first(); selector; selector = CSSSelectorList::next(selector)) {
    1161             bool matched = element->webkitMatchesSelector(selector->selectorText(), IGNORE_EXCEPTION);
     1161            bool matched = element->matches(selector->selectorText(), IGNORE_EXCEPTION);
    11621162            if (matched)
    11631163                matchingSelectors->addItem(index);
Note: See TracChangeset for help on using the changeset viewer.