From 86bc783160b865c9c93d4a76927a0718f3d3209b Mon Sep 17 00:00:00 2001
From: John Messerly
Date: Wed, 10 Dec 2014 16:46:21 -0800
Subject: [PATCH] Expands the `` element to remember logical DOM
It's now capable of rerendering if logical DOM changes.
Notes:
* lightChildren, if present, indicates the logical child views. lightParent will be set for those elements.
* lightChildren is an array, because that seemed like the "simplest thing that could possibly work". We could expose linked list APIs instead (firstChild, nextSibling, etc) if we wanted.
* addLightChild/removeLightChild are a convenience, but not recommended for adding large number of items because they automatically call distributeContent(). Another option would be to schedule it and do it lazily.
---
polymer-core.html | 3 -
src/features/content.html | 304 +++++++++++++++++++++++++++---
src/features/ready.html | 5 +
test/index.html | 1 +
test/unit/content.html | 383 ++++++++++++++++++++++++++++++++++++++
5 files changed, 669 insertions(+), 27 deletions(-)
create mode 100644 test/unit/content.html
diff --git a/polymer-core.html b/polymer-core.html
index 96e59d438e..1879611959 100644
--- a/polymer-core.html
+++ b/polymer-core.html
@@ -58,9 +58,6 @@
}
this.listenListeners();
this.listenKeyPresses();
- if (this._useContent) {
- this.distributeContent();
- }
this.takeAttributes();
}
diff --git a/src/features/content.html b/src/features/content.html
index b0c56943e0..1fa9118fbe 100644
--- a/src/features/content.html
+++ b/src/features/content.html
@@ -7,7 +7,16 @@
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
+
diff --git a/src/features/ready.html b/src/features/ready.html
index 7f81b08a3b..1e09df3d6a 100644
--- a/src/features/ready.html
+++ b/src/features/ready.html
@@ -79,6 +79,11 @@
_ready: function() {
this._readied = true;
+ // TODO(jmesserly): this is a hook to allow content.html to be called
+ // before "ready". This needs to be factored better.
+ if (this._useContent) {
+ this.distributeContent();
+ }
this.ready();
},
diff --git a/test/index.html b/test/index.html
index 916e64d65a..01c2b2e5a0 100644
--- a/test/index.html
+++ b/test/index.html
@@ -18,6 +18,7 @@
WCT.loadSuites([
'unit/base.html',
'unit/ready.html',
+ 'unit/content.html'
]);