[refactor] Moved 'appendLineBreaks' to its own TS file

This commit is contained in:
Steven Evans 2018-07-05 16:39:55 -04:00
parent 015524f049
commit 1f7ed8f791
3 changed files with 13 additions and 9 deletions

@ -13,12 +13,12 @@ import {createProgressBarText} from "../utils/helpers/creat
import {dialogBoxCreate} from "../utils/DialogBox";
import {clearObject,
removeChildrenFromElement,
appendLineBreaks,
removeElement} from "../utils/HelperFunctions";
import {Reviver, Generic_toJSON,
Generic_fromJSON} from "../utils/JSONReviver";
import numeral from "numeral/min/numeral.min";
import {addOffset} from "../utils/helpers/addOffset";
import {appendLineBreaks} from "../utils/uiHelpers/appendLineBreaks";
import {createElement} from "../utils/uiHelpers/createElement";
import {createPopup} from "../utils/uiHelpers/createPopup";
import {exceptionAlert} from "../utils/helpers/exceptionAlert";

@ -84,13 +84,6 @@ function createAccordionElement(params) {
return [li, hdr, panel];
}
//Appends n line breaks (as children) to the Element el
function appendLineBreaks(el, n) {
for (var i = 0; i < n; ++i) {
el.appendChild(createElement("br"));
}
}
function clearSelector(selector) {
for (var i = selector.options.length - 1; i >= 0; --i) {
selector.remove(i);
@ -117,6 +110,5 @@ export {sizeOfObject,
clearEventListenersEl,
removeElement,
createAccordionElement,
appendLineBreaks,
removeChildrenFromElement,
clearSelector};

@ -0,0 +1,12 @@
import { createElement } from "./createElement";
/**
* Appends the specified number of breaks (as children) to the specified element
* @param el The element to add child break elements to.
* @param n The number of breaks to add.
*/
export function appendLineBreaks(el: HTMLElement, n: number) {
for (let i: number = 0; i < n; ++i) {
el.appendChild(createElement("br"));
}
}