From fcc393aca2329f3e2ae58747e21823fd745968b0 Mon Sep 17 00:00:00 2001 From: Tom Hunkapiller Date: Sat, 22 May 2021 05:00:30 +0300 Subject: [PATCH] move break up higher in order, to use the simpler `push` instead of `splice` --- src/file/paragraph/run/run.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/file/paragraph/run/run.ts b/src/file/paragraph/run/run.ts index 461fd9da29..02b97ec47f 100644 --- a/src/file/paragraph/run/run.ts +++ b/src/file/paragraph/run/run.ts @@ -29,6 +29,12 @@ export class Run extends XmlComponent { this.properties = new RunProperties(options); this.root.push(this.properties); + if (options.break) { + for (let i = 0; i < options.break; i++) { + this.root.push(new Break()); + } + } + if (options.children) { for (const child of options.children) { if (typeof child === "string") { @@ -63,11 +69,5 @@ export class Run extends XmlComponent { } else if (options.text) { this.root.push(new Text(options.text)); } - - if (options.break) { - for (let i = 0; i < options.break; i++) { - this.root.splice(1, 0, new Break()); - } - } } }