Skip to content

Commit

Permalink
Clean up logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpschaaf committed Jul 24, 2015
1 parent 2611285 commit d4deb5d
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/lib/template/templatizer.html
Original file line number Diff line number Diff line change
Expand Up @@ -144,19 +144,22 @@
var c = this._children;
for (var i=0; i<c.length; i++) {
var n = c[i];
if (n.nodeType === Node.TEXT_NODE) {
if (hide && !n.__hideTemplateChildren__) {
n.__polymerTextContent__ = n.textContent;
n.textContent = '';
} else if (!hide && n.__polymerTextContent__ !== undefined) {
n.textContent = n.__polymerTextContent__;
}
} else if (n.style) {
if (hide && !n.__hideTemplateChildren__) {
n.__polymerDisplay__ = n.style.display;
n.style.display = 'none';
} else if (!hide && n.__polymerDisplay__ !== undefined) {
n.style.display = n.__polymerDisplay__;
// Ignore non-changes
if (Boolean(hide) != Boolean(n.__hideTemplateChildren__)) {
if (n.nodeType === Node.TEXT_NODE) {
if (hide) {
n.__polymerTextContent__ = n.textContent;
n.textContent = '';
} else {
n.textContent = n.__polymerTextContent__;
}
} else if (n.style) {
if (hide) {
n.__polymerDisplay__ = n.style.display;
n.style.display = 'none';
} else {
n.style.display = n.__polymerDisplay__;
}
}
}
n.__hideTemplateChildren__ = hide;
Expand Down

0 comments on commit d4deb5d

Please sign in to comment.