matches method

bool matches (
  1. String selectors
)

Checks if this element matches the CSS selectors.

Implementation

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 if (JS('bool', '!!#.oMatchesSelector', this)) {
    return JS('bool', '#.oMatchesSelector(#)', this, selectors);
  } else {
    throw new UnsupportedError("Not supported on this platform");
  }
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.13.0/dart-html/Element/matches.html