Index: lib/src/info.dart |
diff --git a/lib/src/info.dart b/lib/src/info.dart |
index c87ce0ecee8fddf56388f0d5da9f5b2f2f27d4d3..0ef097ba8dfe79dcc214037dc43f26931820c482 100644 |
--- a/lib/src/info.dart |
+++ b/lib/src/info.dart |
@@ -294,6 +294,22 @@ class ComponentInfo extends LibraryInfo { |
ComponentInfo(this.element, this.declaringFile, this.tagName, this.extendsTag, |
this.constructor, this.template); |
+ |
+ /** |
+ * Gets the HTML tag extended by the base of the component hierarchy. |
+ * Equivalent to [extendsTag] if this inherits directly from an HTML element, |
+ * in other words, if [extendsComponent] is null. |
+ */ |
+ String get baseExtendsTag { |
+ var comp = this; |
+ while (true) { |
+ var e = comp.extendsComponent; |
+ if (e == null) { |
+ return comp.extendsTag; |
+ } |
+ comp = e; |
+ } |
Siggi Cherem (dart-lang)
2012/11/29 18:06:57
how about doing this recursively?
String get base
Jennifer Messerly
2012/11/30 03:21:41
Done.
|
+ } |
} |
/** Base tree visitor for the Analyzer infos. */ |
@@ -403,7 +419,10 @@ class ElementInfo extends NodeInfo<Element> { |
final Map<String, List<EventInfo>> events = |
new SplayTreeMap<String, List<EventInfo>>(); |
- /** Collected information about `data-value="name:value"` expressions. */ |
+ /** |
+ * Collected information about `data-value="name:value"` expressions. |
+ * Note: this feature is deprecated and should be removed after grace period. |
+ */ |
final Map<String, String> values = new SplayTreeMap<String, String>(); |
// TODO(jmesserly): we could keep this local to the analyzer. |
@@ -418,6 +437,19 @@ class ElementInfo extends NodeInfo<Element> { |
bool get isTemplateElement => false; |
+ /** |
+ * For a builtin HTML element this returns the [node.tagName], otherwise it |
+ * returns [component.baseExtendsTag]. This is useful when looking up which |
+ * DOM property this element supports. |
+ * |
+ * **Note:** this returns node.tagName right now, until we fix issue #82. |
+ */ |
+ String get baseTagName { |
+ return node.tagName; |
+ // TODO(jmesserly): turn this on when issue #82 is fixed. |
Jennifer Messerly
2012/11/29 05:34:35
I realized if we have "input" two way bindings but
|
+ //return component != null ? component.baseExtendsTag : node.tagName; |
+ } |
+ |
ElementInfo(Element node, ElementInfo parent) : super(node, parent); |
String toString() => '#<ElementInfo ' |
@@ -465,6 +497,12 @@ class AttributeInfo { |
final List<String> bindings; |
/** |
+ * A two-way binding that needs a watcher. This is used in cases where we |
+ * don't have an event. |
+ */ |
+ final bool customTwoWayBinding; |
+ |
+ /** |
* For a text attribute this contains the text content. This is used by most |
* attributes and represents the value that will be assigned to them. If this |
* has been assigned then [isText] will be true. |
@@ -480,7 +518,7 @@ class AttributeInfo { |
final List<String> textContent; |
AttributeInfo(this.bindings, {this.isStyle: false, this.isClass: false, |
- this.textContent}) { |
+ this.textContent, this.customTwoWayBinding: false}) { |
assert(isText || isClass || bindings.length == 1); |
assert(bindings.length > 0); |