[Libreoffice-commits] online.git: loleaflet/src
Henry Castro (via logerrit)
logerrit at kemper.freedesktop.org
Mon Aug 17 15:50:49 UTC 2020
loleaflet/src/control/Control.Menubar.js | 4 +---
loleaflet/src/control/Ruler.js | 8 ++------
loleaflet/src/dom/DomUtil.js | 6 ++++++
3 files changed, 9 insertions(+), 9 deletions(-)
New commits:
commit 1ff9b38198aa503b07023c09902ebea9c328aebd
Author: Henry Castro <hcastro at collabora.com>
AuthorDate: Mon Aug 17 10:46:00 2020 -0400
Commit: Henry Castro <hcastro at collabora.com>
CommitDate: Mon Aug 17 17:50:29 2020 +0200
loleaflet: simplify remove child nodes
Change-Id: Ie14b9b933aad74d31acd6add5c07f1e5d9b94b91
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100866
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Henry Castro <hcastro at collabora.com>
diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js
index 531aa3f28..c6b20a6ff 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -849,9 +849,7 @@ L.Control.Menubar = L.Control.extend({
_onRefresh: function() {
// clear initial menu
- while (this._menubarCont.hasChildNodes()) {
- this._menubarCont.removeChild(this._menubarCont.firstChild);
- }
+ L.DomUtil.removeChildNodes(this._menubarCont);
// Add document specific menu
var docType = this._map.getDocType();
diff --git a/loleaflet/src/control/Ruler.js b/loleaflet/src/control/Ruler.js
index bcca9e186..f9b4a913e 100644
--- a/loleaflet/src/control/Ruler.js
+++ b/loleaflet/src/control/Ruler.js
@@ -294,9 +294,7 @@ L.Control.Ruler = L.Control.extend({
var numCounter = -1 * parseInt(lMargin / 1000);
- while (this._rBPContainer.hasChildNodes()) {
- this._rBPContainer.removeChild(this._rBPContainer.lastChild);
- }
+ L.DomUtil.removeChildNodes(this._rBPContainer);
// this.options.pageWidth is in mm100, so the code here makes one ruler division per
// centimetre.
@@ -319,9 +317,7 @@ L.Control.Ruler = L.Control.extend({
// The tabstops. Only draw user-created ones, with style RULER_TAB_LEFT,
// RULER_TAB_RIGHT, RULER_TAB_CENTER, and RULER_TAB_DECIMAL. See <svtools/ruler.hxx>.
- while (this._rTSContainer.hasChildNodes()) {
- this._rTSContainer.removeChild(this._rTSContainer.lastChild);
- }
+ L.DomUtil.removeChildNodes(this._rTSContainer);
var pxPerMm100 = this._map._docLayer._docPixelSize.x / (this._map._docLayer._docWidthTwips * 2540/1440);
this._rTSContainer.tabStops = [];
diff --git a/loleaflet/src/dom/DomUtil.js b/loleaflet/src/dom/DomUtil.js
index 39b87eea6..495421600 100644
--- a/loleaflet/src/dom/DomUtil.js
+++ b/loleaflet/src/dom/DomUtil.js
@@ -110,6 +110,12 @@ L.DomUtil = {
}
},
+ removeChildNodes: function (el) {
+ while (el.hasChildNodes()) {
+ el.removeChild(el.lastChild);
+ }
+ },
+
setClass: function (el, name) {
if (el.className.baseVal === undefined) {
el.className = name;
More information about the Libreoffice-commits
mailing list