assets/js/romo/dropdown.js in romo-0.20.10 vs assets/js/romo/dropdown.js in romo-0.20.11

- old
+ new

@@ -147,15 +147,23 @@ Romo.on(this.elem, 'romoDropdown:triggerPopupClose', Romo.proxy(this._onPopupClose, this)); } RomoDropdown.prototype._bindPopup = function() { this.popupElem = Romo.elems( - '<div class="romo-dropdown-popup"><div class="romo-dropdown-body"></div></div>' + '<div class="romo-dropdown-popup">' + + '<div class="romo-dropdown-body"></div>' + + '</div>' )[0]; - var popupParentElem = Romo.closest( - this.elem, - Romo.data(this.elem, 'romo-dropdown-append-to-closest') || 'body' - ); + + var popupParentElem; + var appendToClosestSel = Romo.data(this.elem, 'romo-dropdown-append-to-closest'); + if (appendToClosestSel !== undefined) { + popupParentElem = Romo.closest(this.elem, appendToClosestSel); + } else { + popupParentElem = Romo.f( + Romo.data(this.elem, 'romo-dropdown-append-to') || 'BODY' + )[0]; + } Romo.append(popupParentElem, this.popupElem); this.bodyElem = Romo.children(this.popupElem, '.romo-dropdown-body')[0]; if (Romo.data(this.elem, 'romo-dropdown-style-class') !== undefined) { Romo.addClass(this.bodyElem, Romo.data(this.elem, 'romo-dropdown-style-class'));