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

Side by Side 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 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:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 library html; 1 library html;
2 2
3 import 'dart:collection'; 3 import 'dart:collection';
4 import 'dart:html_common'; 4 import 'dart:html_common';
5 import 'dart:indexed_db'; 5 import 'dart:indexed_db';
6 import 'dart:isolate'; 6 import 'dart:isolate';
7 import 'dart:json'; 7 import 'dart:json';
8 import 'dart:svg' as svg; 8 import 'dart:svg' as svg;
9 import 'dart:web_audio' as web_audio; 9 import 'dart:web_audio' as web_audio;
10 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 10 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
(...skipping 6165 matching lines...) Expand 10 before | Expand all | Expand 10 after
6176 Element get offsetParent => null; 6176 Element get offsetParent => null;
6177 Element get parent => null; 6177 Element get parent => null;
6178 Map<String, String> get attributes => const {}; 6178 Map<String, String> get attributes => const {};
6179 CssClassSet get classes => new _FrozenCssClassSet(); 6179 CssClassSet get classes => new _FrozenCssClassSet();
6180 Map<String, String> get dataAttributes => const {}; 6180 Map<String, String> get dataAttributes => const {};
6181 CssStyleDeclaration get style => new Element.tag('div').style; 6181 CssStyleDeclaration get style => new Element.tag('div').style;
6182 Future<CssStyleDeclaration> get computedStyle => 6182 Future<CssStyleDeclaration> get computedStyle =>
6183 _emptyStyleFuture(); 6183 _emptyStyleFuture();
6184 Future<CssStyleDeclaration> getComputedStyle(String pseudoElement) => 6184 Future<CssStyleDeclaration> getComputedStyle(String pseudoElement) =>
6185 _emptyStyleFuture(); 6185 _emptyStyleFuture();
6186 bool matchesSelector(String selectors) => false;
6187 6186
6188 // Imperative Element methods are made into no-ops, as they are on parentless 6187 // Imperative Element methods are made into no-ops, as they are on parentless
6189 // elements. 6188 // elements.
6190 void blur() {} 6189 void blur() {}
6191 void focus() {} 6190 void focus() {}
6192 void click() {} 6191 void click() {}
6193 void scrollByLines(int lines) {} 6192 void scrollByLines(int lines) {}
6194 void scrollByPages(int pages) {} 6193 void scrollByPages(int pages) {}
6195 void scrollIntoView([bool centerIfNeeded]) {} 6194 void scrollIntoView([bool centerIfNeeded]) {}
6196 void webkitRequestFullScreen(int flags) {} 6195 void webkitRequestFullScreen(int flags) {}
(...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after
7690 this.nodes.add(node); 7689 this.nodes.add(node);
7691 break; 7690 break;
7692 case 'afterend': 7691 case 'afterend':
7693 this.parentNode.insertBefore(node, this.nextNode); 7692 this.parentNode.insertBefore(node, this.nextNode);
7694 break; 7693 break;
7695 default: 7694 default:
7696 throw new ArgumentError("Invalid position ${where}"); 7695 throw new ArgumentError("Invalid position ${where}");
7697 } 7696 }
7698 } 7697 }
7699 7698
7699 /**
7700 * Checks if this element matches the CSS selectors.
7701 */
7702 @Experimental()
7703 bool matches(String selectors) {
7704 if (JS('bool', '!!#.matches', this)) {
7705 return JS('bool', '#.matches(#)', this, selectors);
7706 } else if (JS('bool', '!!#.webkitMatchesSelector', this)) {
7707 return JS('bool', '#.webkitMatchesSelector(#)', this, selectors);
7708 } else if (JS('bool', '!!#.mozMatchesSelector', this)) {
7709 return JS('bool', '#.mozMatchesSelector(#)', this, selectors);
7710 } else if (JS('bool', '!!#.msMatchesSelector', this)) {
7711 return JS('bool', '#.msMatchesSelector(#)', this, selectors);
7712 }
7713 }
7714
7700 7715
7701 /// @domName EventTarget.addEventListener, EventTarget.removeEventListener, Ev entTarget.dispatchEvent; @docsEditable true 7716 /// @domName EventTarget.addEventListener, EventTarget.removeEventListener, Ev entTarget.dispatchEvent; @docsEditable true
7702 ElementEvents get on => 7717 ElementEvents get on =>
7703 new ElementEvents(this); 7718 new ElementEvents(this);
7704 7719
7705 /// @domName HTMLElement.children; @docsEditable true 7720 /// @domName HTMLElement.children; @docsEditable true
7706 @JSName('children') 7721 @JSName('children')
7707 final HtmlCollection $dom_children; 7722 final HtmlCollection $dom_children;
7708 7723
7709 /// @domName HTMLElement.contentEditable; @docsEditable true 7724 /// @domName HTMLElement.contentEditable; @docsEditable true
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
7901 @JSName('setAttribute') 7916 @JSName('setAttribute')
7902 void $dom_setAttribute(String name, String value) native; 7917 void $dom_setAttribute(String name, String value) native;
7903 7918
7904 /// @domName Element.setAttributeNS; @docsEditable true 7919 /// @domName Element.setAttributeNS; @docsEditable true
7905 @JSName('setAttributeNS') 7920 @JSName('setAttributeNS')
7906 void $dom_setAttributeNS(String namespaceURI, String qualifiedName, String val ue) native; 7921 void $dom_setAttributeNS(String namespaceURI, String qualifiedName, String val ue) native;
7907 7922
7908 /// @domName Element.webkitCreateShadowRoot; @docsEditable true 7923 /// @domName Element.webkitCreateShadowRoot; @docsEditable true
7909 ShadowRoot webkitCreateShadowRoot() native; 7924 ShadowRoot webkitCreateShadowRoot() native;
7910 7925
7911 /// @domName Element.webkitMatchesSelector; @docsEditable true
7912 @JSName('webkitMatchesSelector')
7913 bool matchesSelector(String selectors) native;
7914
7915 /// @domName Element.webkitRequestFullScreen; @docsEditable true 7926 /// @domName Element.webkitRequestFullScreen; @docsEditable true
7916 void webkitRequestFullScreen(int flags) native; 7927 void webkitRequestFullScreen(int flags) native;
7917 7928
7918 /// @domName Element.webkitRequestFullscreen; @docsEditable true 7929 /// @domName Element.webkitRequestFullscreen; @docsEditable true
7919 void webkitRequestFullscreen() native; 7930 void webkitRequestFullscreen() native;
7920 7931
7921 /// @domName Element.webkitRequestPointerLock; @docsEditable true 7932 /// @domName Element.webkitRequestPointerLock; @docsEditable true
7922 void webkitRequestPointerLock() native; 7933 void webkitRequestPointerLock() native;
7923 7934
7924 } 7935 }
(...skipping 17350 matching lines...) Expand 10 before | Expand all | Expand 10 after
25275 T next() { 25286 T next() {
25276 if (!hasNext) { 25287 if (!hasNext) {
25277 throw new StateError("No more elements"); 25288 throw new StateError("No more elements");
25278 } 25289 }
25279 return _array[_pos++]; 25290 return _array[_pos++];
25280 } 25291 }
25281 25292
25282 final List<T> _array; 25293 final List<T> _array;
25283 int _pos; 25294 int _pos;
25284 } 25295 }
OLDNEW
« 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