mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 886308. Implement Element.matches. r=heycam
This commit is contained in:
parent
2595aca124
commit
0023ed4d23
@ -645,6 +645,8 @@ public:
|
||||
}
|
||||
bool HasAttributeNS(const nsAString& aNamespaceURI,
|
||||
const nsAString& aLocalName) const;
|
||||
bool Matches(const nsAString& aSelector,
|
||||
ErrorResult& aError);
|
||||
already_AddRefed<nsIHTMLCollection>
|
||||
GetElementsByTagName(const nsAString& aQualifiedName);
|
||||
already_AddRefed<nsIHTMLCollection>
|
||||
@ -654,7 +656,10 @@ public:
|
||||
already_AddRefed<nsIHTMLCollection>
|
||||
GetElementsByClassName(const nsAString& aClassNames);
|
||||
bool MozMatchesSelector(const nsAString& aSelector,
|
||||
ErrorResult& aError);
|
||||
ErrorResult& aError)
|
||||
{
|
||||
return Matches(aSelector, aError);
|
||||
}
|
||||
void SetPointerCapture(int32_t aPointerId, ErrorResult& aError)
|
||||
{
|
||||
bool activeState = false;
|
||||
|
@ -2736,8 +2736,7 @@ Element::SetTokenList(nsIAtom* aAtom, nsIVariant* aValue)
|
||||
}
|
||||
|
||||
bool
|
||||
Element::MozMatchesSelector(const nsAString& aSelector,
|
||||
ErrorResult& aError)
|
||||
Element::Matches(const nsAString& aSelector, ErrorResult& aError)
|
||||
{
|
||||
nsCSSSelectorList* selectorList = ParseSelectorList(aSelector, aError);
|
||||
if (!selectorList) {
|
||||
|
@ -651,3 +651,4 @@ support-files = file_bug503473-frame.sjs
|
||||
skip-if = buildapp == 'b2g' || e10s
|
||||
support-files = file_bug1011748_redirect.sjs file_bug1011748_OK.sjs
|
||||
[test_bug1025933.html]
|
||||
[test_element.matches.html]
|
||||
|
28
content/base/test/test_element.matches.html
Normal file
28
content/base/test/test_element.matches.html
Normal file
@ -0,0 +1,28 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=886308
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 886308</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 886308 **/
|
||||
ok(document.head.matches("head"), "head should match 'head'");
|
||||
ok(document.querySelector("link").matches("html *"), "link is a descendant of 'html'");
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=886308">Mozilla Bug 886308</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -52,6 +52,9 @@ interface Element : Node {
|
||||
[Pure]
|
||||
boolean hasAttributeNS(DOMString? namespace, DOMString localName);
|
||||
|
||||
[Throws, Pure]
|
||||
boolean matches(DOMString selector);
|
||||
|
||||
[Pure]
|
||||
HTMLCollection getElementsByTagName(DOMString localName);
|
||||
[Throws, Pure]
|
||||
|
Loading…
Reference in New Issue
Block a user