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

Unified Diff: sdk/lib/html/templates/html/impl/impl_Element.darttemplate

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 | « sdk/lib/html/templates/html/impl/impl_DocumentFragment.darttemplate ('k') | tests/html/element_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/templates/html/impl/impl_Element.darttemplate
diff --git a/sdk/lib/html/templates/html/impl/impl_Element.darttemplate b/sdk/lib/html/templates/html/impl/impl_Element.darttemplate
index fc2bcfb2b97b10c5e790c3be901f5586e85d8d67..d91420ea694ddd6a978e09846e2ab4ff85acc0b5 100644
--- a/sdk/lib/html/templates/html/impl/impl_Element.darttemplate
+++ b/sdk/lib/html/templates/html/impl/impl_Element.darttemplate
@@ -729,6 +729,22 @@ $if DART2JS
throw new ArgumentError("Invalid position ${where}");
}
}
+
+ /**
+ * 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);
+ }
+ }
$else
$endif
« no previous file with comments | « sdk/lib/html/templates/html/impl/impl_DocumentFragment.darttemplate ('k') | tests/html/element_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698