| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // WARNING: Do not edit - generated code. | 5 // WARNING: Do not edit - generated code. |
| 6 | 6 |
| 7 part of $LIBRARYNAME; | 7 part of $LIBRARYNAME; |
| 8 | 8 |
| 9 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
{ | 9 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
{ |
| 10 $!MEMBERS | 10 $!MEMBERS |
| 11 | 11 |
| 12 $if DART2JS | |
| 13 @DomName('Document.body') | 12 @DomName('Document.body') |
| 14 BodyElement body; | 13 BodyElement body; |
| 15 $else | |
| 16 @DomName('Document.body') | |
| 17 BodyElement get body => _body; | |
| 18 | |
| 19 @DomName('Document.body') | |
| 20 set body(BodyElement value) { | |
| 21 _body = value; | |
| 22 } | |
| 23 $endif | |
| 24 | 14 |
| 25 /// UNSTABLE: Chrome-only - create a Range from the given point. | 15 /// UNSTABLE: Chrome-only - create a Range from the given point. |
| 26 @DomName('Document.caretRangeFromPoint') | 16 @DomName('Document.caretRangeFromPoint') |
| 27 @Unstable() | 17 @Unstable() |
| 28 Range caretRangeFromPoint(int x, int y) { | 18 Range caretRangeFromPoint(int x, int y) { |
| 29 return _caretRangeFromPoint(x, y); | 19 return _caretRangeFromPoint(x, y); |
| 30 } | 20 } |
| 31 | 21 |
| 32 @DomName('Document.elementFromPoint') | 22 @DomName('Document.elementFromPoint') |
| 33 Element elementFromPoint(int x, int y) { | 23 Element elementFromPoint(int x, int y) { |
| 34 return _elementFromPoint(x, y); | 24 return _elementFromPoint(x, y); |
| 35 } | 25 } |
| 36 | 26 |
| 37 /** | 27 /** |
| 38 * Checks if the getCssCanvasContext API is supported on the current platform. | 28 * Checks if the getCssCanvasContext API is supported on the current platform. |
| 39 * | 29 * |
| 40 * See also: | 30 * See also: |
| 41 * | 31 * |
| 42 * * [getCssCanvasContext] | 32 * * [getCssCanvasContext] |
| 43 */ | 33 */ |
| 44 $if DART2JS | |
| 45 static bool get supportsCssCanvasContext => | 34 static bool get supportsCssCanvasContext => |
| 46 JS('bool', '!!(document.getCSSCanvasContext)'); | 35 JS('bool', '!!(document.getCSSCanvasContext)'); |
| 47 $else | |
| 48 static bool get supportsCssCanvasContext => false; | |
| 49 $endif | |
| 50 | 36 |
| 51 | 37 |
| 52 /** | 38 /** |
| 53 * Gets a CanvasRenderingContext which can be used as the CSS background of an | 39 * Gets a CanvasRenderingContext which can be used as the CSS background of an |
| 54 * element. | 40 * element. |
| 55 * | 41 * |
| 56 * CSS: | 42 * CSS: |
| 57 * | 43 * |
| 58 * background: -webkit-canvas(backgroundCanvas) | 44 * background: -webkit-canvas(backgroundCanvas) |
| 59 * | 45 * |
| 60 * Generate the canvas: | 46 * Generate the canvas: |
| 61 * | 47 * |
| 62 * var context = document.getCssCanvasContext('2d', 'backgroundCanvas', | 48 * var context = document.getCssCanvasContext('2d', 'backgroundCanvas', |
| 63 * 100, 100); | 49 * 100, 100); |
| 64 * context.fillStyle = 'red'; | 50 * context.fillStyle = 'red'; |
| 65 * context.fillRect(0, 0, 100, 100); | 51 * context.fillRect(0, 0, 100, 100); |
| 66 * | 52 * |
| 67 * See also: | 53 * See also: |
| 68 * | 54 * |
| 69 * * [supportsCssCanvasContext] | 55 * * [supportsCssCanvasContext] |
| 70 * * [CanvasElement.getContext] | 56 * * [CanvasElement.getContext] |
| 71 */ | 57 */ |
| 72 @SupportedBrowser(SupportedBrowser.CHROME) | 58 @SupportedBrowser(SupportedBrowser.CHROME) |
| 73 @SupportedBrowser(SupportedBrowser.SAFARI) | 59 @SupportedBrowser(SupportedBrowser.SAFARI) |
| 74 @Experimental() | 60 @Experimental() |
| 75 @DomName('Document.getCSSCanvasContext') | 61 @DomName('Document.getCSSCanvasContext') |
| 76 CanvasRenderingContext getCssCanvasContext(String contextId, String name, | 62 CanvasRenderingContext getCssCanvasContext(String contextId, String name, |
| 77 int width, int height) { | 63 int width, int height) { |
| 78 $if DART2JS | |
| 79 if (HtmlDocument.supportsCssCanvasContext) | 64 if (HtmlDocument.supportsCssCanvasContext) |
| 80 return JS('CanvasRenderingContext', '#.getCSSCanvasContext(#, #, #, #)',
this, contextId, name, width, height); | 65 return JS('CanvasRenderingContext', '#.getCSSCanvasContext(#, #, #, #)',
this, contextId, name, width, height); |
| 81 $endif | |
| 82 throw new UnsupportedError("Not supported"); | 66 throw new UnsupportedError("Not supported"); |
| 83 } | 67 } |
| 84 | 68 |
| 85 @DomName('Document.head') | 69 @DomName('Document.head') |
| 86 HeadElement get head => _head; | 70 HeadElement get head => _head; |
| 87 | 71 |
| 88 @DomName('Document.lastModified') | 72 @DomName('Document.lastModified') |
| 89 String get lastModified => _lastModified; | 73 String get lastModified => _lastModified; |
| 90 | 74 |
| 91 @DomName('Document.preferredStylesheetSet') | 75 @DomName('Document.preferredStylesheetSet') |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 * * [Fullscreen specification](http://www.w3.org/TR/fullscreen/) from W3C. | 108 * * [Fullscreen specification](http://www.w3.org/TR/fullscreen/) from W3C. |
| 125 */ | 109 */ |
| 126 @DomName('Document.webkitExitFullscreen') | 110 @DomName('Document.webkitExitFullscreen') |
| 127 @SupportedBrowser(SupportedBrowser.CHROME) | 111 @SupportedBrowser(SupportedBrowser.CHROME) |
| 128 @SupportedBrowser(SupportedBrowser.SAFARI) | 112 @SupportedBrowser(SupportedBrowser.SAFARI) |
| 129 @Experimental() | 113 @Experimental() |
| 130 void exitFullscreen() { | 114 void exitFullscreen() { |
| 131 _webkitExitFullscreen(); | 115 _webkitExitFullscreen(); |
| 132 } | 116 } |
| 133 | 117 |
| 134 $if DARTIUM | |
| 135 | |
| 136 /** | |
| 137 * Internal routine to find the DOM JS class name being extended for custom | |
| 138 * elements. | |
| 139 */ | |
| 140 String _getJSClassName(ClassMirror classMirror) { | |
| 141 var jsClassName = null; | |
| 142 var isElement = false; | |
| 143 | |
| 144 while (classMirror.superclass != null) { | |
| 145 var fullName = classMirror.superclass.qualifiedName; | |
| 146 isElement = isElement || | |
| 147 (fullName == #dart.dom.html.Element || fullName == #dart.dom.svg.Eleme
nt); | |
| 148 | |
| 149 var domLibrary = MirrorSystem.getName(fullName).startsWith('dart.dom.'); | |
| 150 if (jsClassName == null && domLibrary) { | |
| 151 // Lookup JS class name (if not found). | |
| 152 var metadatas = classMirror.metadata; | |
| 153 for (var metadata in metadatas) { | |
| 154 var metaDataMirror = metadata.reflectee; | |
| 155 var metaType = reflectClass(metaDataMirror.runtimeType); | |
| 156 if (MirrorSystem.getName(metaType.simpleName) == 'DomName' && | |
| 157 (metaDataMirror.name.startsWith('HTML') || metaDataMirror.name.sta
rtsWith('SVG'))) { | |
| 158 jsClassName = metadata.reflectee.name; | |
| 159 } | |
| 160 } | |
| 161 } | |
| 162 | |
| 163 classMirror = classMirror.superclass; | |
| 164 } | |
| 165 | |
| 166 // If we're an element then everything is okay. | |
| 167 return isElement ? jsClassName : null; | |
| 168 } | |
| 169 | |
| 170 // Get the first class that's a super of a dart.dom library. | |
| 171 ClassMirror _getDartHtmlClassName(ClassMirror classMirror) { | |
| 172 while (classMirror.superclass != null) { | |
| 173 var fullName = classMirror.superclass.qualifiedName; | |
| 174 var domLibrary = MirrorSystem.getName(fullName).startsWith('dart.dom.'); | |
| 175 if (domLibrary) { | |
| 176 return classMirror.superclass; | |
| 177 } | |
| 178 | |
| 179 classMirror = classMirror.superclass; | |
| 180 } | |
| 181 | |
| 182 return null; | |
| 183 } | |
| 184 | |
| 185 /** | |
| 186 * Get the class that immediately derived from a class in dart:html or | |
| 187 * dart:svg (has an attribute DomName of either HTML* or SVG*). | |
| 188 */ | |
| 189 ClassMirror _getDomSuperClass(ClassMirror classMirror) { | |
| 190 var isElement = false; | |
| 191 var foundSuperElement = null; | |
| 192 | |
| 193 while (classMirror.superclass != null) { | |
| 194 var fullName = classMirror.superclass.qualifiedName; | |
| 195 isElement = isElement || (fullName == #dart.dom.html.Element || fullName =
= #dart.dom.svg.Element); | |
| 196 | |
| 197 var domLibrary = MirrorSystem.getName(fullName).startsWith('dart.dom.'); | |
| 198 if (domLibrary) { | |
| 199 if (foundSuperElement == null) { | |
| 200 foundSuperElement = classMirror.superclass; | |
| 201 } | |
| 202 // Lookup JS class (if not found). | |
| 203 var metadatas = classMirror.metadata; | |
| 204 for (var metadata in metadatas) { | |
| 205 var metaDataMirror = metadata.reflectee; | |
| 206 var metaType = reflectClass(metaDataMirror.runtimeType); | |
| 207 if (MirrorSystem.getName(metaType.simpleName) == 'DomName' && | |
| 208 (metaDataMirror.name.startsWith('HTML') || metaDataMirror.name.sta
rtsWith('SVG'))) { | |
| 209 if (isElement) return foundSuperElement; | |
| 210 } | |
| 211 } | |
| 212 } | |
| 213 | |
| 214 classMirror = classMirror.superclass; | |
| 215 } | |
| 216 | |
| 217 return null; | |
| 218 } | |
| 219 | |
| 220 /** | |
| 221 * Does this CustomElement class have: | |
| 222 * | |
| 223 * - a created constructor with no arguments? | |
| 224 * - a created constructor with a super.created() initializer? | |
| 225 * | |
| 226 * e.g., MyCustomClass.created() : super.created(); | |
| 227 */ | |
| 228 bool _hasCreatedConstructor(ClassMirror classToRegister) { | |
| 229 var htmlClassMirror = _getDomSuperClass(classToRegister); | |
| 230 | |
| 231 var classMirror = classToRegister; | |
| 232 while (classMirror != null && classMirror != htmlClassMirror) { | |
| 233 var createdParametersValid = false; | |
| 234 var superCreatedCalled = false; | |
| 235 var className = MirrorSystem.getName(classMirror.simpleName); | |
| 236 var methodMirror = classMirror.declarations[new Symbol("$className.created
")]; | |
| 237 if (methodMirror != null && methodMirror.isConstructor) { | |
| 238 createdParametersValid = true; // Assume no parameters. | |
| 239 if (methodMirror.parameters.length != 0) { | |
| 240 // If any parameters each one must be optional. | |
| 241 methodMirror.parameters.forEach((parameter) { | |
| 242 createdParametersValid = createdParametersValid && parameter.isOptio
nal; | |
| 243 }); | |
| 244 } | |
| 245 } | |
| 246 | |
| 247 if (!createdParametersValid) { | |
| 248 throw new DomException.jsInterop('created constructor must have no param
eters'); | |
| 249 } | |
| 250 | |
| 251 classMirror = classMirror.superclass; | |
| 252 while (classMirror != classMirror.mixin) { | |
| 253 // Skip the mixins. | |
| 254 classMirror = classMirror.superclass; | |
| 255 } | |
| 256 } | |
| 257 | |
| 258 return true; | |
| 259 } | |
| 260 $endif | |
| 261 | 118 |
| 262 @Experimental() | 119 @Experimental() |
| 263 /** | 120 /** |
| 264 * Register a custom subclass of Element to be instantiatable by the DOM. | 121 * Register a custom subclass of Element to be instantiatable by the DOM. |
| 265 * | 122 * |
| 266 * This is necessary to allow the construction of any custom elements. | 123 * This is necessary to allow the construction of any custom elements. |
| 267 * | 124 * |
| 268 * The class being registered must either subclass HtmlElement or SvgElement. | 125 * The class being registered must either subclass HtmlElement or SvgElement. |
| 269 * If they subclass these directly then they can be used as: | 126 * If they subclass these directly then they can be used as: |
| 270 * | 127 * |
| (...skipping 25 matching lines...) Expand all Loading... |
| 296 * var myBar = new Element.tag('input', 'x-bar'); | 153 * var myBar = new Element.tag('input', 'x-bar'); |
| 297 * // prints 'BarElement created!' to the console. | 154 * // prints 'BarElement created!' to the console. |
| 298 * } | 155 * } |
| 299 * | 156 * |
| 300 * This custom element can also be instantiated via HTML using the syntax | 157 * This custom element can also be instantiated via HTML using the syntax |
| 301 * `<input is="x-bar"></input>` | 158 * `<input is="x-bar"></input>` |
| 302 * | 159 * |
| 303 */ | 160 */ |
| 304 void registerElement(String tag, Type customElementClass, | 161 void registerElement(String tag, Type customElementClass, |
| 305 {String extendsTag}) { | 162 {String extendsTag}) { |
| 306 $if DART2JS | |
| 307 _registerCustomElement(JS('', 'window'), this, tag, customElementClass, | 163 _registerCustomElement(JS('', 'window'), this, tag, customElementClass, |
| 308 extendsTag); | 164 extendsTag); |
| 309 $else | |
| 310 // Hack to setup an interceptor for HTMLElement so it isn't changed when a c
ustom element is created. | |
| 311 var jsHTMLElementPrototype = js.JsNative.getProperty(js.JsNative.getProperty
(js.context, 'HTMLElement'),'prototype'); | |
| 312 _blink.Blink_Utils.defineInterceptor(jsHTMLElementPrototype, HtmlElement.ins
tanceRuntimeType); | |
| 313 | |
| 314 // Figure out which DOM class is being extended from the user's Dart class. | |
| 315 var classMirror = reflectClass(customElementClass); | |
| 316 | |
| 317 var locationUri = classMirror.location.sourceUri.toString(); | |
| 318 if (locationUri == 'dart:html' || locationUri == 'dart:svg') { | |
| 319 throw new DomException.jsInterop("HierarchyRequestError: Cannot register a
n existing dart:html or dart:svg type."); | |
| 320 } | |
| 321 | |
| 322 if (classMirror.isAbstract) { | |
| 323 throw new DomException.jsInterop("HierarchyRequestError: Cannot register a
n abstract class."); | |
| 324 } | |
| 325 | |
| 326 var jsClassName = _getJSClassName(classMirror); | |
| 327 if (jsClassName == null) { | |
| 328 // Only components derived from HTML* can be extended. | |
| 329 throw new DomException.jsInterop("HierarchyRequestError: Only HTML element
s can be customized."); | |
| 330 } | |
| 331 | |
| 332 var customClassType = _getDartHtmlClassName(classMirror); | |
| 333 | |
| 334 if (extendsTag != null) { | |
| 335 var nativeElement = document.createElement(extendsTag); | |
| 336 | |
| 337 // Trying to extend a native element is it the Dart class consistent with
the | |
| 338 // extendsTag? | |
| 339 if (nativeElement.runtimeType != customClassType.reflectedType) { | |
| 340 var nativeElementClassMirror = reflectClass(nativeElement.runtimeType); | |
| 341 var customClassNativeElement = MirrorSystem.getName(customClassType.simp
leName); | |
| 342 var extendsNativeElement = MirrorSystem.getName(nativeElementClassMirror
.simpleName); | |
| 343 throw new DomException.jsInterop("HierarchyRequestError: Custom class ty
pe ($customClassNativeElement) and extendsTag class ($extendsNativeElement) don'
t match ."); | |
| 344 } | |
| 345 } else if (customClassType.reflectedType != HtmlElement && customClassType.r
eflectedType != svg.SvgElement) { | |
| 346 var customClassName = MirrorSystem.getName(classMirror.simpleName); | |
| 347 var customClassElement = MirrorSystem.getName(customClassType.simpleName); | |
| 348 throw new DomException.jsInterop("HierarchyRequestError: Custom element $c
ustomClassName is a native $customClassElement should be derived from HtmlElemen
t or SvgElement."); | |
| 349 } | |
| 350 | |
| 351 if (_hasCreatedConstructor(classMirror)) { | |
| 352 // Start the hookup the JS way create an <x-foo> element that extends the | |
| 353 // <x-base> custom element. Inherit its prototype and signal what tag is | |
| 354 // inherited: | |
| 355 // | |
| 356 // var myProto = Object.create(HTMLElement.prototype); | |
| 357 // var myElement = document.registerElement('x-foo', {prototype: myPro
to}); | |
| 358 var baseElement = js.JsNative.getProperty(js.context, jsClassName); | |
| 359 if (baseElement == null) { | |
| 360 // Couldn't find the HTML element so use a generic one. | |
| 361 baseElement = js.JsNative.getProperty(js.context, 'HTMLElement'); | |
| 362 } | |
| 363 var elemProto = js.JsNative.callMethod(js.JsNative.getProperty(js.context,
'Object'), "create", [js.JsNative.getProperty(baseElement, 'prototype')]); | |
| 364 | |
| 365 // TODO(terry): Hack to stop recursion re-creating custom element when the | |
| 366 // created() constructor of the custom element does e.g., | |
| 367 // | |
| 368 // MyElement.created() : super.created() { | |
| 369 // this.innerHtml = "<b>I'm an x-foo-with-markup!</b>"; | |
| 370 // } | |
| 371 // | |
| 372 // sanitizing causes custom element to created recursively | |
| 373 // until stack overflow. | |
| 374 // | |
| 375 // See https://github.com/dart-lang/sdk/issues/23666 | |
| 376 int creating = 0; // TODO(jacobr): I think I broke thise case. Will fix mo
nday. | |
| 377 | |
| 378 // If any JS code is hooked we want to call it too. | |
| 379 var oldCreatedCallback = js.JsNative.getProperty(elemProto, 'createdCallba
ck'); | |
| 380 var oldAttributeChangedCallback = js.JsNative.getProperty(elemProto, 'attr
ibuteChangedCallback'); | |
| 381 var oldAttachedCallback = js.JsNative.getProperty(elemProto, 'attachedCall
back'); | |
| 382 var oldDetachedCallback = js.JsNative.getProperty(elemProto, 'detachedCall
back'); | |
| 383 | |
| 384 js.JsNative.setProperty(elemProto, 'createdCallback', js.allowInteropCaptu
reThis(($this) { | |
| 385 // The created callback has already been called by the very act of passi
ng a JS | |
| 386 // custom element from JS to Dart. | |
| 387 | |
| 388 // Make element's interceptor a CustomElementClass. | |
| 389 _blink.Blink_Utils.setInstanceInterceptorCustomUpgrade($this); | |
| 390 | |
| 391 if (oldCreatedCallback != null) | |
| 392 oldCreatedCallback.apply([], thisArg: $this); | |
| 393 })); | |
| 394 js.JsNative.setProperty(elemProto, 'attributeChangedCallback', js.allowInt
eropCaptureThis(($this, attrName, oldVal, newVal) { | |
| 395 $this.attributeChanged(attrName, oldVal, newVal); | |
| 396 | |
| 397 if (oldAttributeChangedCallback != null) | |
| 398 oldAttributeChangedCallback.apply([], thisArg: $this); | |
| 399 })); | |
| 400 js.JsNative.setProperty(elemProto, 'attachedCallback', js.allowInteropCapt
ureThis(($this) { | |
| 401 $this.attached(); | |
| 402 | |
| 403 if (oldAttachedCallback != null) | |
| 404 oldAttachedCallback.apply([], thisArg: $this); | |
| 405 })); | |
| 406 js.JsNative.setProperty(elemProto, 'detachedCallback', js.allowInteropCapt
ureThis(($this) { | |
| 407 $this.detached(); | |
| 408 | |
| 409 if (oldDetachedCallback != null) | |
| 410 oldDetachedCallback.apply([], thisArg: $this); | |
| 411 })); | |
| 412 // document.registerElement('x-foo', {prototype: elemProto, extends: exten
dsTag}); | |
| 413 var jsMap = new js.JsObject.jsify({'prototype': elemProto, 'extends': exte
ndsTag}); | |
| 414 _blink.Blink_Utils.defineInterceptorCustomElement(elemProto, customElement
Class); | |
| 415 js.JsNative.callMethod(document, 'registerElement', [tag, jsMap]); | |
| 416 } | |
| 417 $endif | |
| 418 } | 165 } |
| 419 | 166 |
| 420 /** *Deprecated*: use [registerElement] instead. */ | 167 /** *Deprecated*: use [registerElement] instead. */ |
| 421 @deprecated | 168 @deprecated |
| 422 @Experimental() | 169 @Experimental() |
| 423 void register(String tag, Type customElementClass, {String extendsTag}) { | 170 void register(String tag, Type customElementClass, {String extendsTag}) { |
| 424 return registerElement(tag, customElementClass, extendsTag: extendsTag); | 171 return registerElement(tag, customElementClass, extendsTag: extendsTag); |
| 425 } | 172 } |
| 426 | 173 |
| 427 /** | 174 /** |
| 428 * Static factory designed to expose `visibilitychange` events to event | 175 * Static factory designed to expose `visibilitychange` events to event |
| 429 * handlers that are not necessarily instances of [Document]. | 176 * handlers that are not necessarily instances of [Document]. |
| 430 * | 177 * |
| 431 * See [EventStreamProvider] for usage information. | 178 * See [EventStreamProvider] for usage information. |
| 432 */ | 179 */ |
| 433 @DomName('Document.visibilityChange') | 180 @DomName('Document.visibilityChange') |
| 434 @SupportedBrowser(SupportedBrowser.CHROME) | 181 @SupportedBrowser(SupportedBrowser.CHROME) |
| 435 @SupportedBrowser(SupportedBrowser.FIREFOX) | 182 @SupportedBrowser(SupportedBrowser.FIREFOX) |
| 436 @SupportedBrowser(SupportedBrowser.IE, '10') | 183 @SupportedBrowser(SupportedBrowser.IE, '10') |
| 437 @Experimental() | 184 @Experimental() |
| 438 static const EventStreamProvider<Event> visibilityChangeEvent = | 185 static const EventStreamProvider<Event> visibilityChangeEvent = |
| 439 const _CustomEventStreamProvider<Event>( | 186 const _CustomEventStreamProvider<Event>( |
| 440 _determineVisibilityChangeEventType); | 187 _determineVisibilityChangeEventType); |
| 441 | 188 |
| 442 static String _determineVisibilityChangeEventType(EventTarget e) { | 189 static String _determineVisibilityChangeEventType(EventTarget e) { |
| 443 $if DART2JS | |
| 444 if (JS('bool', '(typeof #.hidden !== "undefined")', e)) { | 190 if (JS('bool', '(typeof #.hidden !== "undefined")', e)) { |
| 445 // Opera 12.10 and Firefox 18 and later support | 191 // Opera 12.10 and Firefox 18 and later support |
| 446 return 'visibilitychange'; | 192 return 'visibilitychange'; |
| 447 } else if (JS('bool', '(typeof #.mozHidden !== "undefined")', e)) { | 193 } else if (JS('bool', '(typeof #.mozHidden !== "undefined")', e)) { |
| 448 return 'mozvisibilitychange'; | 194 return 'mozvisibilitychange'; |
| 449 } else if (JS('bool', '(typeof #.msHidden !== "undefined")', e)) { | 195 } else if (JS('bool', '(typeof #.msHidden !== "undefined")', e)) { |
| 450 return 'msvisibilitychange'; | 196 return 'msvisibilitychange'; |
| 451 } else if (JS('bool', '(typeof #.webkitHidden !== "undefined")', e)) { | 197 } else if (JS('bool', '(typeof #.webkitHidden !== "undefined")', e)) { |
| 452 return 'webkitvisibilitychange'; | 198 return 'webkitvisibilitychange'; |
| 453 } | 199 } |
| 454 return 'visibilitychange'; | 200 return 'visibilitychange'; |
| 455 $else | |
| 456 return 'webkitvisibilitychange'; | |
| 457 $endif | |
| 458 } | 201 } |
| 459 | 202 |
| 460 @SupportedBrowser(SupportedBrowser.CHROME) | 203 @SupportedBrowser(SupportedBrowser.CHROME) |
| 461 @SupportedBrowser(SupportedBrowser.FIREFOX) | 204 @SupportedBrowser(SupportedBrowser.FIREFOX) |
| 462 @SupportedBrowser(SupportedBrowser.IE, '10') | 205 @SupportedBrowser(SupportedBrowser.IE, '10') |
| 463 @Experimental() | 206 @Experimental() |
| 464 Stream<Event> get onVisibilityChange => | 207 Stream<Event> get onVisibilityChange => |
| 465 visibilityChangeEvent.forTarget(this); | 208 visibilityChangeEvent.forTarget(this); |
| 466 | 209 |
| 467 /// Creates an element upgrader which can be used to change the Dart wrapper | 210 /// Creates an element upgrader which can be used to change the Dart wrapper |
| 468 /// type for elements. | 211 /// type for elements. |
| 469 /// | 212 /// |
| 470 /// The type specified must be a subclass of HtmlElement, when an element is | 213 /// The type specified must be a subclass of HtmlElement, when an element is |
| 471 /// upgraded then the created constructor will be invoked on that element. | 214 /// upgraded then the created constructor will be invoked on that element. |
| 472 /// | 215 /// |
| 473 /// If the type is not a direct subclass of HtmlElement then the extendsTag | 216 /// If the type is not a direct subclass of HtmlElement then the extendsTag |
| 474 /// parameter must be provided. | 217 /// parameter must be provided. |
| 475 @Experimental() | 218 @Experimental() |
| 476 ElementUpgrader createElementUpgrader(Type type, {String extendsTag}) { | 219 ElementUpgrader createElementUpgrader(Type type, {String extendsTag}) { |
| 477 $if DART2JS | |
| 478 return new _JSElementUpgrader(this, type, extendsTag); | 220 return new _JSElementUpgrader(this, type, extendsTag); |
| 479 $else | |
| 480 return new _VMElementUpgrader(this, type, extendsTag); | |
| 481 $endif | |
| 482 } | 221 } |
| 483 } | 222 } |
| OLD | NEW |