Polymer2 fixes (#376)

* Set all attributes together.

* Revert "Set all attributes together."

This reverts commit 00fe75ce4b78c17481bac45db0536169695f1f91.

* Set all attributes together.

* Workaround for justified on Polymer2
This commit is contained in:
Andrey 2017-08-06 00:02:49 +03:00 committed by Paulus Schoutsen
parent ebc0c776e2
commit f57e2334c8
4 changed files with 21 additions and 3 deletions

View File

@ -24,6 +24,10 @@
@apply(--layout-horizontal);
@apply(--layout-justified);
}
dom-if {
display: none;
}
</style>
<paper-card>
<div class='card-content'>

View File

@ -93,6 +93,10 @@
padding: 0 8px;
opacity: var(--dark-secondary-opacity);
}
dom-if {
display: none;
}
</style>
<app-toolbar>

View File

@ -22,6 +22,10 @@
ha-entity-toggle {
margin-left: 16px;
}
dom-if {
display: none;
}
</style>
<div class='horizontal justified layout'>

View File

@ -106,9 +106,15 @@ window.hassUtil.dynamicContentUpdater = function (root, newElementTag, attribute
customEl = document.createElement(newElementTag);
}
Object.keys(attributes).forEach(function (key) {
customEl[key] = attributes[key];
});
if (customEl.setProperties) {
customEl.setProperties(attributes);
} else {
// If custom element definition wasn't loaded yet - setProperties would be
// missing, but no harm in setting attributes one-by-one then.
Object.keys(attributes).forEach((key) => {
customEl[key] = attributes[key];
});
}
if (customEl.parentNode === null) {
rootEl.appendChild(customEl);