| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 class $CLASSNAME extends _ElementImpl | |
| 6 implements Document | |
| 7 native "*HTMLHtmlElement" { | |
| 8 $!MEMBERS | |
| 9 | |
| 10 // For efficiency and simplicity, we always use the HtmlElement as the | |
| 11 // Document but sometimes internally we need the real JS document object. | |
| 12 _NodeImpl get _jsDocument() native "return this.parentNode;"; | |
| 13 | |
| 14 // The document doesn't have a parent element. | |
| 15 _ElementImpl get parent() => null; | |
| 16 } | |
| 17 | |
| 18 // This class should not be externally visible. If a user ever gets access to | |
| 19 // a _SecretHtmlDocumentImpl object that is a bug. This object is hidden by | |
| 20 // adding checks to all methods that could an HTMLDocument. We believe that | |
| 21 // list is limited to Event.target, and HTMLHtmlElement.parent. | |
| 22 class _SecretHtmlDocumentImpl extends _NodeImpl implements Node | |
| 23 native "*HTMLDocument" { | |
| 24 _DocumentImpl get _documentElement() native "return this.documentElement;"; | |
| 25 } | |
| 26 | |
| 27 EventTarget _FixHtmlDocumentReference(EventTarget eventTarget) { | |
| 28 if (eventTarget is _SecretHtmlDocumentImpl) { | |
| 29 _SecretHtmlDocumentImpl secretDocument = eventTarget; | |
| 30 return secretDocument._documentElement; | |
| 31 } else { | |
| 32 return eventTarget; | |
| 33 } | |
| 34 } | |
| OLD | NEW |