Commit d29cc1aa authored by Wolfgang Test's avatar Wolfgang Test

pb-load: extract _clearContent method

parent 3b62d22a
......@@ -209,14 +209,7 @@
});
} else {
this.style.display = '';
const oldContent = this.querySelectorAll('._contentSlot');
if (oldContent.length > 0) {
// clear content inserted previously
oldContent.forEach((node) => node.parentNode.removeChild(node));
} else if (this.$.contentSlot) {
// clear fallback content from slot
this.$.contentSlot.assignedNodes().forEach((node) => node.parentNode.removeChild(node));
}
this._clearContent();
const div = document.createElement('div');
div.innerHTML = resp;
......@@ -229,6 +222,17 @@
this.emitTo('pb-end-update');
}
_clearContent() {
const oldContent = this.querySelectorAll('._contentSlot');
if (oldContent.length > 0) {
// clear content inserted previously
oldContent.forEach((node) => node.parentNode.removeChild(node));
} else if (this.$.contentSlot) {
// clear fallback content from slot
this.$.contentSlot.assignedNodes().forEach((node) => node.parentNode.removeChild(node));
}
}
_handleError(ev) {
this.emitTo('pb-end-update');
const msg = this.$.loadContent.lastError.response;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment