From 5008ad3a9b32702543fdfd089fbe1a5c593cfe8e Mon Sep 17 00:00:00 2001 From: Liam Date: Mon, 3 Nov 2014 18:20:36 -0500 Subject: [PATCH] Makes dynamic sizing of core-dropdown possible --- core-dropdown.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core-dropdown.html b/core-dropdown.html index fdd9fb7..4e47f61 100644 --- a/core-dropdown.html +++ b/core-dropdown.html @@ -164,18 +164,24 @@ var target = this.target; // remember position, because core-overlay may have set the property var pos = target.style.position; + var width = target.style.width; + var height = target.style.height; // get the size of the target as if it's positioned in the top left // corner of the screen target.style.position = 'fixed'; target.style.left = '0px'; target.style.top = '0px'; + target.style.width = null; + target.style.height = null; var rect = target.getBoundingClientRect(); target.style.position = pos; target.style.left = null; target.style.top = null; + target.style.width = width; + target.style.height = height; return rect; },