Add early return when determining content to load.
This commit is contained in:
parent
7d083242c2
commit
d038f7c1a1
1 changed files with 9 additions and 2 deletions
|
@ -21,7 +21,11 @@ class CodeBlock extends HTMLElement{
|
||||||
}
|
}
|
||||||
|
|
||||||
determineAndLoadContent(){
|
determineAndLoadContent(){
|
||||||
CodeBlock.getSource(this.src)
|
const src = this.src;
|
||||||
|
if(!src){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
CodeBlock.getSource(src)
|
||||||
.then(
|
.then(
|
||||||
(data) => this.consumeData(data,CodeBlock.InsertMode.Replace),
|
(data) => this.consumeData(data,CodeBlock.InsertMode.Replace),
|
||||||
(e) => this.consumeData({content:this.textContent},CodeBlock.InsertMode.Replace)
|
(e) => this.consumeData({content:this.textContent},CodeBlock.InsertMode.Replace)
|
||||||
|
@ -313,7 +317,10 @@ class CodeBlock extends HTMLElement{
|
||||||
}
|
}
|
||||||
|
|
||||||
get codeBox(){
|
get codeBox(){
|
||||||
return this.shadowRoot.querySelector("tbody");
|
if(!this._codeBox){
|
||||||
|
this._codeBox = this.shadowRoot.querySelector("tbody");
|
||||||
|
}
|
||||||
|
return this._codeBox;
|
||||||
}
|
}
|
||||||
get value(){
|
get value(){
|
||||||
return this.codeBox.textContent
|
return this.codeBox.textContent
|
||||||
|
|
Loading…
Reference in a new issue