mirror of
https://github.com/google/blockly.git
synced 2026-01-08 17:40:09 +01:00
fix: Assign to containerDiv blockyWidgetDiv if it already exists (#7980)
* fix: assign to containerDiv if it already exists * Delete unused return * Fix if statement * format file using Prettier * Deduplicate lines and improve efficiency
This commit is contained in:
@@ -57,14 +57,16 @@ export function testOnly_setDiv(newDiv: HTMLDivElement | null) {
|
||||
* Create the widget div and inject it onto the page.
|
||||
*/
|
||||
export function createDom() {
|
||||
const container = common.getParentContainer() || document.body;
|
||||
|
||||
if (document.querySelector('.' + containerClassName)) {
|
||||
return; // Already created.
|
||||
containerDiv = document.querySelector('.' + containerClassName);
|
||||
} else {
|
||||
containerDiv = document.createElement('div') as HTMLDivElement;
|
||||
containerDiv.className = containerClassName;
|
||||
}
|
||||
|
||||
containerDiv = document.createElement('div') as HTMLDivElement;
|
||||
containerDiv.className = containerClassName;
|
||||
const container = common.getParentContainer() || document.body;
|
||||
container.appendChild(containerDiv);
|
||||
container.appendChild(containerDiv!);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user