From d0f919c4141111a725608296d18900ade632d52f Mon Sep 17 00:00:00 2001 From: pyoor Date: Thu, 13 Sep 2018 10:39:59 -0400 Subject: [PATCH] Remove getRandomElement --- lib/utils/script.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/utils/script.js b/lib/utils/script.js index 3b5cd0e..840da66 100644 --- a/lib/utils/script.js +++ b/lib/utils/script.js @@ -7,12 +7,13 @@ const make = require('../make') const utils = require('../utils') class script extends utils { + /** + * Helper method for appending an element to body or documentElement + * @param {string} name - Element identifier + * @returns {string} + */ static addElementToBody (name) { - return `(document.body || document.documentElement).appendChild${script.methodHead([name])}` - } - - static getRandomElement () { - return `document.getElementsByTagName('*')[${random.number(document.getElementsByTagName('*').length)}]` + return `(document.body || document.documentElement).appendChild(${name})` } static makeArray (type, arrayLength, cb) {