From 46a1d6a6febd4944cf7d36466f7ef70d9eb1bc8f Mon Sep 17 00:00:00 2001 From: Just van Rossum Date: Sun, 17 Sep 2023 07:52:11 +0200 Subject: [PATCH] simplify icon construction: remov redundant div --- .../editor/panel-designspace-navigation.js | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/fontra/views/editor/panel-designspace-navigation.js b/src/fontra/views/editor/panel-designspace-navigation.js index 5058922be..9447c762c 100644 --- a/src/fontra/views/editor/panel-designspace-navigation.js +++ b/src/fontra/views/editor/panel-designspace-navigation.js @@ -889,25 +889,21 @@ function suggestedSourceNameFromLocation(location) { function makeIconCellFactory(iconPaths, triggerOnDoubleClick = false) { return (item, colDesc) => { const value = item[colDesc.key]; + const clickSymbol = triggerOnDoubleClick ? "ondblclick" : "onclick"; const iconElement = html.createDomElement("inline-svg", { src: iconPaths[boolInt(value)], - }); - const clickSymbol = triggerOnDoubleClick ? "ondblclick" : "onclick"; - return html.div( - { - style: "width: 1.2em; height: 1.2em;", - ondblclick: (event) => { - event.stopImmediatePropagation(); - }, - [clickSymbol]: (event) => { - const newValue = !item[colDesc.key]; - item[colDesc.key] = newValue; - iconElement.src = iconPaths[boolInt(newValue)]; - event.stopImmediatePropagation(); - }, + style: "width: 1.2em; height: 1.2em;", + ondblclick: (event) => { + event.stopImmediatePropagation(); }, - [iconElement] - ); + [clickSymbol]: (event) => { + const newValue = !item[colDesc.key]; + item[colDesc.key] = newValue; + iconElement.src = iconPaths[boolInt(newValue)]; + event.stopImmediatePropagation(); + }, + }); + return iconElement; }; }