| 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 class $CLASSNAME extends _ElementImpl | 5 class $CLASSNAME extends _ElementImpl |
| 6 implements Document | 6 implements Document |
| 7 native "*HTMLHtmlElement" { | 7 native "*HTMLHtmlElement" { |
| 8 $!MEMBERS | 8 $!MEMBERS |
| 9 | 9 |
| 10 // TODO(jacobr): remove these methods and let them be generated automatically | |
| 11 // once dart supports defining fields with the same name in an interface and | |
| 12 // its parent interface. | |
| 13 String get title() native "return this.parentNode.title;"; | |
| 14 void set title(String value) native "this.parentNode.title = value;"; | |
| 15 | |
| 16 | |
| 17 // For efficiency and simplicity, we always use the HtmlElement as the | 10 // For efficiency and simplicity, we always use the HtmlElement as the |
| 18 // Document but sometimes internally we need the real JS document object. | 11 // Document but sometimes internally we need the real JS document object. |
| 19 _NodeImpl get _jsDocument() native "return this.parentNode;"; | 12 _NodeImpl get _jsDocument() native "return this.parentNode;"; |
| 20 | 13 |
| 21 // The document doesn't have a parent element. | 14 // The document doesn't have a parent element. |
| 22 _ElementImpl get parent() => null; | 15 _ElementImpl get parent() => null; |
| 23 } | 16 } |
| 24 | 17 |
| 25 // This class should not be externally visible. If a user ever gets access to | 18 // This class should not be externally visible. If a user ever gets access to |
| 26 // a _SecretHtmlDocumentImpl object that is a bug. This object is hidden by | 19 // a _SecretHtmlDocumentImpl object that is a bug. This object is hidden by |
| 27 // adding checks to all methods that could an HTMLDocument. We believe that | 20 // adding checks to all methods that could an HTMLDocument. We believe that |
| 28 // list is limited to Event.target, and HTMLHtmlElement.parent. | 21 // list is limited to Event.target, and HTMLHtmlElement.parent. |
| 29 class _SecretHtmlDocumentImpl extends _NodeImpl implements Node | 22 class _SecretHtmlDocumentImpl extends _NodeImpl implements Node |
| 30 native "*HTMLDocument" { | 23 native "*HTMLDocument" { |
| 31 _DocumentImpl get _documentElement() native "return this.documentElement;"; | 24 _DocumentImpl get _documentElement() native "return this.documentElement;"; |
| 32 } | 25 } |
| 33 | 26 |
| 34 EventTarget _FixHtmlDocumentReference(EventTarget eventTarget) { | 27 EventTarget _FixHtmlDocumentReference(EventTarget eventTarget) { |
| 35 if (eventTarget is _SecretHtmlDocumentImpl) { | 28 if (eventTarget is _SecretHtmlDocumentImpl) { |
| 36 _SecretHtmlDocumentImpl secretDocument = eventTarget; | 29 _SecretHtmlDocumentImpl secretDocument = eventTarget; |
| 37 return secretDocument._documentElement; | 30 return secretDocument._documentElement; |
| 38 } else { | 31 } else { |
| 39 return eventTarget; | 32 return eventTarget; |
| 40 } | 33 } |
| 41 } | 34 } |
| OLD | NEW |