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

Side by Side Diff: lib/runtime/dart/html_common.js

Issue 1524843002: JS: Format if statements with no else on a single line (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: rebased Created 5 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 unified diff | Download patch
« no previous file with comments | « lib/runtime/dart/html.js ('k') | lib/runtime/dart/isolate.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 dart_library.library('dart/html_common', null, /* Imports */[ 1 dart_library.library('dart/html_common', null, /* Imports */[
2 "dart/_runtime", 2 "dart/_runtime",
3 'dart/_metadata', 3 'dart/_metadata',
4 'dart/core', 4 'dart/core',
5 'dart/html', 5 'dart/html',
6 'dart/typed_data', 6 'dart/typed_data',
7 'dart/_js_helper', 7 'dart/_js_helper',
8 'dart/_native_typed_data', 8 'dart/_native_typed_data',
9 'dart/async', 9 'dart/async',
10 'dart/collection', 10 'dart/collection',
11 'dart/_internal' 11 'dart/_internal'
12 ], /* Lazy imports */[ 12 ], /* Lazy imports */[
13 ], function(exports, dart, _metadata, core, html, typed_data, _js_helper, _nativ e_typed_data, async, collection, _internal) { 13 ], function(exports, dart, _metadata, core, html, typed_data, _js_helper, _nativ e_typed_data, async, collection, _internal) {
14 'use strict'; 14 'use strict';
15 let dartx = dart.dartx; 15 let dartx = dart.dartx;
16 dart.export_(exports, _metadata); 16 dart.export_(exports, _metadata);
17 const _validateToken = Symbol('_validateToken'); 17 const _validateToken = Symbol('_validateToken');
18 class CssClassSetImpl extends core.Object { 18 class CssClassSetImpl extends core.Object {
19 [_validateToken](value) { 19 [_validateToken](value) {
20 if (dart.notNull(CssClassSetImpl._validTokenRE.hasMatch(value))) 20 if (dart.notNull(CssClassSetImpl._validTokenRE.hasMatch(value))) return va lue;
21 return value;
22 dart.throw(new core.ArgumentError.value(value, 'value', 'Not a valid class token')); 21 dart.throw(new core.ArgumentError.value(value, 'value', 'Not a valid class token'));
23 } 22 }
24 toString() { 23 toString() {
25 return this.readClasses().join(' '); 24 return this.readClasses().join(' ');
26 } 25 }
27 toggle(value, shouldAdd) { 26 toggle(value, shouldAdd) {
28 if (shouldAdd === void 0) 27 if (shouldAdd === void 0) shouldAdd = null;
29 shouldAdd = null;
30 this[_validateToken](value); 28 this[_validateToken](value);
31 let s = this.readClasses(); 29 let s = this.readClasses();
32 let result = false; 30 let result = false;
33 if (shouldAdd == null) 31 if (shouldAdd == null) shouldAdd = !dart.notNull(s.contains(value));
34 shouldAdd = !dart.notNull(s.contains(value));
35 if (dart.notNull(shouldAdd)) { 32 if (dart.notNull(shouldAdd)) {
36 s.add(value); 33 s.add(value);
37 result = true; 34 result = true;
38 } else { 35 } else {
39 s.remove(value); 36 s.remove(value);
40 } 37 }
41 this.writeClasses(s); 38 this.writeClasses(s);
42 return result; 39 return result;
43 } 40 }
44 get frozen() { 41 get frozen() {
45 return false; 42 return false;
46 } 43 }
47 get iterator() { 44 get iterator() {
48 return this.readClasses().iterator; 45 return this.readClasses().iterator;
49 } 46 }
50 [Symbol.iterator]() { 47 [Symbol.iterator]() {
51 return new dart.JsIterator(this.iterator); 48 return new dart.JsIterator(this.iterator);
52 } 49 }
53 forEach(f) { 50 forEach(f) {
54 this.readClasses().forEach(f); 51 this.readClasses().forEach(f);
55 } 52 }
56 join(separator) { 53 join(separator) {
57 if (separator === void 0) 54 if (separator === void 0) separator = "";
58 separator = "";
59 return this.readClasses().join(separator); 55 return this.readClasses().join(separator);
60 } 56 }
61 map(f) { 57 map(f) {
62 return this.readClasses().map(f); 58 return this.readClasses().map(f);
63 } 59 }
64 where(f) { 60 where(f) {
65 return this.readClasses().where(f); 61 return this.readClasses().where(f);
66 } 62 }
67 expand(f) { 63 expand(f) {
68 return this.readClasses().expand(f); 64 return this.readClasses().expand(f);
(...skipping 13 matching lines...) Expand all
82 get length() { 78 get length() {
83 return this.readClasses().length; 79 return this.readClasses().length;
84 } 80 }
85 reduce(combine) { 81 reduce(combine) {
86 return this.readClasses().reduce(combine); 82 return this.readClasses().reduce(combine);
87 } 83 }
88 fold(initialValue, combine) { 84 fold(initialValue, combine) {
89 return this.readClasses().fold(initialValue, combine); 85 return this.readClasses().fold(initialValue, combine);
90 } 86 }
91 contains(value) { 87 contains(value) {
92 if (!(typeof value == 'string')) 88 if (!(typeof value == 'string')) return false;
93 return false;
94 this[_validateToken](dart.as(value, core.String)); 89 this[_validateToken](dart.as(value, core.String));
95 return this.readClasses().contains(value); 90 return this.readClasses().contains(value);
96 } 91 }
97 lookup(value) { 92 lookup(value) {
98 return dart.as(dart.notNull(this.contains(value)) ? value : null, core.Str ing); 93 return dart.as(dart.notNull(this.contains(value)) ? value : null, core.Str ing);
99 } 94 }
100 add(value) { 95 add(value) {
101 this[_validateToken](value); 96 this[_validateToken](value);
102 return dart.as(this.modify(dart.fn(s => dart.dsend(s, 'add', value))), cor e.bool); 97 return dart.as(this.modify(dart.fn(s => dart.dsend(s, 'add', value))), cor e.bool);
103 } 98 }
104 remove(value) { 99 remove(value) {
105 this[_validateToken](dart.as(value, core.String)); 100 this[_validateToken](dart.as(value, core.String));
106 if (!(typeof value == 'string')) 101 if (!(typeof value == 'string')) return false;
107 return false;
108 let s = this.readClasses(); 102 let s = this.readClasses();
109 let result = s.remove(value); 103 let result = s.remove(value);
110 this.writeClasses(s); 104 this.writeClasses(s);
111 return result; 105 return result;
112 } 106 }
113 addAll(iterable) { 107 addAll(iterable) {
114 this.modify(dart.fn((s => dart.dsend(s, 'addAll', iterable[dartx.map](dart .bind(this, _validateToken)))).bind(this))); 108 this.modify(dart.fn((s => dart.dsend(s, 'addAll', iterable[dartx.map](dart .bind(this, _validateToken)))).bind(this)));
115 } 109 }
116 removeAll(iterable) { 110 removeAll(iterable) {
117 this.modify(dart.fn((s => dart.dsend(s, 'removeAll', iterable[dartx.map](d art.as(dart.bind(this, _validateToken), __CastType0)))).bind(this))); 111 this.modify(dart.fn((s => dart.dsend(s, 'removeAll', iterable[dartx.map](d art.as(dart.bind(this, _validateToken), __CastType0)))).bind(this)));
118 } 112 }
119 toggleAll(iterable, shouldAdd) { 113 toggleAll(iterable, shouldAdd) {
120 if (shouldAdd === void 0) 114 if (shouldAdd === void 0) shouldAdd = null;
121 shouldAdd = null;
122 iterable[dartx.forEach](dart.fn((e => this.toggle(dart.as(e, core.String), shouldAdd)).bind(this), core.bool, [dart.dynamic])); 115 iterable[dartx.forEach](dart.fn((e => this.toggle(dart.as(e, core.String), shouldAdd)).bind(this), core.bool, [dart.dynamic]));
123 } 116 }
124 retainAll(iterable) { 117 retainAll(iterable) {
125 this.modify(dart.fn(s => dart.dsend(s, 'retainAll', iterable))); 118 this.modify(dart.fn(s => dart.dsend(s, 'retainAll', iterable)));
126 } 119 }
127 removeWhere(test) { 120 removeWhere(test) {
128 this.modify(dart.fn(s => dart.dsend(s, 'removeWhere', test))); 121 this.modify(dart.fn(s => dart.dsend(s, 'removeWhere', test)));
129 } 122 }
130 retainWhere(test) { 123 retainWhere(test) {
131 this.modify(dart.fn(s => dart.dsend(s, 'retainWhere', test))); 124 this.modify(dart.fn(s => dart.dsend(s, 'retainWhere', test)));
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 } 273 }
281 dart.fn(convertNativeToDart_SerializedScriptValue); 274 dart.fn(convertNativeToDart_SerializedScriptValue);
282 class _StructuredClone extends core.Object { 275 class _StructuredClone extends core.Object {
283 _StructuredClone() { 276 _StructuredClone() {
284 this.values = []; 277 this.values = [];
285 this.copies = []; 278 this.copies = [];
286 } 279 }
287 findSlot(value) { 280 findSlot(value) {
288 let length = this.values[dartx.length]; 281 let length = this.values[dartx.length];
289 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i ) + 1) { 282 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i ) + 1) {
290 if (dart.notNull(core.identical(this.values[dartx.get](i), value))) 283 if (dart.notNull(core.identical(this.values[dartx.get](i), value))) retu rn i;
291 return i;
292 } 284 }
293 this.values[dartx.add](value); 285 this.values[dartx.add](value);
294 this.copies[dartx.add](null); 286 this.copies[dartx.add](null);
295 return length; 287 return length;
296 } 288 }
297 readSlot(i) { 289 readSlot(i) {
298 return this.copies[dartx.get](i); 290 return this.copies[dartx.get](i);
299 } 291 }
300 writeSlot(i, x) { 292 writeSlot(i, x) {
301 this.copies[dartx.set](i, x); 293 this.copies[dartx.set](i, x);
302 } 294 }
303 cleanupSlots() {} 295 cleanupSlots() {}
304 walk(e) { 296 walk(e) {
305 if (e == null) 297 if (e == null) return e;
306 return e; 298 if (typeof e == 'boolean') return e;
307 if (typeof e == 'boolean') 299 if (typeof e == 'number') return e;
308 return e; 300 if (typeof e == 'string') return e;
309 if (typeof e == 'number')
310 return e;
311 if (typeof e == 'string')
312 return e;
313 if (dart.is(e, core.DateTime)) { 301 if (dart.is(e, core.DateTime)) {
314 return convertDartToNative_DateTime(dart.as(e, core.DateTime)); 302 return convertDartToNative_DateTime(dart.as(e, core.DateTime));
315 } 303 }
316 if (dart.is(e, core.RegExp)) { 304 if (dart.is(e, core.RegExp)) {
317 dart.throw(new core.UnimplementedError('structured clone of RegExp')); 305 dart.throw(new core.UnimplementedError('structured clone of RegExp'));
318 } 306 }
319 if (dart.is(e, dart.dynamic)) 307 if (dart.is(e, dart.dynamic)) return e;
320 return e; 308 if (dart.is(e, dart.dynamic)) return e;
321 if (dart.is(e, dart.dynamic)) 309 if (dart.is(e, dart.dynamic)) return e;
322 return e; 310 if (dart.is(e, dart.dynamic)) return e;
323 if (dart.is(e, dart.dynamic)) 311 if (dart.notNull(this.cloneNotRequired(e))) return e;
324 return e;
325 if (dart.is(e, dart.dynamic))
326 return e;
327 if (dart.notNull(this.cloneNotRequired(e)))
328 return e;
329 if (dart.is(e, core.Map)) { 312 if (dart.is(e, core.Map)) {
330 let slot = this.findSlot(e); 313 let slot = this.findSlot(e);
331 let copy = this.readSlot(slot); 314 let copy = this.readSlot(slot);
332 if (copy != null) 315 if (copy != null) return copy;
333 return copy;
334 copy = this.newJsMap(); 316 copy = this.newJsMap();
335 this.writeSlot(slot, copy); 317 this.writeSlot(slot, copy);
336 dart.dsend(e, 'forEach', dart.fn(((key, value) => { 318 dart.dsend(e, 'forEach', dart.fn(((key, value) => {
337 this.putIntoMap(copy, key, this.walk(value)); 319 this.putIntoMap(copy, key, this.walk(value));
338 }).bind(this))); 320 }).bind(this)));
339 return copy; 321 return copy;
340 } 322 }
341 if (dart.is(e, core.List)) { 323 if (dart.is(e, core.List)) {
342 let slot = this.findSlot(e); 324 let slot = this.findSlot(e);
343 let copy = this.readSlot(slot); 325 let copy = this.readSlot(slot);
344 if (copy != null) 326 if (copy != null) return copy;
345 return copy;
346 copy = this.copyList(dart.as(e, core.List), slot); 327 copy = this.copyList(dart.as(e, core.List), slot);
347 return copy; 328 return copy;
348 } 329 }
349 dart.throw(new core.UnimplementedError('structured clone of other type')); 330 dart.throw(new core.UnimplementedError('structured clone of other type'));
350 } 331 }
351 copyList(e, slot) { 332 copyList(e, slot) {
352 let i = 0; 333 let i = 0;
353 let length = e[dartx.length]; 334 let length = e[dartx.length];
354 let copy = this.newJsList(length); 335 let copy = this.newJsList(length);
355 this.writeSlot(slot, copy); 336 this.writeSlot(slot, copy);
(...skipping 21 matching lines...) Expand all
377 }); 358 });
378 class _AcceptStructuredClone extends core.Object { 359 class _AcceptStructuredClone extends core.Object {
379 _AcceptStructuredClone() { 360 _AcceptStructuredClone() {
380 this.values = []; 361 this.values = [];
381 this.copies = []; 362 this.copies = [];
382 this.mustCopy = false; 363 this.mustCopy = false;
383 } 364 }
384 findSlot(value) { 365 findSlot(value) {
385 let length = this.values[dartx.length]; 366 let length = this.values[dartx.length];
386 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i ) + 1) { 367 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i ) + 1) {
387 if (dart.notNull(this.identicalInJs(this.values[dartx.get](i), value))) 368 if (dart.notNull(this.identicalInJs(this.values[dartx.get](i), value))) return i;
388 return i;
389 } 369 }
390 this.values[dartx.add](value); 370 this.values[dartx.add](value);
391 this.copies[dartx.add](null); 371 this.copies[dartx.add](null);
392 return length; 372 return length;
393 } 373 }
394 readSlot(i) { 374 readSlot(i) {
395 return this.copies[dartx.get](i); 375 return this.copies[dartx.get](i);
396 } 376 }
397 writeSlot(i, x) { 377 writeSlot(i, x) {
398 this.copies[dartx.set](i, x); 378 this.copies[dartx.set](i, x);
399 } 379 }
400 walk(e) { 380 walk(e) {
401 if (e == null) 381 if (e == null) return e;
402 return e; 382 if (typeof e == 'boolean') return e;
403 if (typeof e == 'boolean') 383 if (typeof e == 'number') return e;
404 return e; 384 if (typeof e == 'string') return e;
405 if (typeof e == 'number')
406 return e;
407 if (typeof e == 'string')
408 return e;
409 if (dart.notNull(isJavaScriptDate(e))) { 385 if (dart.notNull(isJavaScriptDate(e))) {
410 return convertNativeToDart_DateTime(e); 386 return convertNativeToDart_DateTime(e);
411 } 387 }
412 if (dart.notNull(isJavaScriptRegExp(e))) { 388 if (dart.notNull(isJavaScriptRegExp(e))) {
413 dart.throw(new core.UnimplementedError('structured clone of RegExp')); 389 dart.throw(new core.UnimplementedError('structured clone of RegExp'));
414 } 390 }
415 if (dart.notNull(isJavaScriptPromise(e))) { 391 if (dart.notNull(isJavaScriptPromise(e))) {
416 return convertNativePromiseToDartFuture(e); 392 return convertNativePromiseToDartFuture(e);
417 } 393 }
418 if (dart.notNull(isJavaScriptSimpleObject(e))) { 394 if (dart.notNull(isJavaScriptSimpleObject(e))) {
419 let slot = this.findSlot(e); 395 let slot = this.findSlot(e);
420 let copy = this.readSlot(slot); 396 let copy = this.readSlot(slot);
421 if (copy != null) 397 if (copy != null) return copy;
422 return copy;
423 copy = dart.map(); 398 copy = dart.map();
424 this.writeSlot(slot, copy); 399 this.writeSlot(slot, copy);
425 this.forEachJsField(e, dart.fn(((key, value) => dart.dsetindex(copy, key , this.walk(value))).bind(this))); 400 this.forEachJsField(e, dart.fn(((key, value) => dart.dsetindex(copy, key , this.walk(value))).bind(this)));
426 return copy; 401 return copy;
427 } 402 }
428 if (dart.notNull(isJavaScriptArray(e))) { 403 if (dart.notNull(isJavaScriptArray(e))) {
429 let slot = this.findSlot(e); 404 let slot = this.findSlot(e);
430 let copy = this.readSlot(slot); 405 let copy = this.readSlot(slot);
431 if (copy != null) 406 if (copy != null) return copy;
432 return copy;
433 let length = dart.as(dart.dload(e, 'length'), core.int); 407 let length = dart.as(dart.dload(e, 'length'), core.int);
434 copy = dart.notNull(this.mustCopy) ? this.newDartList(length) : e; 408 copy = dart.notNull(this.mustCopy) ? this.newDartList(length) : e;
435 this.writeSlot(slot, copy); 409 this.writeSlot(slot, copy);
436 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull (i) + 1) { 410 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull (i) + 1) {
437 dart.dsetindex(copy, i, this.walk(dart.dindex(e, i))); 411 dart.dsetindex(copy, i, this.walk(dart.dindex(e, i)));
438 } 412 }
439 return copy; 413 return copy;
440 } 414 }
441 return e; 415 return e;
442 } 416 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 if (dart.is(imageData, _TypedImageData)) { 480 if (dart.is(imageData, _TypedImageData)) {
507 return {data: dart.dload(imageData, 'data'), height: dart.dload(imageData, 'height'), width: dart.dload(imageData, 'width')}; 481 return {data: dart.dload(imageData, 'data'), height: dart.dload(imageData, 'height'), width: dart.dload(imageData, 'width')};
508 } 482 }
509 return imageData; 483 return imageData;
510 } 484 }
511 dart.fn(convertDartToNative_ImageData); 485 dart.fn(convertDartToNative_ImageData);
512 const _serializedScriptValue = 'num|String|bool|' + 'JSExtendableArray|=Object |' + 'Blob|File|NativeByteBuffer|NativeTypedData'; 486 const _serializedScriptValue = 'num|String|bool|' + 'JSExtendableArray|=Object |' + 'Blob|File|NativeByteBuffer|NativeTypedData';
513 const annotation_Creates_SerializedScriptValue = dart.const(new _js_helper.Cre ates(_serializedScriptValue)); 487 const annotation_Creates_SerializedScriptValue = dart.const(new _js_helper.Cre ates(_serializedScriptValue));
514 const annotation_Returns_SerializedScriptValue = dart.const(new _js_helper.Ret urns(_serializedScriptValue)); 488 const annotation_Returns_SerializedScriptValue = dart.const(new _js_helper.Ret urns(_serializedScriptValue));
515 function convertNativeToDart_Dictionary(object) { 489 function convertNativeToDart_Dictionary(object) {
516 if (object == null) 490 if (object == null) return null;
517 return null;
518 let dict = dart.map(); 491 let dict = dart.map();
519 let keys = Object.getOwnPropertyNames(object); 492 let keys = Object.getOwnPropertyNames(object);
520 for (let key of dart.as(keys, core.Iterable)) { 493 for (let key of dart.as(keys, core.Iterable)) {
521 dict.set(key, object[key]); 494 dict.set(key, object[key]);
522 } 495 }
523 return dict; 496 return dict;
524 } 497 }
525 dart.fn(convertNativeToDart_Dictionary, core.Map, [dart.dynamic]); 498 dart.fn(convertNativeToDart_Dictionary, core.Map, [dart.dynamic]);
526 function convertDartToNative_Dictionary(dict, postCreate) { 499 function convertDartToNative_Dictionary(dict, postCreate) {
527 if (postCreate === void 0) 500 if (postCreate === void 0) postCreate = null;
528 postCreate = null; 501 if (dict == null) return null;
529 if (dict == null)
530 return null;
531 let object = {}; 502 let object = {};
532 if (postCreate != null) { 503 if (postCreate != null) {
533 dart.dcall(postCreate, object); 504 dart.dcall(postCreate, object);
534 } 505 }
535 dict.forEach(dart.fn((key, value) => { 506 dict.forEach(dart.fn((key, value) => {
536 object[key] = value; 507 object[key] = value;
537 }, dart.dynamic, [core.String, dart.dynamic])); 508 }, dart.dynamic, [core.String, dart.dynamic]));
538 return object; 509 return object;
539 } 510 }
540 dart.fn(convertDartToNative_Dictionary, dart.dynamic, [core.Map], [dart.functi onType(dart.void, [dart.dynamic])]); 511 dart.fn(convertDartToNative_Dictionary, dart.dynamic, [core.Map], [dart.functi onType(dart.void, [dart.dynamic])]);
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 return Device._isFirefox; 639 return Device._isFirefox;
669 } 640 }
670 static get isWebKit() { 641 static get isWebKit() {
671 if (Device._isWebKit == null) { 642 if (Device._isWebKit == null) {
672 Device._isWebKit = !dart.notNull(Device.isOpera) && dart.notNull(Device. userAgent[dartx.contains]("WebKit", 0)); 643 Device._isWebKit = !dart.notNull(Device.isOpera) && dart.notNull(Device. userAgent[dartx.contains]("WebKit", 0));
673 } 644 }
674 return Device._isWebKit; 645 return Device._isWebKit;
675 } 646 }
676 static get cssPrefix() { 647 static get cssPrefix() {
677 let prefix = Device._cachedCssPrefix; 648 let prefix = Device._cachedCssPrefix;
678 if (prefix != null) 649 if (prefix != null) return prefix;
679 return prefix;
680 if (dart.notNull(Device.isFirefox)) { 650 if (dart.notNull(Device.isFirefox)) {
681 prefix = '-moz-'; 651 prefix = '-moz-';
682 } else if (dart.notNull(Device.isIE)) { 652 } else if (dart.notNull(Device.isIE)) {
683 prefix = '-ms-'; 653 prefix = '-ms-';
684 } else if (dart.notNull(Device.isOpera)) { 654 } else if (dart.notNull(Device.isOpera)) {
685 prefix = '-o-'; 655 prefix = '-o-';
686 } else { 656 } else {
687 prefix = '-webkit-'; 657 prefix = '-webkit-';
688 } 658 }
689 return Device._cachedCssPrefix = prefix; 659 return Device._cachedCssPrefix = prefix;
690 } 660 }
691 static get propertyPrefix() { 661 static get propertyPrefix() {
692 let prefix = Device._cachedPropertyPrefix; 662 let prefix = Device._cachedPropertyPrefix;
693 if (prefix != null) 663 if (prefix != null) return prefix;
694 return prefix;
695 if (dart.notNull(Device.isFirefox)) { 664 if (dart.notNull(Device.isFirefox)) {
696 prefix = 'moz'; 665 prefix = 'moz';
697 } else if (dart.notNull(Device.isIE)) { 666 } else if (dart.notNull(Device.isIE)) {
698 prefix = 'ms'; 667 prefix = 'ms';
699 } else if (dart.notNull(Device.isOpera)) { 668 } else if (dart.notNull(Device.isOpera)) {
700 prefix = 'o'; 669 prefix = 'o';
701 } else { 670 } else {
702 prefix = 'webkit'; 671 prefix = 'webkit';
703 } 672 }
704 return Device._cachedPropertyPrefix = prefix; 673 return Device._cachedPropertyPrefix = prefix;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 } 725 }
757 add(value) { 726 add(value) {
758 this[_childNodes][dartx.add](value); 727 this[_childNodes][dartx.add](value);
759 } 728 }
760 addAll(iterable) { 729 addAll(iterable) {
761 for (let element of iterable) { 730 for (let element of iterable) {
762 this.add(element); 731 this.add(element);
763 } 732 }
764 } 733 }
765 contains(needle) { 734 contains(needle) {
766 if (!dart.is(needle, html.Element)) 735 if (!dart.is(needle, html.Element)) return false;
767 return false;
768 let element = dart.as(needle, html.Element); 736 let element = dart.as(needle, html.Element);
769 return dart.equals(element.parentNode, this[_node]); 737 return dart.equals(element.parentNode, this[_node]);
770 } 738 }
771 get reversed() { 739 get reversed() {
772 return this[_filtered][dartx.reversed]; 740 return this[_filtered][dartx.reversed];
773 } 741 }
774 sort(compare) { 742 sort(compare) {
775 if (compare === void 0) 743 if (compare === void 0) compare = null;
776 compare = null;
777 dart.throw(new core.UnsupportedError('Cannot sort filtered list')); 744 dart.throw(new core.UnsupportedError('Cannot sort filtered list'));
778 } 745 }
779 setRange(start, end, iterable, skipCount) { 746 setRange(start, end, iterable, skipCount) {
780 if (skipCount === void 0) 747 if (skipCount === void 0) skipCount = 0;
781 skipCount = 0;
782 dart.throw(new core.UnsupportedError('Cannot setRange on filtered list')); 748 dart.throw(new core.UnsupportedError('Cannot setRange on filtered list'));
783 } 749 }
784 fillRange(start, end, fillValue) { 750 fillRange(start, end, fillValue) {
785 if (fillValue === void 0) 751 if (fillValue === void 0) fillValue = null;
786 fillValue = null;
787 dart.throw(new core.UnsupportedError('Cannot fillRange on filtered list')) ; 752 dart.throw(new core.UnsupportedError('Cannot fillRange on filtered list')) ;
788 } 753 }
789 replaceRange(start, end, iterable) { 754 replaceRange(start, end, iterable) {
790 dart.throw(new core.UnsupportedError('Cannot replaceRange on filtered list ')); 755 dart.throw(new core.UnsupportedError('Cannot replaceRange on filtered list '));
791 } 756 }
792 removeRange(start, end) { 757 removeRange(start, end) {
793 core.List.from(this[_iterable][dartx.skip](start)[dartx.take](dart.notNull (end) - dart.notNull(start)))[dartx.forEach](dart.fn(el => dart.dsend(el, 'remov e'))); 758 core.List.from(this[_iterable][dartx.skip](start)[dartx.take](dart.notNull (end) - dart.notNull(start)))[dartx.forEach](dart.fn(el => dart.dsend(el, 'remov e')));
794 } 759 }
795 clear() { 760 clear() {
796 this[_childNodes][dartx.clear](); 761 this[_childNodes][dartx.clear]();
(...skipping 20 matching lines...) Expand all
817 let element = this[_iterable][dartx.elementAt](index); 782 let element = this[_iterable][dartx.elementAt](index);
818 element.parentNode.insertAllBefore(iterable, element); 783 element.parentNode.insertAllBefore(iterable, element);
819 } 784 }
820 } 785 }
821 removeAt(index) { 786 removeAt(index) {
822 let result = this.get(index); 787 let result = this.get(index);
823 result.remove(); 788 result.remove();
824 return result; 789 return result;
825 } 790 }
826 remove(element) { 791 remove(element) {
827 if (!dart.is(element, html.Element)) 792 if (!dart.is(element, html.Element)) return false;
828 return false;
829 if (dart.notNull(this.contains(element))) { 793 if (dart.notNull(this.contains(element))) {
830 dart.as(element, html.Element).remove(); 794 dart.as(element, html.Element).remove();
831 return true; 795 return true;
832 } else { 796 } else {
833 return false; 797 return false;
834 } 798 }
835 } 799 }
836 get length() { 800 get length() {
837 return this[_iterable][dartx.length]; 801 return this[_iterable][dartx.length];
838 } 802 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 startIndex = dart.notNull(a[dartx.length]) - 1; 875 startIndex = dart.notNull(a[dartx.length]) - 1;
912 } 876 }
913 for (let i = startIndex; dart.notNull(i) >= 0; i = dart.notNull(i) - 1) { 877 for (let i = startIndex; dart.notNull(i) >= 0; i = dart.notNull(i) - 1) {
914 if (dart.equals(a[dartx.get](i), element)) { 878 if (dart.equals(a[dartx.get](i), element)) {
915 return i; 879 return i;
916 } 880 }
917 } 881 }
918 return -1; 882 return -1;
919 } 883 }
920 static getRange(a, start, end, accumulator) { 884 static getRange(a, start, end, accumulator) {
921 if (dart.notNull(start) < 0) 885 if (dart.notNull(start) < 0) dart.throw(new core.RangeError.value(start));
922 dart.throw(new core.RangeError.value(start)); 886 if (dart.notNull(end) < dart.notNull(start)) dart.throw(new core.RangeErro r.value(end));
923 if (dart.notNull(end) < dart.notNull(start)) 887 if (dart.notNull(end) > dart.notNull(a[dartx.length])) dart.throw(new core .RangeError.value(end));
924 dart.throw(new core.RangeError.value(end));
925 if (dart.notNull(end) > dart.notNull(a[dartx.length]))
926 dart.throw(new core.RangeError.value(end));
927 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull( i) + 1) { 888 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull( i) + 1) {
928 accumulator[dartx.add](a[dartx.get](i)); 889 accumulator[dartx.add](a[dartx.get](i));
929 } 890 }
930 return accumulator; 891 return accumulator;
931 } 892 }
932 } 893 }
933 dart.setSignature(Lists, { 894 dart.setSignature(Lists, {
934 statics: () => ({ 895 statics: () => ({
935 indexOf: [core.int, [core.List, core.Object, core.int, core.int]], 896 indexOf: [core.int, [core.List, core.Object, core.int, core.int]],
936 lastIndexOf: [core.int, [core.List, core.Object, core.int]], 897 lastIndexOf: [core.int, [core.List, core.Object, core.int]],
(...skipping 23 matching lines...) Expand all
960 exports.isJavaScriptArray = isJavaScriptArray; 921 exports.isJavaScriptArray = isJavaScriptArray;
961 exports.isJavaScriptSimpleObject = isJavaScriptSimpleObject; 922 exports.isJavaScriptSimpleObject = isJavaScriptSimpleObject;
962 exports.isImmutableJavaScriptArray = isImmutableJavaScriptArray; 923 exports.isImmutableJavaScriptArray = isImmutableJavaScriptArray;
963 exports.isJavaScriptPromise = isJavaScriptPromise; 924 exports.isJavaScriptPromise = isJavaScriptPromise;
964 exports.convertNativePromiseToDartFuture = convertNativePromiseToDartFuture; 925 exports.convertNativePromiseToDartFuture = convertNativePromiseToDartFuture;
965 exports.Device = Device; 926 exports.Device = Device;
966 exports.FilteredElementList = FilteredElementList; 927 exports.FilteredElementList = FilteredElementList;
967 exports.Lists = Lists; 928 exports.Lists = Lists;
968 exports.NodeListWrapper = NodeListWrapper; 929 exports.NodeListWrapper = NodeListWrapper;
969 }); 930 });
OLDNEW
« no previous file with comments | « lib/runtime/dart/html.js ('k') | lib/runtime/dart/isolate.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698