| OLD | NEW |
| 1 #library('htmlimpl'); | 1 #library('htmlimpl'); |
| 2 | 2 |
| 3 #import('dart:dom', prefix:'dom'); | 3 #import('dart:dom', prefix:'dom'); |
| 4 #import('dart:html'); | 4 #import('dart:html'); |
| 5 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 5 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 6 // for details. All rights reserved. Use of this source code is governed by a | 6 // for details. All rights reserved. Use of this source code is governed by a |
| 7 // BSD-style license that can be found in the LICENSE file. | 7 // BSD-style license that can be found in the LICENSE file. |
| 8 | 8 |
| 9 // DO NOT EDIT | 9 // DO NOT EDIT |
| 10 // Auto-generated Dart HTML library. | 10 // Auto-generated Dart HTML library. |
| (...skipping 14147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14158 | 14158 |
| 14159 DocumentEventsImplementation._wrap(_ptr) : super._wrap(_ptr); | 14159 DocumentEventsImplementation._wrap(_ptr) : super._wrap(_ptr); |
| 14160 | 14160 |
| 14161 EventListenerList get readyStateChange() => _get('readystatechange'); | 14161 EventListenerList get readyStateChange() => _get('readystatechange'); |
| 14162 | 14162 |
| 14163 EventListenerList get selectionChange() => _get('selectionchange'); | 14163 EventListenerList get selectionChange() => _get('selectionchange'); |
| 14164 | 14164 |
| 14165 EventListenerList get contentLoaded() => _get('DOMContentLoaded'); | 14165 EventListenerList get contentLoaded() => _get('DOMContentLoaded'); |
| 14166 } | 14166 } |
| 14167 | 14167 |
| 14168 /** @domName Document, HTMLDocument */ |
| 14168 class DocumentWrappingImplementation extends ElementWrappingImplementation imple
ments Document { | 14169 class DocumentWrappingImplementation extends ElementWrappingImplementation imple
ments Document { |
| 14169 | 14170 |
| 14170 final _documentPtr; | 14171 final _documentPtr; |
| 14171 | 14172 |
| 14172 DocumentWrappingImplementation._wrap(this._documentPtr, ptr) : super._wrap(ptr
) { | 14173 DocumentWrappingImplementation._wrap(this._documentPtr, ptr) : super._wrap(ptr
) { |
| 14173 // We have to set the back ptr on the document as well as the documentElemen
t | 14174 // We have to set the back ptr on the document as well as the documentElemen
t |
| 14174 // so that it is always simple to detect when an existing wrapper exists. | 14175 // so that it is always simple to detect when an existing wrapper exists. |
| 14175 _documentPtr.dartObjectLocalStorage = this; | 14176 _documentPtr.dartObjectLocalStorage = this; |
| 14176 } | 14177 } |
| 14177 | 14178 |
| 14178 /** @domName HTMLDocument.activeElement */ | 14179 /** @domName activeElement */ |
| 14179 Element get activeElement() => LevelDom.wrapElement(_documentPtr.activeElement
); | 14180 Element get activeElement() => LevelDom.wrapElement(_documentPtr.activeElement
); |
| 14180 | 14181 |
| 14181 Node get parent() => null; | 14182 Node get parent() => null; |
| 14182 | 14183 |
| 14183 /** @domName Document.body */ | 14184 /** @domName body */ |
| 14184 Element get body() => LevelDom.wrapElement(_documentPtr.body); | 14185 Element get body() => LevelDom.wrapElement(_documentPtr.body); |
| 14185 | 14186 |
| 14186 /** @domName Document.body */ | 14187 /** @domName body */ |
| 14187 void set body(Element value) { _documentPtr.body = LevelDom.unwrap(value); } | 14188 void set body(Element value) { _documentPtr.body = LevelDom.unwrap(value); } |
| 14188 | 14189 |
| 14189 /** @domName Document.charset */ | 14190 /** @domName charset */ |
| 14190 String get charset() => _documentPtr.charset; | 14191 String get charset() => _documentPtr.charset; |
| 14191 | 14192 |
| 14192 /** @domName Document.charset */ | 14193 /** @domName charset */ |
| 14193 void set charset(String value) { _documentPtr.charset = value; } | 14194 void set charset(String value) { _documentPtr.charset = value; } |
| 14194 | 14195 |
| 14195 /** @domName Document.cookie */ | 14196 /** @domName cookie */ |
| 14196 String get cookie() => _documentPtr.cookie; | 14197 String get cookie() => _documentPtr.cookie; |
| 14197 | 14198 |
| 14198 /** @domName Document.cookie */ | 14199 /** @domName cookie */ |
| 14199 void set cookie(String value) { _documentPtr.cookie = value; } | 14200 void set cookie(String value) { _documentPtr.cookie = value; } |
| 14200 | 14201 |
| 14201 /** @domName Document.defaultView */ | 14202 /** @domName defaultView */ |
| 14202 Window get window() => LevelDom.wrapWindow(_documentPtr.defaultView); | 14203 Window get window() => LevelDom.wrapWindow(_documentPtr.defaultView); |
| 14203 | 14204 |
| 14204 /** @domName HTMLDocument.designMode */ | 14205 /** @domName designMode */ |
| 14205 void set designMode(String value) { _documentPtr.designMode = value; } | 14206 void set designMode(String value) { _documentPtr.designMode = value; } |
| 14206 | 14207 |
| 14207 /** @domName Document.domain */ | 14208 /** @domName domain */ |
| 14208 String get domain() => _documentPtr.domain; | 14209 String get domain() => _documentPtr.domain; |
| 14209 | 14210 |
| 14210 /** @domName Document.head */ | 14211 /** @domName head */ |
| 14211 HeadElement get head() => LevelDom.wrapHeadElement(_documentPtr.head); | 14212 HeadElement get head() => LevelDom.wrapHeadElement(_documentPtr.head); |
| 14212 | 14213 |
| 14213 /** @domName Document.lastModified */ | 14214 /** @domName lastModified */ |
| 14214 String get lastModified() => _documentPtr.lastModified; | 14215 String get lastModified() => _documentPtr.lastModified; |
| 14215 | 14216 |
| 14216 /** @domName Document.readyState */ | 14217 /** @domName readyState */ |
| 14217 String get readyState() => _documentPtr.readyState; | 14218 String get readyState() => _documentPtr.readyState; |
| 14218 | 14219 |
| 14219 /** @domName Document.referrer */ | 14220 /** @domName referrer */ |
| 14220 String get referrer() => _documentPtr.referrer; | 14221 String get referrer() => _documentPtr.referrer; |
| 14221 | 14222 |
| 14222 /** @domName Document.styleSheets */ | 14223 /** @domName styleSheets */ |
| 14223 StyleSheetList get styleSheets() => LevelDom.wrapStyleSheetList(_documentPtr.s
tyleSheets); | 14224 StyleSheetList get styleSheets() => LevelDom.wrapStyleSheetList(_documentPtr.s
tyleSheets); |
| 14224 | 14225 |
| 14225 /** @domName Document.title */ | 14226 /** @domName title */ |
| 14226 String get title() => _documentPtr.title; | 14227 String get title() => _documentPtr.title; |
| 14227 | 14228 |
| 14228 /** @domName Document.title */ | 14229 /** @domName title */ |
| 14229 void set title(String value) { _documentPtr.title = value; } | 14230 void set title(String value) { _documentPtr.title = value; } |
| 14230 | 14231 |
| 14231 /** @domName Document.webkitHidden */ | 14232 /** @domName webkitHidden */ |
| 14232 bool get webkitHidden() => _documentPtr.webkitHidden; | 14233 bool get webkitHidden() => _documentPtr.webkitHidden; |
| 14233 | 14234 |
| 14234 /** @domName Document.webkitVisibilityState */ | 14235 /** @domName webkitVisibilityState */ |
| 14235 String get webkitVisibilityState() => _documentPtr.webkitVisibilityState; | 14236 String get webkitVisibilityState() => _documentPtr.webkitVisibilityState; |
| 14236 | 14237 |
| 14237 /** @domName Document.caretRangeFromPoint */ | 14238 /** @domName caretRangeFromPoint */ |
| 14238 Future<Range> caretRangeFromPoint([int x = null, int y = null]) { | 14239 Future<Range> caretRangeFromPoint([int x = null, int y = null]) { |
| 14239 return _createMeasurementFuture( | 14240 return _createMeasurementFuture( |
| 14240 () => LevelDom.wrapRange(_documentPtr.caretRangeFromPoint(x, y)), | 14241 () => LevelDom.wrapRange(_documentPtr.caretRangeFromPoint(x, y)), |
| 14241 new Completer<Range>()); | 14242 new Completer<Range>()); |
| 14242 } | 14243 } |
| 14243 | 14244 |
| 14244 /** @domName Document.createElement */ | 14245 /** @domName createElement */ |
| 14245 Element createElement([String tagName = null]) { | 14246 Element createElement([String tagName = null]) { |
| 14246 return LevelDom.wrapElement(_documentPtr.createElement(tagName)); | 14247 return LevelDom.wrapElement(_documentPtr.createElement(tagName)); |
| 14247 } | 14248 } |
| 14248 | 14249 |
| 14249 /** @domName Document.createEvent */ | 14250 /** @domName createEvent */ |
| 14250 Event createEvent([String eventType = null]) { | 14251 Event createEvent([String eventType = null]) { |
| 14251 return LevelDom.wrapEvent(_documentPtr.createEvent(eventType)); | 14252 return LevelDom.wrapEvent(_documentPtr.createEvent(eventType)); |
| 14252 } | 14253 } |
| 14253 | 14254 |
| 14254 /** @domName Document.elementFromPoint */ | 14255 /** @domName elementFromPoint */ |
| 14255 Future<Element> elementFromPoint([int x = null, int y = null]) { | 14256 Future<Element> elementFromPoint([int x = null, int y = null]) { |
| 14256 return _createMeasurementFuture( | 14257 return _createMeasurementFuture( |
| 14257 () => LevelDom.wrapElement(_documentPtr.elementFromPoint(x, y)), | 14258 () => LevelDom.wrapElement(_documentPtr.elementFromPoint(x, y)), |
| 14258 new Completer<Element>()); | 14259 new Completer<Element>()); |
| 14259 } | 14260 } |
| 14260 | 14261 |
| 14261 /** @domName Document.execCommand */ | 14262 /** @domName execCommand */ |
| 14262 bool execCommand([String command = null, bool userInterface = null, String val
ue = null]) { | 14263 bool execCommand([String command = null, bool userInterface = null, String val
ue = null]) { |
| 14263 return _documentPtr.execCommand(command, userInterface, value); | 14264 return _documentPtr.execCommand(command, userInterface, value); |
| 14264 } | 14265 } |
| 14265 | 14266 |
| 14266 /** @domName Document.getCSSCanvasContext */ | 14267 /** @domName getCSSCanvasContext */ |
| 14267 CanvasRenderingContext getCSSCanvasContext(String contextId, String name, | 14268 CanvasRenderingContext getCSSCanvasContext(String contextId, String name, |
| 14268 int width, int height) { | 14269 int width, int height) { |
| 14269 return LevelDom.wrapCanvasRenderingContext(_documentPtr.getCSSCanvasContext(
contextId, name, width, height)); | 14270 return LevelDom.wrapCanvasRenderingContext(_documentPtr.getCSSCanvasContext(
contextId, name, width, height)); |
| 14270 } | 14271 } |
| 14271 | 14272 |
| 14272 /** @domName Document.queryCommandEnabled */ | 14273 /** @domName queryCommandEnabled */ |
| 14273 bool queryCommandEnabled([String command = null]) { | 14274 bool queryCommandEnabled([String command = null]) { |
| 14274 return _documentPtr.queryCommandEnabled(command); | 14275 return _documentPtr.queryCommandEnabled(command); |
| 14275 } | 14276 } |
| 14276 | 14277 |
| 14277 /** @domName Document.queryCommandIndeterm */ | 14278 /** @domName queryCommandIndeterm */ |
| 14278 bool queryCommandIndeterm([String command = null]) { | 14279 bool queryCommandIndeterm([String command = null]) { |
| 14279 return _documentPtr.queryCommandIndeterm(command); | 14280 return _documentPtr.queryCommandIndeterm(command); |
| 14280 } | 14281 } |
| 14281 | 14282 |
| 14282 /** @domName Document.queryCommandState */ | 14283 /** @domName queryCommandState */ |
| 14283 bool queryCommandState([String command = null]) { | 14284 bool queryCommandState([String command = null]) { |
| 14284 return _documentPtr.queryCommandState(command); | 14285 return _documentPtr.queryCommandState(command); |
| 14285 } | 14286 } |
| 14286 | 14287 |
| 14287 /** @domName Document.queryCommandSupported */ | 14288 /** @domName queryCommandSupported */ |
| 14288 bool queryCommandSupported([String command = null]) { | 14289 bool queryCommandSupported([String command = null]) { |
| 14289 return _documentPtr.queryCommandSupported(command); | 14290 return _documentPtr.queryCommandSupported(command); |
| 14290 } | 14291 } |
| 14291 | 14292 |
| 14292 /** @domName Document.queryCommandValue */ | 14293 /** @domName queryCommandValue */ |
| 14293 String queryCommandValue([String command = null]) { | 14294 String queryCommandValue([String command = null]) { |
| 14294 return _documentPtr.queryCommandValue(command); | 14295 return _documentPtr.queryCommandValue(command); |
| 14295 } | 14296 } |
| 14296 | 14297 |
| 14298 /** @domName HTMLHtmlElement.manifest */ |
| 14297 String get manifest() => _ptr.manifest; | 14299 String get manifest() => _ptr.manifest; |
| 14298 | 14300 |
| 14301 /** @domName HTMLHtmlElement.manifest */ |
| 14299 void set manifest(String value) { _ptr.manifest = value; } | 14302 void set manifest(String value) { _ptr.manifest = value; } |
| 14300 | 14303 |
| 14301 DocumentEvents get on() { | 14304 DocumentEvents get on() { |
| 14302 if (_on === null) { | 14305 if (_on === null) { |
| 14303 _on = new DocumentEventsImplementation._wrap(_ptr); | 14306 _on = new DocumentEventsImplementation._wrap(_ptr); |
| 14304 } | 14307 } |
| 14305 return _on; | 14308 return _on; |
| 14306 } | 14309 } |
| 14307 } | 14310 } |
| 14308 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 14311 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14647 bool containsValue(String value) { | 14650 bool containsValue(String value) { |
| 14648 final attributes = _element.attributes; | 14651 final attributes = _element.attributes; |
| 14649 for (int i = 0, len = attributes.length; i < len; i++) { | 14652 for (int i = 0, len = attributes.length; i < len; i++) { |
| 14650 if(value == attributes.item(i).value) { | 14653 if(value == attributes.item(i).value) { |
| 14651 return true; | 14654 return true; |
| 14652 } | 14655 } |
| 14653 } | 14656 } |
| 14654 return false; | 14657 return false; |
| 14655 } | 14658 } |
| 14656 | 14659 |
| 14657 /** @domName Element.hasAttribute */ | |
| 14658 bool containsKey(String key) { | 14660 bool containsKey(String key) { |
| 14659 return _element.hasAttribute(key); | 14661 return _element.hasAttribute(key); |
| 14660 } | 14662 } |
| 14661 | 14663 |
| 14662 /** @domName Element.getAttribute */ | |
| 14663 String operator [](String key) { | 14664 String operator [](String key) { |
| 14664 return _element.getAttribute(key); | 14665 return _element.getAttribute(key); |
| 14665 } | 14666 } |
| 14666 | 14667 |
| 14667 /** @domName Element.setAttribute */ | |
| 14668 void operator []=(String key, String value) { | 14668 void operator []=(String key, String value) { |
| 14669 _element.setAttribute(key, value); | 14669 _element.setAttribute(key, value); |
| 14670 } | 14670 } |
| 14671 | 14671 |
| 14672 String putIfAbsent(String key, String ifAbsent()) { | 14672 String putIfAbsent(String key, String ifAbsent()) { |
| 14673 if (!containsKey(key)) { | 14673 if (!containsKey(key)) { |
| 14674 this[key] = ifAbsent(); | 14674 this[key] = ifAbsent(); |
| 14675 } | 14675 } |
| 14676 } | 14676 } |
| 14677 | 14677 |
| 14678 /** @domName Element.removeAttribute */ | |
| 14679 String remove(String key) { | 14678 String remove(String key) { |
| 14680 _element.removeAttribute(key); | 14679 _element.removeAttribute(key); |
| 14681 } | 14680 } |
| 14682 | 14681 |
| 14683 void clear() { | 14682 void clear() { |
| 14684 final attributes = _element.attributes; | 14683 final attributes = _element.attributes; |
| 14685 for (int i = attributes.length - 1; i >= 0; i--) { | 14684 for (int i = attributes.length - 1; i >= 0; i--) { |
| 14686 _element.removeAttribute(attributes.item(i).name); | 14685 _element.removeAttribute(attributes.item(i).name); |
| 14687 } | 14686 } |
| 14688 } | 14687 } |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14839 | 14838 |
| 14840 List<ClientRect> get clientRects() { | 14839 List<ClientRect> get clientRects() { |
| 14841 final out = new List(_clientRects.length); | 14840 final out = new List(_clientRects.length); |
| 14842 for (num i = 0; i < _clientRects.length; i++) { | 14841 for (num i = 0; i < _clientRects.length; i++) { |
| 14843 out[i] = LevelDom.wrapClientRect(_clientRects.item(i)); | 14842 out[i] = LevelDom.wrapClientRect(_clientRects.item(i)); |
| 14844 } | 14843 } |
| 14845 return out; | 14844 return out; |
| 14846 } | 14845 } |
| 14847 } | 14846 } |
| 14848 | 14847 |
| 14848 /** @domName Element, HTMLElement */ |
| 14849 class ElementWrappingImplementation extends NodeWrappingImplementation implement
s Element { | 14849 class ElementWrappingImplementation extends NodeWrappingImplementation implement
s Element { |
| 14850 | 14850 |
| 14851 static final _START_TAG_REGEXP = const RegExp('<(\\w+)'); | 14851 static final _START_TAG_REGEXP = const RegExp('<(\\w+)'); |
| 14852 static final _CUSTOM_PARENT_TAG_MAP = const { | 14852 static final _CUSTOM_PARENT_TAG_MAP = const { |
| 14853 'body' : 'html', | 14853 'body' : 'html', |
| 14854 'head' : 'html', | 14854 'head' : 'html', |
| 14855 'caption' : 'table', | 14855 'caption' : 'table', |
| 14856 'td': 'tr', | 14856 'td': 'tr', |
| 14857 'tbody': 'table', | 14857 'tbody': 'table', |
| 14858 'colgroup': 'table', | 14858 'colgroup': 'table', |
| 14859 'col' : 'colgroup', | 14859 'col' : 'colgroup', |
| 14860 'tr' : 'tbody', | 14860 'tr' : 'tbody', |
| 14861 'tbody' : 'table', | 14861 'tbody' : 'table', |
| 14862 'tfoot' : 'table', | 14862 'tfoot' : 'table', |
| 14863 'thead' : 'table', | 14863 'thead' : 'table', |
| 14864 'track' : 'audio', | 14864 'track' : 'audio', |
| 14865 }; | 14865 }; |
| 14866 | 14866 |
| 14867 factory ElementWrappingImplementation.html(String html) { | 14867 /** @domName Document.createElement */ |
| 14868 factory ElementWrappingImplementation.html(String html) { |
| 14868 // TODO(jacobr): this method can be made more robust and performant. | 14869 // TODO(jacobr): this method can be made more robust and performant. |
| 14869 // 1) Cache the dummy parent elements required to use innerHTML rather than | 14870 // 1) Cache the dummy parent elements required to use innerHTML rather than |
| 14870 // creating them every call. | 14871 // creating them every call. |
| 14871 // 2) Verify that the html does not contain leading or trailing text nodes. | 14872 // 2) Verify that the html does not contain leading or trailing text nodes. |
| 14872 // 3) Verify that the html does not contain both <head> and <body> tags. | 14873 // 3) Verify that the html does not contain both <head> and <body> tags. |
| 14873 // 4) Detatch the created element from its dummy parent. | 14874 // 4) Detatch the created element from its dummy parent. |
| 14874 String parentTag = 'div'; | 14875 String parentTag = 'div'; |
| 14875 String tag; | 14876 String tag; |
| 14876 final match = _START_TAG_REGEXP.firstMatch(html); | 14877 final match = _START_TAG_REGEXP.firstMatch(html); |
| 14877 if (match !== null) { | 14878 if (match !== null) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 14888 } else if (parentTag == 'html' && temp.childElementCount == 2) { | 14889 } else if (parentTag == 'html' && temp.childElementCount == 2) { |
| 14889 // Work around for edge case in WebKit and possibly other browsers where | 14890 // Work around for edge case in WebKit and possibly other browsers where |
| 14890 // both body and head elements are created even though the inner html | 14891 // both body and head elements are created even though the inner html |
| 14891 // only contains a head or body element. | 14892 // only contains a head or body element. |
| 14892 return LevelDom.wrapElement(temp.children.item(tag == 'head' ? 0 : 1)); | 14893 return LevelDom.wrapElement(temp.children.item(tag == 'head' ? 0 : 1)); |
| 14893 } else { | 14894 } else { |
| 14894 throw 'HTML had ${temp.childElementCount} top level elements but 1 expecte
d'; | 14895 throw 'HTML had ${temp.childElementCount} top level elements but 1 expecte
d'; |
| 14895 } | 14896 } |
| 14896 } | 14897 } |
| 14897 | 14898 |
| 14899 /** @domName Document.createElement */ |
| 14898 factory ElementWrappingImplementation.tag(String tag) { | 14900 factory ElementWrappingImplementation.tag(String tag) { |
| 14899 return LevelDom.wrapElement(dom.document.createElement(tag)); | 14901 return LevelDom.wrapElement(dom.document.createElement(tag)); |
| 14900 } | 14902 } |
| 14901 | 14903 |
| 14902 ElementWrappingImplementation._wrap(ptr) : super._wrap(ptr); | 14904 ElementWrappingImplementation._wrap(ptr) : super._wrap(ptr); |
| 14903 | 14905 |
| 14904 ElementAttributeMap _elementAttributeMap; | 14906 ElementAttributeMap _elementAttributeMap; |
| 14905 ElementList _elements; | 14907 ElementList _elements; |
| 14906 _CssClassSet _cssClassSet; | 14908 _CssClassSet _cssClassSet; |
| 14907 _DataAttributeMap _dataAttributes; | 14909 _DataAttributeMap _dataAttributes; |
| 14908 | 14910 |
| 14911 /** |
| 14912 * @domName Element.hasAttribute, Element.getAttribute, Element.setAttribute, |
| 14913 * Element.removeAttribute |
| 14914 */ |
| 14909 Map<String, String> get attributes() { | 14915 Map<String, String> get attributes() { |
| 14910 if (_elementAttributeMap === null) { | 14916 if (_elementAttributeMap === null) { |
| 14911 _elementAttributeMap = new ElementAttributeMap._wrap(_ptr); | 14917 _elementAttributeMap = new ElementAttributeMap._wrap(_ptr); |
| 14912 } | 14918 } |
| 14913 return _elementAttributeMap; | 14919 return _elementAttributeMap; |
| 14914 } | 14920 } |
| 14915 | 14921 |
| 14916 void set attributes(Map<String, String> value) { | 14922 void set attributes(Map<String, String> value) { |
| 14917 Map<String, String> attributes = this.attributes; | 14923 Map<String, String> attributes = this.attributes; |
| 14918 attributes.clear(); | 14924 attributes.clear(); |
| 14919 for (String key in value.getKeys()) { | 14925 for (String key in value.getKeys()) { |
| 14920 attributes[key] = value[key]; | 14926 attributes[key] = value[key]; |
| 14921 } | 14927 } |
| 14922 } | 14928 } |
| 14923 | 14929 |
| 14924 void set elements(Collection<Element> value) { | 14930 void set elements(Collection<Element> value) { |
| 14925 // Copy list first since we don't want liveness during iteration. | 14931 // Copy list first since we don't want liveness during iteration. |
| 14926 List copy = new List.from(value); | 14932 List copy = new List.from(value); |
| 14927 final elements = this.elements; | 14933 final elements = this.elements; |
| 14928 elements.clear(); | 14934 elements.clear(); |
| 14929 elements.addAll(copy); | 14935 elements.addAll(copy); |
| 14930 } | 14936 } |
| 14931 | 14937 |
| 14938 /** |
| 14939 * @domName childElementCount, firstElementChild, lastElementChild, |
| 14940 * children |
| 14941 */ |
| 14932 ElementList get elements() { | 14942 ElementList get elements() { |
| 14933 if (_elements == null) { | 14943 if (_elements == null) { |
| 14934 _elements = new _ChildrenElementList._wrap(_ptr); | 14944 _elements = new _ChildrenElementList._wrap(_ptr); |
| 14935 } | 14945 } |
| 14936 return _elements; | 14946 return _elements; |
| 14937 } | 14947 } |
| 14938 | 14948 |
| 14949 /** @domName className, classList */ |
| 14939 Set<String> get classes() { | 14950 Set<String> get classes() { |
| 14940 if (_cssClassSet === null) { | 14951 if (_cssClassSet === null) { |
| 14941 _cssClassSet = new _CssClassSet(_ptr); | 14952 _cssClassSet = new _CssClassSet(_ptr); |
| 14942 } | 14953 } |
| 14943 return _cssClassSet; | 14954 return _cssClassSet; |
| 14944 } | 14955 } |
| 14945 | 14956 |
| 14946 void set classes(Collection<String> value) { | 14957 void set classes(Collection<String> value) { |
| 14947 _CssClassSet classSet = classes; | 14958 _CssClassSet classSet = classes; |
| 14948 classSet.clear(); | 14959 classSet.clear(); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15031 } | 15042 } |
| 15032 | 15043 |
| 15033 bool contains(Node element) { | 15044 bool contains(Node element) { |
| 15034 return _ptr.contains(LevelDom.unwrap(element)); | 15045 return _ptr.contains(LevelDom.unwrap(element)); |
| 15035 } | 15046 } |
| 15036 | 15047 |
| 15037 void focus() { | 15048 void focus() { |
| 15038 _ptr.focus(); | 15049 _ptr.focus(); |
| 15039 } | 15050 } |
| 15040 | 15051 |
| 15041 /** @domName HTMLElement.insertAdjacentElement */ | |
| 15042 Element insertAdjacentElement([String where = null, Element element = null]) { | 15052 Element insertAdjacentElement([String where = null, Element element = null]) { |
| 15043 return LevelDom.wrapElement(_ptr.insertAdjacentElement(where, LevelDom.unwra
p(element))); | 15053 return LevelDom.wrapElement(_ptr.insertAdjacentElement(where, LevelDom.unwra
p(element))); |
| 15044 } | 15054 } |
| 15045 | 15055 |
| 15046 /** @domName HTMLElement.insertAdjacentHTML */ | |
| 15047 void insertAdjacentHTML([String position_OR_where = null, String text = null])
{ | 15056 void insertAdjacentHTML([String position_OR_where = null, String text = null])
{ |
| 15048 _ptr.insertAdjacentHTML(position_OR_where, text); | 15057 _ptr.insertAdjacentHTML(position_OR_where, text); |
| 15049 } | 15058 } |
| 15050 | 15059 |
| 15051 /** @domName HTMLElement.insertAdjacentText */ | |
| 15052 void insertAdjacentText([String where = null, String text = null]) { | 15060 void insertAdjacentText([String where = null, String text = null]) { |
| 15053 _ptr.insertAdjacentText(where, text); | 15061 _ptr.insertAdjacentText(where, text); |
| 15054 } | 15062 } |
| 15055 | 15063 |
| 15056 Element query(String selectors) { | 15064 Element query(String selectors) { |
| 15057 // TODO(jacobr): scope fix. | 15065 // TODO(jacobr): scope fix. |
| 15058 return LevelDom.wrapElement(_ptr.querySelector(selectors)); | 15066 return LevelDom.wrapElement(_ptr.querySelector(selectors)); |
| 15059 } | 15067 } |
| 15060 | 15068 |
| 15069 /** |
| 15070 * @domName querySelectorAll, getElementsByClassName, getElementsByTagName, |
| 15071 * getElementsByTagNameNS |
| 15072 */ |
| 15061 ElementList queryAll(String selectors) { | 15073 ElementList queryAll(String selectors) { |
| 15062 // TODO(jacobr): scope fix. | 15074 // TODO(jacobr): scope fix. |
| 15063 return new FrozenElementList._wrap(_ptr.querySelectorAll(selectors)); | 15075 return new FrozenElementList._wrap(_ptr.querySelectorAll(selectors)); |
| 15064 } | 15076 } |
| 15065 | 15077 |
| 15066 void scrollByLines([int lines = null]) { | 15078 void scrollByLines([int lines = null]) { |
| 15067 _ptr.scrollByLines(lines); | 15079 _ptr.scrollByLines(lines); |
| 15068 } | 15080 } |
| 15069 | 15081 |
| 15070 void scrollByPages([int pages = null]) { | 15082 void scrollByPages([int pages = null]) { |
| 15071 _ptr.scrollByPages(pages); | 15083 _ptr.scrollByPages(pages); |
| 15072 } | 15084 } |
| 15073 | 15085 |
| 15086 /** @domName scrollIntoView, scrollIntoViewIfNeeded */ |
| 15074 void scrollIntoView([bool centerIfNeeded = null]) { | 15087 void scrollIntoView([bool centerIfNeeded = null]) { |
| 15075 _ptr.scrollIntoViewIfNeeded(centerIfNeeded); | 15088 _ptr.scrollIntoViewIfNeeded(centerIfNeeded); |
| 15076 } | 15089 } |
| 15077 | 15090 |
| 15078 bool matchesSelector([String selectors = null]) { | 15091 bool matchesSelector([String selectors = null]) { |
| 15079 return _ptr.webkitMatchesSelector(selectors); | 15092 return _ptr.webkitMatchesSelector(selectors); |
| 15080 } | 15093 } |
| 15081 | 15094 |
| 15082 void set scrollLeft(int value) { _ptr.scrollLeft = value; } | 15095 void set scrollLeft(int value) { _ptr.scrollLeft = value; } |
| 15083 | 15096 |
| 15084 void set scrollTop(int value) { _ptr.scrollTop = value; } | 15097 void set scrollTop(int value) { _ptr.scrollTop = value; } |
| 15085 | 15098 |
| 15086 /** @domName getClientRects */ | 15099 /** |
| 15100 * @domName getClientRects, getBoundingClientRect, clientHeight, clientWidth, |
| 15101 * clientTop, clientLeft, offsetHeight, offsetWidth, offsetTop, offsetLeft, |
| 15102 * scrollHeight, scrollWidth, scrollTop, scrollLeft |
| 15103 */ |
| 15087 Future<ElementRect> get rect() { | 15104 Future<ElementRect> get rect() { |
| 15088 return _createMeasurementFuture( | 15105 return _createMeasurementFuture( |
| 15089 () => new ElementRectWrappingImplementation(_ptr), | 15106 () => new ElementRectWrappingImplementation(_ptr), |
| 15090 new Completer<ElementRect>()); | 15107 new Completer<ElementRect>()); |
| 15091 } | 15108 } |
| 15092 | 15109 |
| 15110 /** @domName Window.getComputedStyle */ |
| 15093 Future<CSSStyleDeclaration> get computedStyle() { | 15111 Future<CSSStyleDeclaration> get computedStyle() { |
| 15094 // TODO(jacobr): last param should be null, see b/5045788 | 15112 // TODO(jacobr): last param should be null, see b/5045788 |
| 15095 return getComputedStyle(''); | 15113 return getComputedStyle(''); |
| 15096 } | 15114 } |
| 15097 | 15115 |
| 15098 /** @domName Window.getComputedStyle */ | 15116 /** @domName Window.getComputedStyle */ |
| 15099 Future<CSSStyleDeclaration> getComputedStyle(String pseudoElement) { | 15117 Future<CSSStyleDeclaration> getComputedStyle(String pseudoElement) { |
| 15100 return _createMeasurementFuture(() => | 15118 return _createMeasurementFuture(() => |
| 15101 LevelDom.wrapCSSStyleDeclaration( | 15119 LevelDom.wrapCSSStyleDeclaration( |
| 15102 dom.window.getComputedStyle(_ptr, pseudoElement)), | 15120 dom.window.getComputedStyle(_ptr, pseudoElement)), |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15522 | 15540 |
| 15523 String get data() => _ptr.data; | 15541 String get data() => _ptr.data; |
| 15524 | 15542 |
| 15525 String get lastEventId() => _ptr.lastEventId; | 15543 String get lastEventId() => _ptr.lastEventId; |
| 15526 | 15544 |
| 15527 MessagePort get messagePort() => LevelDom.wrapMessagePort(_ptr.messagePort); | 15545 MessagePort get messagePort() => LevelDom.wrapMessagePort(_ptr.messagePort); |
| 15528 | 15546 |
| 15529 String get origin() => _ptr.origin; | 15547 String get origin() => _ptr.origin; |
| 15530 | 15548 |
| 15531 Window get source() => LevelDom.wrapWindow(_ptr.source); | 15549 Window get source() => LevelDom.wrapWindow(_ptr.source); |
| 15532 | |
| 15533 void initMessageEvent(String typeArg, bool canBubbleArg, bool cancelableArg, S
tring dataArg, String originArg, String lastEventIdArg, Window sourceArg, Messag
ePort messagePort) { | |
| 15534 _ptr.initMessageEvent(typeArg, canBubbleArg, cancelableArg, dataArg, originA
rg, lastEventIdArg, LevelDom.unwrap(sourceArg), LevelDom.unwrap(messagePort)); | |
| 15535 return; | |
| 15536 } | |
| 15537 } | 15550 } |
| 15538 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 15551 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 15539 // for details. All rights reserved. Use of this source code is governed by a | 15552 // for details. All rights reserved. Use of this source code is governed by a |
| 15540 // BSD-style license that can be found in the LICENSE file. | 15553 // BSD-style license that can be found in the LICENSE file. |
| 15541 | 15554 |
| 15542 class MessagePortWrappingImplementation extends EventTargetWrappingImplementatio
n implements MessagePort { | 15555 class MessagePortWrappingImplementation extends EventTargetWrappingImplementatio
n implements MessagePort { |
| 15543 MessagePortWrappingImplementation._wrap(ptr) : super._wrap(ptr) {} | 15556 MessagePortWrappingImplementation._wrap(ptr) : super._wrap(ptr) {} |
| 15544 } | 15557 } |
| 15545 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 15558 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 15546 // for details. All rights reserved. Use of this source code is governed by a | 15559 // for details. All rights reserved. Use of this source code is governed by a |
| (...skipping 1747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17294 _ptr.setRequestHeader(header, value); | 17307 _ptr.setRequestHeader(header, value); |
| 17295 } | 17308 } |
| 17296 | 17309 |
| 17297 XMLHttpRequestEvents get on() { | 17310 XMLHttpRequestEvents get on() { |
| 17298 if (_on === null) { | 17311 if (_on === null) { |
| 17299 _on = new XMLHttpRequestEventsImplementation._wrap(_ptr); | 17312 _on = new XMLHttpRequestEventsImplementation._wrap(_ptr); |
| 17300 } | 17313 } |
| 17301 return _on; | 17314 return _on; |
| 17302 } | 17315 } |
| 17303 } | 17316 } |
| OLD | NEW |