mirror of
https://github.com/google/blockly.git
synced 2026-01-08 17:40:09 +01:00
chore: Reduce delta on ports to blockly-samples (#6886)
* Reduce usage of obsolete .keyCode property.
* Rename private properties/methods which violate eslint rules.
* Use arrays of bound events rather than individual properties.
* Improve typing info.
* Also fix O(n^2) recursive performance issue in theme's getComponentStyle function.
* And replace String(...) with '${...}' (smaller, faster).
* .toString() is considered harmful.
This commit is contained in:
10
core/xml.ts
10
core/xml.ts
@@ -106,8 +106,8 @@ export function blockToDomWithXY(block: Block, opt_noId?: boolean): Element|
|
||||
if (isElement(element)) {
|
||||
const xy = block.getRelativeToSurfaceXY();
|
||||
element.setAttribute(
|
||||
'x', `${Math.round(block.workspace.RTL ? width - xy.x : xy.x)}`);
|
||||
element.setAttribute('y', `${Math.round(xy.y)}`);
|
||||
'x', String(Math.round(block.workspace.RTL ? width - xy.x : xy.x)));
|
||||
element.setAttribute('y', String(Math.round(xy.y)));
|
||||
}
|
||||
return element;
|
||||
}
|
||||
@@ -191,8 +191,8 @@ export function blockToDom(block: Block, opt_noId?: boolean): Element|
|
||||
const commentElement = utilsXml.createElement('comment');
|
||||
commentElement.appendChild(utilsXml.createTextNode(commentText));
|
||||
commentElement.setAttribute('pinned', `${pinned}`);
|
||||
commentElement.setAttribute('h', `${size.height}`);
|
||||
commentElement.setAttribute('w', `${size.width}`);
|
||||
commentElement.setAttribute('h', String(size.height));
|
||||
commentElement.setAttribute('w', String(size.width));
|
||||
|
||||
element.appendChild(commentElement);
|
||||
}
|
||||
@@ -235,7 +235,7 @@ export function blockToDom(block: Block, opt_noId?: boolean): Element|
|
||||
}
|
||||
if (block.inputsInline !== undefined &&
|
||||
block.inputsInline !== block.inputsInlineDefault) {
|
||||
element.setAttribute('inline', block.inputsInline.toString());
|
||||
element.setAttribute('inline', String(block.inputsInline));
|
||||
}
|
||||
if (block.isCollapsed()) {
|
||||
element.setAttribute('collapsed', 'true');
|
||||
|
||||
Reference in New Issue
Block a user