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

Unified Diff: sdk/lib/html/dart2js/html_dart2js.dart

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:
Download patch
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/dart2js/html_dart2js.dart
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index e1340e28788fdb9e9865eb1eb867808bbfe2a2f4..ad2b8914d2f4de463bf6c5ba20c0787dfa20fa9d 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -8654,7 +8654,18 @@ abstract class Element extends Node implements ElementTraversal native "*Element
/**
* 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)) {
@@ -8668,6 +8679,19 @@ abstract class Element extends Node implements ElementTraversal native "*Element
}
}
+ /**
+ * 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);
+ }
+
@DomName('Element.abort')
@DocsEditable
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698