Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2210)

Unified Diff: tools/dom/templates/html/impl/impl_Element.darttemplate

Issue 12040101: Adding supported checks for Element.matches. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/dom/scripts/generator.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/templates/html/impl/impl_Element.darttemplate
diff --git a/tools/dom/templates/html/impl/impl_Element.darttemplate b/tools/dom/templates/html/impl/impl_Element.darttemplate
index b554609c25a574d0d8b2ca83d67ff216d9dd1d45..41dd22b49ee35b496f55c2e46c6b737a2bd8c4f8 100644
--- a/tools/dom/templates/html/impl/impl_Element.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Element.darttemplate
@@ -895,7 +895,18 @@ $if DART2JS
/**
* Checks if this element matches the CSS selectors.
+ *
+ * Use [supportsMatches] to check if this is supported on the current
+ * platform.
+ *
+ * See also:
+ *
+ * * [supportsMatches]
*/
+ @SupportedBrowser(SupportedBrowser.CHROME)
+ @SupportedBrowser(SupportedBrowser.FIREFOX)
+ @SupportedBrowser(SupportedBrowser.IE, '10')
+ @SupportedBrowser(SupportedBrowser.SAFARI)
@Experimental
bool matches(String selectors) {
if (JS('bool', '!!#.matches', this)) {
@@ -908,7 +919,28 @@ $if DART2JS
return JS('bool', '#.msMatchesSelector(#)', this, selectors);
}
}
+
+ /**
+ * Checks if the matches function is supported on the current platform.
+ *
+ * See also:
+ *
+ * * [matches]
+ */
+ static bool get supportsMatches {
+ var e = new DivElement();
+ return JS('bool', '!!(#.matches || #.webkitMatchesSelector || '
+ '#.mozMatchesSelector || #.msMatchesSelector)', e, e, e, e);
+ }
$else
+ /**
+ * Checks if the matches function is supported on the current platform.
+ *
+ * See also:
+ *
+ * * [matches]
+ */
+ static bool get supportsMatches => true;
$endif
$!MEMBERS
« no previous file with comments | « tools/dom/scripts/generator.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698