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 848997d6c88f22379c2ac5d9a3375dc933c78292..c4a0b8f647aba385ff1326da1c8f0951ce0b81bb 100644 |
--- a/sdk/lib/html/dart2js/html_dart2js.dart |
+++ b/sdk/lib/html/dart2js/html_dart2js.dart |
@@ -6183,7 +6183,6 @@ class DocumentFragment extends Node native "*DocumentFragment" { |
_emptyStyleFuture(); |
Future<CssStyleDeclaration> getComputedStyle(String pseudoElement) => |
_emptyStyleFuture(); |
- bool matchesSelector(String selectors) => false; |
// Imperative Element methods are made into no-ops, as they are on parentless |
// elements. |
@@ -7697,6 +7696,22 @@ abstract class Element extends Node implements ElementTraversal native "*Element |
} |
} |
+ /** |
+ * Checks if this element matches the CSS selectors. |
+ */ |
+ @Experimental() |
+ bool matches(String selectors) { |
+ if (JS('bool', '!!#.matches', this)) { |
+ return JS('bool', '#.matches(#)', this, selectors); |
+ } else if (JS('bool', '!!#.webkitMatchesSelector', this)) { |
+ return JS('bool', '#.webkitMatchesSelector(#)', this, selectors); |
+ } else if (JS('bool', '!!#.mozMatchesSelector', this)) { |
+ return JS('bool', '#.mozMatchesSelector(#)', this, selectors); |
+ } else if (JS('bool', '!!#.msMatchesSelector', this)) { |
+ return JS('bool', '#.msMatchesSelector(#)', this, selectors); |
+ } |
+ } |
+ |
/// @domName EventTarget.addEventListener, EventTarget.removeEventListener, EventTarget.dispatchEvent; @docsEditable true |
ElementEvents get on => |
@@ -7908,10 +7923,6 @@ abstract class Element extends Node implements ElementTraversal native "*Element |
/// @domName Element.webkitCreateShadowRoot; @docsEditable true |
ShadowRoot webkitCreateShadowRoot() native; |
- /// @domName Element.webkitMatchesSelector; @docsEditable true |
- @JSName('webkitMatchesSelector') |
- bool matchesSelector(String selectors) native; |
- |
/// @domName Element.webkitRequestFullScreen; @docsEditable true |
void webkitRequestFullScreen(int flags) native; |