When switching from local content for layer- to add a src attribute for a layer- we need to remove all the local content properly so that content is not used for the remote layer. Handle the opposite also.
Sample code for layer.js attribute changed callback:
case 'src':
if (oldValue !== newValue && this._layer) {
this._onRemove();
if (this.children) {
let elements = this.children;
for (let i = 0; i < elements.length; i++) {
elements[i].remove();
}
}
if (this.isConnected) {
this._onAdd();
}
// the original inline content will not be removed
// but has NO EFFECT and works as a fallback
}
When switching from local content for layer- to add a src attribute for a layer- we need to remove all the local content properly so that content is not used for the remote layer. Handle the opposite also.
Sample code for layer.js attribute changed callback: