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

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

Issue 1700153002: Wrapperless dart:html and friends (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: A couple more tweaks Created 4 years, 10 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
« no previous file with comments | « lib/runtime/dart/core.js ('k') | lib/runtime/dart/indexed_db.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 'dart/web_gl'
14 ], function(exports, dart, _metadata, core, html, typed_data, _js_helper, _nativ e_typed_data, async, collection, _internal, web_gl) {
14 'use strict'; 15 'use strict';
15 let dartx = dart.dartx; 16 let dartx = dart.dartx;
16 dart.export(exports, _metadata); 17 dart.export(exports, _metadata);
17 const _validateToken = Symbol('_validateToken'); 18 const _validateToken = Symbol('_validateToken');
18 class CssClassSetImpl extends core.Object { 19 class CssClassSetImpl extends core.Object {
19 [_validateToken](value) { 20 [_validateToken](value) {
20 if (dart.notNull(CssClassSetImpl._validTokenRE.hasMatch(value))) return va lue; 21 if (dart.notNull(CssClassSetImpl._validTokenRE.hasMatch(value))) return va lue;
21 dart.throw(new core.ArgumentError.value(value, 'value', 'Not a valid class token')); 22 dart.throw(new core.ArgumentError.value(value, 'value', 'Not a valid class token'));
22 } 23 }
23 toString() { 24 toString() {
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 if (e == null) return e; 298 if (e == null) return e;
298 if (typeof e == 'boolean') return e; 299 if (typeof e == 'boolean') return e;
299 if (typeof e == 'number') return e; 300 if (typeof e == 'number') return e;
300 if (typeof e == 'string') return e; 301 if (typeof e == 'string') return e;
301 if (dart.is(e, core.DateTime)) { 302 if (dart.is(e, core.DateTime)) {
302 return convertDartToNative_DateTime(e); 303 return convertDartToNative_DateTime(e);
303 } 304 }
304 if (dart.is(e, core.RegExp)) { 305 if (dart.is(e, core.RegExp)) {
305 dart.throw(new core.UnimplementedError('structured clone of RegExp')); 306 dart.throw(new core.UnimplementedError('structured clone of RegExp'));
306 } 307 }
307 if (dart.is(e, dart.dynamic)) return e; 308 if (dart.is(e, html.File)) return e;
308 if (dart.is(e, dart.dynamic)) return e; 309 if (dart.is(e, html.Blob)) return e;
309 if (dart.is(e, dart.dynamic)) return e; 310 if (dart.is(e, html.FileList)) return e;
310 if (dart.is(e, dart.dynamic)) return e; 311 if (dart.is(e, html.ImageData)) return e;
311 if (dart.notNull(this.cloneNotRequired(e))) return e; 312 if (dart.notNull(this.cloneNotRequired(e))) return e;
312 if (dart.is(e, core.Map)) { 313 if (dart.is(e, core.Map)) {
313 let slot = this.findSlot(e); 314 let slot = this.findSlot(e);
314 let copy = this.readSlot(slot); 315 let copy = this.readSlot(slot);
315 if (copy != null) return copy; 316 if (copy != null) return copy;
316 copy = this.newJsMap(); 317 copy = this.newJsMap();
317 this.writeSlot(slot, copy); 318 this.writeSlot(slot, copy);
318 e.forEach(dart.fn((key, value) => { 319 e[dartx.forEach](dart.fn((key, value) => {
319 this.putIntoMap(copy, key, this.walk(value)); 320 this.putIntoMap(copy, key, this.walk(value));
320 }, dart.void, [dart.dynamic, dart.dynamic])); 321 }, dart.void, [dart.dynamic, dart.dynamic]));
321 return copy; 322 return copy;
322 } 323 }
323 if (dart.is(e, core.List)) { 324 if (dart.is(e, core.List)) {
324 let slot = this.findSlot(e); 325 let slot = this.findSlot(e);
325 let copy = this.readSlot(slot); 326 let copy = this.readSlot(slot);
326 if (copy != null) return copy; 327 if (copy != null) return copy;
327 copy = this.copyList(e, slot); 328 copy = this.copyList(e, slot);
328 return copy; 329 return copy;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 _TypedContextAttributes(alpha, antialias, depth, failIfMajorPerformanceCavea t, premultipliedAlpha, preserveDrawingBuffer, stencil) { 435 _TypedContextAttributes(alpha, antialias, depth, failIfMajorPerformanceCavea t, premultipliedAlpha, preserveDrawingBuffer, stencil) {
435 this.alpha = alpha; 436 this.alpha = alpha;
436 this.antialias = antialias; 437 this.antialias = antialias;
437 this.depth = depth; 438 this.depth = depth;
438 this.failIfMajorPerformanceCaveat = failIfMajorPerformanceCaveat; 439 this.failIfMajorPerformanceCaveat = failIfMajorPerformanceCaveat;
439 this.premultipliedAlpha = premultipliedAlpha; 440 this.premultipliedAlpha = premultipliedAlpha;
440 this.preserveDrawingBuffer = preserveDrawingBuffer; 441 this.preserveDrawingBuffer = preserveDrawingBuffer;
441 this.stencil = stencil; 442 this.stencil = stencil;
442 } 443 }
443 } 444 }
445 _TypedContextAttributes[dart.implements] = () => [web_gl.ContextAttributes];
444 dart.setSignature(_TypedContextAttributes, { 446 dart.setSignature(_TypedContextAttributes, {
445 constructors: () => ({_TypedContextAttributes: [_TypedContextAttributes, [co re.bool, core.bool, core.bool, core.bool, core.bool, core.bool, core.bool]]}) 447 constructors: () => ({_TypedContextAttributes: [_TypedContextAttributes, [co re.bool, core.bool, core.bool, core.bool, core.bool, core.bool, core.bool]]})
446 }); 448 });
449 dart.defineExtensionMembers(_TypedContextAttributes, [
450 'alpha',
451 'alpha',
452 'antialias',
453 'antialias',
454 'depth',
455 'depth',
456 'premultipliedAlpha',
457 'premultipliedAlpha',
458 'preserveDrawingBuffer',
459 'preserveDrawingBuffer',
460 'stencil',
461 'stencil',
462 'failIfMajorPerformanceCaveat',
463 'failIfMajorPerformanceCaveat'
464 ]);
447 function convertNativeToDart_ContextAttributes(nativeContextAttributes) { 465 function convertNativeToDart_ContextAttributes(nativeContextAttributes) {
448 if (dart.is(nativeContextAttributes, dart.dynamic)) { 466 if (dart.is(nativeContextAttributes, web_gl.ContextAttributes)) {
449 return nativeContextAttributes; 467 return nativeContextAttributes;
450 } 468 }
451 return new _TypedContextAttributes(dart.as(nativeContextAttributes.alpha, co re.bool), dart.as(nativeContextAttributes.antialias, core.bool), dart.as(nativeC ontextAttributes.depth, core.bool), dart.as(nativeContextAttributes.failIfMajorP erformanceCaveat, core.bool), dart.as(nativeContextAttributes.premultipliedAlpha , core.bool), dart.as(nativeContextAttributes.preserveDrawingBuffer, core.bool), dart.as(nativeContextAttributes.stencil, core.bool)); 469 return new _TypedContextAttributes(dart.as(nativeContextAttributes.alpha, co re.bool), dart.as(nativeContextAttributes.antialias, core.bool), dart.as(nativeC ontextAttributes.depth, core.bool), dart.as(nativeContextAttributes.failIfMajorP erformanceCaveat, core.bool), dart.as(nativeContextAttributes.premultipliedAlpha , core.bool), dart.as(nativeContextAttributes.preserveDrawingBuffer, core.bool), dart.as(nativeContextAttributes.stencil, core.bool));
452 } 470 }
453 dart.fn(convertNativeToDart_ContextAttributes); 471 dart.fn(convertNativeToDart_ContextAttributes, () => dart.definiteFunctionType (web_gl.ContextAttributes, [dart.dynamic]));
454 class _TypedImageData extends core.Object { 472 class _TypedImageData extends core.Object {
455 _TypedImageData(data, height, width) { 473 _TypedImageData(data, height, width) {
456 this.data = data; 474 this.data = data;
457 this.height = height; 475 this.height = height;
458 this.width = width; 476 this.width = width;
459 } 477 }
460 } 478 }
479 _TypedImageData[dart.implements] = () => [html.ImageData];
461 dart.setSignature(_TypedImageData, { 480 dart.setSignature(_TypedImageData, {
462 constructors: () => ({_TypedImageData: [_TypedImageData, [typed_data.Uint8Cl ampedList, core.int, core.int]]}) 481 constructors: () => ({_TypedImageData: [_TypedImageData, [typed_data.Uint8Cl ampedList, core.int, core.int]]})
463 }); 482 });
483 dart.defineExtensionMembers(_TypedImageData, ['data', 'height', 'width']);
464 function convertNativeToDart_ImageData(nativeImageData) { 484 function convertNativeToDart_ImageData(nativeImageData) {
465 0; 485 0;
466 if (dart.is(nativeImageData, dart.dynamic)) { 486 if (dart.is(nativeImageData, html.ImageData)) {
467 let data = dart.dload(nativeImageData, 'data'); 487 let data = nativeImageData[dartx.data];
468 if (data.constructor === Array) { 488 if (data.constructor === Array) {
469 if (typeof CanvasPixelArray !== "undefined") { 489 if (typeof CanvasPixelArray !== "undefined") {
470 data.constructor = CanvasPixelArray; 490 data.constructor = CanvasPixelArray;
471 data.BYTES_PER_ELEMENT = 1; 491 data.BYTES_PER_ELEMENT = 1;
472 } 492 }
473 } 493 }
474 return nativeImageData; 494 return nativeImageData;
475 } 495 }
476 return new _TypedImageData(dart.as(nativeImageData.data, typed_data.Uint8Cla mpedList), dart.as(nativeImageData.height, core.int), dart.as(nativeImageData.wi dth, core.int)); 496 return new _TypedImageData(dart.as(nativeImageData.data, typed_data.Uint8Cla mpedList), dart.as(nativeImageData.height, core.int), dart.as(nativeImageData.wi dth, core.int));
477 } 497 }
478 dart.fn(convertNativeToDart_ImageData); 498 dart.fn(convertNativeToDart_ImageData, html.ImageData, [dart.dynamic]);
479 function convertDartToNative_ImageData(imageData) { 499 function convertDartToNative_ImageData(imageData) {
480 if (dart.is(imageData, _TypedImageData)) { 500 if (dart.is(imageData, _TypedImageData)) {
481 return {data: imageData.data, height: imageData.height, width: imageData.w idth}; 501 return {data: imageData.data, height: imageData.height, width: imageData.w idth};
482 } 502 }
483 return imageData; 503 return imageData;
484 } 504 }
485 dart.fn(convertDartToNative_ImageData); 505 dart.fn(convertDartToNative_ImageData, dart.dynamic, [html.ImageData]);
486 const _serializedScriptValue = 'num|String|bool|' + 'JSExtendableArray|=Object |' + 'Blob|File|NativeByteBuffer|NativeTypedData'; 506 const _serializedScriptValue = 'num|String|bool|' + 'JSExtendableArray|=Object |' + 'Blob|File|NativeByteBuffer|NativeTypedData';
487 const annotation_Creates_SerializedScriptValue = dart.const(new _js_helper.Cre ates(_serializedScriptValue)); 507 const annotation_Creates_SerializedScriptValue = dart.const(new _js_helper.Cre ates(_serializedScriptValue));
488 const annotation_Returns_SerializedScriptValue = dart.const(new _js_helper.Ret urns(_serializedScriptValue)); 508 const annotation_Returns_SerializedScriptValue = dart.const(new _js_helper.Ret urns(_serializedScriptValue));
489 function convertNativeToDart_Dictionary(object) { 509 function convertNativeToDart_Dictionary(object) {
490 if (object == null) return null; 510 if (object == null) return null;
491 let dict = dart.map(); 511 let dict = dart.map();
492 let keys = Object.getOwnPropertyNames(object); 512 let keys = Object.getOwnPropertyNames(object);
493 for (let key of dart.as(keys, core.Iterable)) { 513 for (let key of dart.as(keys, core.Iterable)) {
494 dict.set(key, object[key]); 514 dict[dartx.set](key, object[key]);
495 } 515 }
496 return dict; 516 return dict;
497 } 517 }
498 dart.fn(convertNativeToDart_Dictionary, core.Map, [dart.dynamic]); 518 dart.fn(convertNativeToDart_Dictionary, core.Map, [dart.dynamic]);
499 function convertDartToNative_Dictionary(dict, postCreate) { 519 function convertDartToNative_Dictionary(dict, postCreate) {
500 if (postCreate === void 0) postCreate = null; 520 if (postCreate === void 0) postCreate = null;
501 if (dict == null) return null; 521 if (dict == null) return null;
502 let object = {}; 522 let object = {};
503 if (postCreate != null) { 523 if (postCreate != null) {
504 dart.dcall(postCreate, object); 524 dart.dcall(postCreate, object);
505 } 525 }
506 dict.forEach(dart.fn((key, value) => { 526 dict[dartx.forEach](dart.fn((key, value) => {
507 object[key] = value; 527 object[key] = value;
508 }, dart.void, [core.String, dart.dynamic])); 528 }, dart.void, [core.String, dart.dynamic]));
509 return object; 529 return object;
510 } 530 }
511 dart.fn(convertDartToNative_Dictionary, dart.dynamic, [core.Map], [dart.functi onType(dart.void, [dart.dynamic])]); 531 dart.fn(convertDartToNative_Dictionary, dart.dynamic, [core.Map], [dart.functi onType(dart.void, [dart.dynamic])]);
512 function convertDartToNative_StringArray(input) { 532 function convertDartToNative_StringArray(input) {
513 return input; 533 return input;
514 } 534 }
515 dart.fn(convertDartToNative_StringArray, core.List, [core.List$(core.String)]) ; 535 dart.fn(convertDartToNative_StringArray, core.List, [core.List$(core.String)]) ;
516 function convertNativeToDart_DateTime(date) { 536 function convertNativeToDart_DateTime(date) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 } 629 }
610 dart.fn(isJavaScriptPromise, core.bool, [dart.dynamic]); 630 dart.fn(isJavaScriptPromise, core.bool, [dart.dynamic]);
611 function convertNativePromiseToDartFuture(promise) { 631 function convertNativePromiseToDartFuture(promise) {
612 let completer = async.Completer.new(); 632 let completer = async.Completer.new();
613 let then = dart.dcall(/* Unimplemented unknown name */convertDartClosureToJS , dart.fn(result => completer.complete(result), dart.void, [dart.dynamic]), 1); 633 let then = dart.dcall(/* Unimplemented unknown name */convertDartClosureToJS , dart.fn(result => completer.complete(result), dart.void, [dart.dynamic]), 1);
614 let error = dart.dcall(/* Unimplemented unknown name */convertDartClosureToJ S, dart.fn(result => completer.completeError(result), dart.void, [dart.dynamic]) , 1); 634 let error = dart.dcall(/* Unimplemented unknown name */convertDartClosureToJ S, dart.fn(result => completer.completeError(result), dart.void, [dart.dynamic]) , 1);
615 let newPromise = promise.then(then).catch(error); 635 let newPromise = promise.then(then).catch(error);
616 return completer.future; 636 return completer.future;
617 } 637 }
618 dart.fn(convertNativePromiseToDartFuture, async.Future, [dart.dynamic]); 638 dart.fn(convertNativePromiseToDartFuture, async.Future, [dart.dynamic]);
639 function wrap_jso(jsObject) {
640 return jsObject;
641 }
642 dart.fn(wrap_jso);
643 function unwrap_jso(dartClass_instance) {
644 return dartClass_instance;
645 }
646 dart.fn(unwrap_jso);
619 class Device extends core.Object { 647 class Device extends core.Object {
620 static get userAgent() { 648 static get userAgent() {
621 return dart.as(dart.dload(html.window.navigator.raw, 'userAgent'), core.St ring); 649 return html.window[dartx.navigator][dartx.userAgent];
622 } 650 }
623 static get isOpera() { 651 static get isOpera() {
624 if (Device._isOpera == null) { 652 if (Device._isOpera == null) {
625 Device._isOpera = Device.userAgent[dartx.contains]("Opera", 0); 653 Device._isOpera = Device.userAgent[dartx.contains]("Opera", 0);
626 } 654 }
627 return Device._isOpera; 655 return Device._isOpera;
628 } 656 }
629 static get isIE() { 657 static get isIE() {
630 if (Device._isIE == null) { 658 if (Device._isIE == null) {
631 Device._isIE = !dart.notNull(Device.isOpera) && dart.notNull(Device.user Agent[dartx.contains]("Trident/", 0)); 659 Device._isIE = !dart.notNull(Device.isOpera) && dart.notNull(Device.user Agent[dartx.contains]("Trident/", 0));
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 Device._isFirefox = null; 719 Device._isFirefox = null;
692 Device._isWebKit = null; 720 Device._isWebKit = null;
693 Device._cachedCssPrefix = null; 721 Device._cachedCssPrefix = null;
694 Device._cachedPropertyPrefix = null; 722 Device._cachedPropertyPrefix = null;
695 const _childNodes = Symbol('_childNodes'); 723 const _childNodes = Symbol('_childNodes');
696 const _node = Symbol('_node'); 724 const _node = Symbol('_node');
697 const _iterable = Symbol('_iterable'); 725 const _iterable = Symbol('_iterable');
698 const _filtered = Symbol('_filtered'); 726 const _filtered = Symbol('_filtered');
699 class FilteredElementList extends collection.ListBase$(html.Element) { 727 class FilteredElementList extends collection.ListBase$(html.Element) {
700 FilteredElementList(node) { 728 FilteredElementList(node) {
701 this[_childNodes] = node.nodes; 729 this[_childNodes] = node[dartx.nodes];
702 this[_node] = node; 730 this[_node] = node;
703 } 731 }
704 get [_iterable]() { 732 get [_iterable]() {
705 return new (_internal.WhereIterable$(html.Element))(this[_childNodes], dar t.fn(n => dart.is(n, html.Element), core.bool, [html.Element])); 733 return new (_internal.WhereIterable$(html.Element))(this[_childNodes], dar t.fn(n => dart.is(n, html.Element), core.bool, [html.Element]));
706 } 734 }
707 get [_filtered]() { 735 get [_filtered]() {
708 return core.List$(html.Element).from(this[_iterable], {growable: false}); 736 return core.List$(html.Element).from(this[_iterable], {growable: false});
709 } 737 }
710 forEach(f) { 738 forEach(f) {
711 this[_filtered][dartx.forEach](f); 739 this[_filtered][dartx.forEach](f);
712 } 740 }
713 set(index, value) { 741 set(index, value) {
714 this.get(index).replaceWith(value); 742 this.get(index)[dartx.replaceWith](value);
715 return value; 743 return value;
716 } 744 }
717 set length(newLength) { 745 set length(newLength) {
718 let len = this.length; 746 let len = this.length;
719 if (dart.notNull(newLength) >= dart.notNull(len)) { 747 if (dart.notNull(newLength) >= dart.notNull(len)) {
720 return; 748 return;
721 } else if (dart.notNull(newLength) < 0) { 749 } else if (dart.notNull(newLength) < 0) {
722 dart.throw(new core.ArgumentError("Invalid list length")); 750 dart.throw(new core.ArgumentError("Invalid list length"));
723 } 751 }
724 this.removeRange(newLength, len); 752 this.removeRange(newLength, len);
725 } 753 }
726 add(value) { 754 add(value) {
727 this[_childNodes][dartx.add](value); 755 this[_childNodes][dartx.add](value);
728 } 756 }
729 addAll(iterable) { 757 addAll(iterable) {
730 for (let element of iterable) { 758 for (let element of iterable) {
731 this.add(element); 759 this.add(element);
732 } 760 }
733 } 761 }
734 contains(needle) { 762 contains(needle) {
735 if (!dart.is(needle, html.Element)) return false; 763 if (!dart.is(needle, html.Element)) return false;
736 let element = dart.as(needle, html.Element); 764 let element = dart.as(needle, html.Element);
737 return dart.equals(element.parentNode, this[_node]); 765 return dart.equals(element[dartx.parentNode], this[_node]);
738 } 766 }
739 get reversed() { 767 get reversed() {
740 return this[_filtered][dartx.reversed]; 768 return this[_filtered][dartx.reversed];
741 } 769 }
742 sort(compare) { 770 sort(compare) {
743 if (compare === void 0) compare = null; 771 if (compare === void 0) compare = null;
744 dart.throw(new core.UnsupportedError('Cannot sort filtered list')); 772 dart.throw(new core.UnsupportedError('Cannot sort filtered list'));
745 } 773 }
746 setRange(start, end, iterable, skipCount) { 774 setRange(start, end, iterable, skipCount) {
747 if (skipCount === void 0) skipCount = 0; 775 if (skipCount === void 0) skipCount = 0;
748 dart.throw(new core.UnsupportedError('Cannot setRange on filtered list')); 776 dart.throw(new core.UnsupportedError('Cannot setRange on filtered list'));
749 } 777 }
750 fillRange(start, end, fillValue) { 778 fillRange(start, end, fillValue) {
751 if (fillValue === void 0) fillValue = null; 779 if (fillValue === void 0) fillValue = null;
752 dart.throw(new core.UnsupportedError('Cannot fillRange on filtered list')) ; 780 dart.throw(new core.UnsupportedError('Cannot fillRange on filtered list')) ;
753 } 781 }
754 replaceRange(start, end, iterable) { 782 replaceRange(start, end, iterable) {
755 dart.throw(new core.UnsupportedError('Cannot replaceRange on filtered list ')); 783 dart.throw(new core.UnsupportedError('Cannot replaceRange on filtered list '));
756 } 784 }
757 removeRange(start, end) { 785 removeRange(start, end) {
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'), dart.void, [dart.dynamic])); 786 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'), dart.void, [dart.dynamic]));
759 } 787 }
760 clear() { 788 clear() {
761 this[_childNodes][dartx.clear](); 789 this[_childNodes][dartx.clear]();
762 } 790 }
763 removeLast() { 791 removeLast() {
764 let result = this[_iterable][dartx.last]; 792 let result = this[_iterable][dartx.last];
765 if (result != null) { 793 if (result != null) {
766 result.remove(); 794 result[dartx.remove]();
767 } 795 }
768 return result; 796 return result;
769 } 797 }
770 insert(index, value) { 798 insert(index, value) {
771 if (index == this.length) { 799 if (index == this.length) {
772 this.add(value); 800 this.add(value);
773 } else { 801 } else {
774 let element = this[_iterable][dartx.elementAt](index); 802 let element = this[_iterable][dartx.elementAt](index);
775 element.parentNode.insertBefore(value, element); 803 element[dartx.parentNode][dartx.insertBefore](value, element);
776 } 804 }
777 } 805 }
778 insertAll(index, iterable) { 806 insertAll(index, iterable) {
779 if (index == this.length) { 807 if (index == this.length) {
780 this.addAll(iterable); 808 this.addAll(iterable);
781 } else { 809 } else {
782 let element = this[_iterable][dartx.elementAt](index); 810 let element = this[_iterable][dartx.elementAt](index);
783 element.parentNode.insertAllBefore(iterable, element); 811 element[dartx.parentNode][dartx.insertAllBefore](iterable, element);
784 } 812 }
785 } 813 }
786 removeAt(index) { 814 removeAt(index) {
787 let result = this.get(index); 815 let result = this.get(index);
788 result.remove(); 816 result[dartx.remove]();
789 return result; 817 return result;
790 } 818 }
791 remove(element) { 819 remove(element) {
792 if (!dart.is(element, html.Element)) return false; 820 if (!dart.is(element, html.Element)) return false;
793 if (dart.notNull(this.contains(element))) { 821 if (dart.notNull(this.contains(element))) {
794 dart.as(element, html.Element).remove(); 822 dart.as(element, html.Element)[dartx.remove]();
795 return true; 823 return true;
796 } else { 824 } else {
797 return false; 825 return false;
798 } 826 }
799 } 827 }
800 get length() { 828 get length() {
801 return this[_iterable][dartx.length]; 829 return this[_iterable][dartx.length];
802 } 830 }
803 get(index) { 831 get(index) {
804 return this[_iterable][dartx.elementAt](index); 832 return this[_iterable][dartx.elementAt](index);
805 } 833 }
806 get iterator() { 834 get iterator() {
807 return this[_filtered][dartx.iterator]; 835 return this[_filtered][dartx.iterator];
808 } 836 }
809 get rawList() { 837 get rawList() {
810 return this[_node].childNodes; 838 return this[_node][dartx.childNodes];
811 } 839 }
812 } 840 }
813 FilteredElementList[dart.implements] = () => [NodeListWrapper]; 841 FilteredElementList[dart.implements] = () => [NodeListWrapper];
814 dart.setSignature(FilteredElementList, { 842 dart.setSignature(FilteredElementList, {
815 constructors: () => ({FilteredElementList: [FilteredElementList, [html.Node] ]}), 843 constructors: () => ({FilteredElementList: [FilteredElementList, [html.Node] ]}),
816 methods: () => ({ 844 methods: () => ({
817 forEach: [dart.void, [dart.functionType(dart.void, [html.Element])]], 845 forEach: [dart.void, [dart.functionType(dart.void, [html.Element])]],
818 set: [dart.void, [core.int, html.Element]], 846 set: [dart.void, [core.int, html.Element]],
819 add: [dart.void, [html.Element]], 847 add: [dart.void, [html.Element]],
820 addAll: [dart.void, [core.Iterable$(html.Element)]], 848 addAll: [dart.void, [core.Iterable$(html.Element)]],
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 exports.convertDartToNative_DateTime = convertDartToNative_DateTime; 944 exports.convertDartToNative_DateTime = convertDartToNative_DateTime;
917 exports.convertDartToNative_PrepareForStructuredClone = convertDartToNative_Pr epareForStructuredClone; 945 exports.convertDartToNative_PrepareForStructuredClone = convertDartToNative_Pr epareForStructuredClone;
918 exports.convertNativeToDart_AcceptStructuredClone = convertNativeToDart_Accept StructuredClone; 946 exports.convertNativeToDart_AcceptStructuredClone = convertNativeToDart_Accept StructuredClone;
919 exports.isJavaScriptDate = isJavaScriptDate; 947 exports.isJavaScriptDate = isJavaScriptDate;
920 exports.isJavaScriptRegExp = isJavaScriptRegExp; 948 exports.isJavaScriptRegExp = isJavaScriptRegExp;
921 exports.isJavaScriptArray = isJavaScriptArray; 949 exports.isJavaScriptArray = isJavaScriptArray;
922 exports.isJavaScriptSimpleObject = isJavaScriptSimpleObject; 950 exports.isJavaScriptSimpleObject = isJavaScriptSimpleObject;
923 exports.isImmutableJavaScriptArray = isImmutableJavaScriptArray; 951 exports.isImmutableJavaScriptArray = isImmutableJavaScriptArray;
924 exports.isJavaScriptPromise = isJavaScriptPromise; 952 exports.isJavaScriptPromise = isJavaScriptPromise;
925 exports.convertNativePromiseToDartFuture = convertNativePromiseToDartFuture; 953 exports.convertNativePromiseToDartFuture = convertNativePromiseToDartFuture;
954 exports.wrap_jso = wrap_jso;
955 exports.unwrap_jso = unwrap_jso;
926 exports.Device = Device; 956 exports.Device = Device;
927 exports.FilteredElementList = FilteredElementList; 957 exports.FilteredElementList = FilteredElementList;
928 exports.Lists = Lists; 958 exports.Lists = Lists;
929 exports.NodeListWrapper = NodeListWrapper; 959 exports.NodeListWrapper = NodeListWrapper;
930 }); 960 });
OLDNEW
« no previous file with comments | « lib/runtime/dart/core.js ('k') | lib/runtime/dart/indexed_db.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698