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

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

Issue 11665030: Fixing Element.matches to be cross-platform and follow latest spec. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Adding experimental annotation. Created 8 years 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 | « 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 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;
« 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