| 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 part of polymer; | 5 part of polymer; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Use this annotation to publish a field as an attribute. For example: | 8 * Use this annotation to publish a field as an attribute. For example: |
| 9 * | 9 * |
| 10 * class MyPlaybackElement extends PolymerElement { | 10 * class MyPlaybackElement extends PolymerElement { |
| 11 * // This will be available as an HTML attribute, for example: | 11 * // This will be available as an HTML attribute, for example: |
| 12 * // <my-playback volume="11"> | 12 * // <my-playback volume="11"> |
| 13 * @published double volume; | 13 * @published double volume; |
| 14 * } | 14 * } |
| 15 */ | 15 */ |
| 16 // TODO(jmesserly): does @published imply @observable or vice versa? | 16 // TODO(jmesserly): does @published imply @observable or vice versa? |
| 17 const published = const PublishedProperty(); | 17 const published = const PublishedProperty(); |
| 18 | 18 |
| 19 /** An annotation used to publish a field as an attribute. See [published]. */ | 19 /** An annotation used to publish a field as an attribute. See [published]. */ |
| 20 class PublishedProperty extends ObservableProperty { | 20 class PublishedProperty extends ObservableProperty { |
| 21 const PublishedProperty(); | 21 const PublishedProperty(); |
| 22 } | 22 } |
| 23 | 23 |
| 24 /** | 24 /** |
| 25 * The mixin class for Polymer elements. It provides convenience features on top | 25 * The mixin class for Polymer elements. It provides convenience features on top |
| 26 * of the custom elements web standard. | 26 * of the custom elements web standard. |
| 27 * |
| 28 * If this class is used as a mixin, |
| 29 * you must call `polymerCreated()` from the body of your constructor. |
| 27 */ | 30 */ |
| 28 abstract class Polymer implements Element, Observable, NodeBindExtension { | 31 abstract class Polymer implements Element, Observable, NodeBindExtension { |
| 29 // Fully ported from revision: | 32 // Fully ported from revision: |
| 30 // https://github.com/Polymer/polymer/blob/b7200854b2441a22ce89f6563963f36c50f
5150d | 33 // https://github.com/Polymer/polymer/blob/b7200854b2441a22ce89f6563963f36c50f
5150d |
| 31 // | 34 // |
| 32 // src/boot.js (static APIs on "Polymer" object) | 35 // src/boot.js (static APIs on "Polymer" object) |
| 33 // src/instance/attributes.js | 36 // src/instance/attributes.js |
| 34 // src/instance/base.js | 37 // src/instance/base.js |
| 35 // src/instance/events.js | 38 // src/instance/events.js |
| 36 // src/instance/mdv.js | 39 // src/instance/mdv.js |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 * Gets the shadow root associated with the corresponding custom element. | 120 * Gets the shadow root associated with the corresponding custom element. |
| 118 * | 121 * |
| 119 * This is identical to [shadowRoot], unless there are multiple levels of | 122 * This is identical to [shadowRoot], unless there are multiple levels of |
| 120 * inheritance and they each have their own shadow root. For example, | 123 * inheritance and they each have their own shadow root. For example, |
| 121 * this can happen if the base class and subclass both have `<template>` tags | 124 * this can happen if the base class and subclass both have `<template>` tags |
| 122 * in their `<polymer-element>` tags. | 125 * in their `<polymer-element>` tags. |
| 123 */ | 126 */ |
| 124 // TODO(jmesserly): Polymer does not have this feature. Reconcile. | 127 // TODO(jmesserly): Polymer does not have this feature. Reconcile. |
| 125 ShadowRoot getShadowRoot(String customTagName) => _shadowRoots[customTagName]; | 128 ShadowRoot getShadowRoot(String customTagName) => _shadowRoots[customTagName]; |
| 126 | 129 |
| 130 /** |
| 131 * If this class is used as a mixin, this method must be called from inside |
| 132 * of the `created()` constructor. |
| 133 * |
| 134 * If this class is a superclass, calling `super.created()` is sufficient. |
| 135 */ |
| 127 void polymerCreated() { | 136 void polymerCreated() { |
| 128 if (this.ownerDocument.window != null || alwaysPrepare || | 137 if (this.ownerDocument.window != null || alwaysPrepare || |
| 129 _preparingElements > 0) { | 138 _preparingElements > 0) { |
| 130 prepareElement(); | 139 prepareElement(); |
| 131 } | 140 } |
| 132 } | 141 } |
| 133 | 142 |
| 134 /** Retrieves the custom element name by inspecting the host node. */ | 143 /** Retrieves the custom element name by inspecting the host node. */ |
| 135 String get _customTagName { | 144 String get _customTagName { |
| 136 var isAttr = attributes['is']; | 145 var isAttr = attributes['is']; |
| (...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1081 | 1090 |
| 1082 class _PropertyValue { | 1091 class _PropertyValue { |
| 1083 Object oldValue, newValue; | 1092 Object oldValue, newValue; |
| 1084 _PropertyValue(this.oldValue); | 1093 _PropertyValue(this.oldValue); |
| 1085 } | 1094 } |
| 1086 | 1095 |
| 1087 class _PolymerExpressionsWithEventDelegate extends PolymerExpressions { | 1096 class _PolymerExpressionsWithEventDelegate extends PolymerExpressions { |
| 1088 prepareBinding(String path, name, node) => | 1097 prepareBinding(String path, name, node) => |
| 1089 Polymer.prepareBinding(path, name, node, super.prepareBinding); | 1098 Polymer.prepareBinding(path, name, node, super.prepareBinding); |
| 1090 } | 1099 } |
| OLD | NEW |