From 09d3e94ada2a6fe660937e81b5a85c1fc4d7f083 Mon Sep 17 00:00:00 2001 From: Leo Unglaub Date: Tue, 16 Dec 2014 18:36:03 +0100 Subject: [PATCH] Fixing issue #2864 If you call element.attr ('style') with Zepto and there is NO inline style, you get back the CSS2Properties object. In jQuery you would get nothing. To avoid calling split in an object instead of a string we should check if we really have a string. Signed-off-by: Leo Unglaub --- select2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/select2.js b/select2.js index faf9f478..f063563f 100644 --- a/select2.js +++ b/select2.js @@ -1943,7 +1943,7 @@ the specific language governing permissions and limitations under the Apache Lic } else if (this.opts.width === "copy" || this.opts.width === "resolve") { // check if there is inline style on the element that contains width style = this.opts.element.attr('style'); - if (style !== undefined) { + if (typeof(style) === "string") { attrs = style.split(';'); for (i = 0, l = attrs.length; i < l; i = i + 1) { attr = attrs[i].replace(/\s/g, '');