OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 /** | 5 /** |
6 * Support for interoperating with JavaScript. | 6 * Support for interoperating with JavaScript. |
7 * | 7 * |
8 * This library provides access to JavaScript objects from Dart, allowing | 8 * This library provides access to JavaScript objects from Dart, allowing |
9 * Dart code to get and set properties, and call methods of JavaScript objects | 9 * Dart code to get and set properties, and call methods of JavaScript objects |
10 * and invoke JavaScript functions. The library takes care of converting | 10 * and invoke JavaScript functions. The library takes care of converting |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 } | 665 } |
666 | 666 |
667 // Interfaces that are safe to slam on all DOM classes. | 667 // Interfaces that are safe to slam on all DOM classes. |
668 // Adding implementsClause would be risky as it could contain Function which | 668 // Adding implementsClause would be risky as it could contain Function which |
669 // is likely to break a lot of instanceof checks. | 669 // is likely to break a lot of instanceof checks. |
670 abstract class JSObjectInterfacesDom $implementsClauseDom { | 670 abstract class JSObjectInterfacesDom $implementsClauseDom { |
671 } | 671 } |
672 | 672 |
673 patch class JSObject { | 673 patch class JSObject { |
674 factory JSObject.create(JsObject jsObject) { | 674 factory JSObject.create(JsObject jsObject) { |
675 return new JSObjectImpl.internal()..blink_jsObject = jsObject; | 675 var ret = new JSObjectImpl.internal()..blink_jsObject = jsObject; |
| 676 jsObject._dartHtmlWrapper = ret; |
| 677 return ret; |
676 } | 678 } |
677 } | 679 } |
678 | 680 |
679 patch class JSFunction { | 681 patch class JSFunction { |
680 factory JSFunction.create(JsObject jsObject) { | 682 factory JSFunction.create(JsObject jsObject) { |
681 return new JSFunctionImpl.internal()..blink_jsObject = jsObject; | 683 var ret = new JSFunctionImpl.internal()..blink_jsObject = jsObject; |
| 684 jsObject._dartHtmlWrapper = ret; |
| 685 return ret; |
682 } | 686 } |
683 } | 687 } |
684 | 688 |
685 patch class JSArray { | 689 patch class JSArray { |
686 factory JSArray.create(JsObject jsObject) { | 690 factory JSArray.create(JsObject jsObject) { |
687 return new JSArrayImpl.internal()..blink_jsObject = jsObject; | 691 var ret = new JSArrayImpl.internal()..blink_jsObject = jsObject; |
| 692 jsObject._dartHtmlWrapper = ret; |
| 693 return ret; |
688 } | 694 } |
689 } | 695 } |
690 | 696 |
691 _registerAllJsInterfaces() { | 697 _registerAllJsInterfaces() { |
692 _registerJsInterfaces([${allTypes.join(", ")}]); | 698 _registerJsInterfaces([${allTypes.join(", ")}]); |
693 } | 699 } |
694 | 700 |
695 '''); | 701 '''); |
696 ret..addAll(["dart:js", "JSInteropImpl.dart", sb.toString()]); | 702 ret..addAll(["dart:js", "JSInteropImpl.dart", sb.toString()]); |
697 return ret; | 703 return ret; |
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1554 var ret = _interopCaptureThisExpando[f]; | 1560 var ret = _interopCaptureThisExpando[f]; |
1555 if (ret == null) { | 1561 if (ret == null) { |
1556 // TODO(jacobr): we could optimize this. | 1562 // TODO(jacobr): we could optimize this. |
1557 ret = new JSFunction.create( | 1563 ret = new JSFunction.create( |
1558 new JsFunction.withThis(new _CreateDartFunctionForInterop(f))); | 1564 new JsFunction.withThis(new _CreateDartFunctionForInterop(f))); |
1559 _interopCaptureThisExpando[f] = ret; | 1565 _interopCaptureThisExpando[f] = ret; |
1560 } | 1566 } |
1561 return ret; | 1567 return ret; |
1562 } | 1568 } |
1563 } | 1569 } |
OLD | NEW |