From 2b00dec0811ee91c89c58526f896deb9e7389ee5 Mon Sep 17 00:00:00 2001 From: Leandro Silva Date: Mon, 11 Dec 2017 13:35:14 -0500 Subject: [PATCH] Clean up '_setDropdown' method --- src/Dropdownizer.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Dropdownizer.js b/src/Dropdownizer.js index e5ea2c2..1f6d46e 100644 --- a/src/Dropdownizer.js +++ b/src/Dropdownizer.js @@ -294,14 +294,15 @@ class Dropdownize { } _setDropdown() { - let pad = 0; + let computedStyles = window.getComputedStyle(this._el), + divWidth = this._el.offsetWidth; - if (this._touchable && window.getComputedStyle(this._el)["min-width"] === "0px") { - pad = 9; + if (this._touchable && computedStyles.minWidth === "0px") { + divWidth += 9; } this._ui.div.dropdownizer = this; - this._ui.div.style.width = this._el.offsetWidth + pad + "px"; + this._ui.div.style.width = divWidth + "px"; this._ui.div.classList = this._el.classList; this._ui.div.classList.add("dropdownizer");