From d1f51910ee961857e2edae8269ba44032a4913fb Mon Sep 17 00:00:00 2001 From: Igor Vaynberg Date: Wed, 9 Oct 2013 08:30:17 -0700 Subject: [PATCH] small cleanup in width regex matching. #1557 --- select2.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/select2.js b/select2.js index 329b4447..3f05a931 100644 --- a/select2.js +++ b/select2.js @@ -1771,8 +1771,7 @@ the specific language governing permissions and limitations under the Apache Lic attrs = style.split(';'); for (i = 0, l = attrs.length; i < l; i = i + 1) { attr = attrs[i].replace(/\s/g, ''); - attr = " " + attr; // need the style to start with a space because we match [^-]width which would not match width in the beginning - matches = attr.match(/[^-]width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i); + matches = attr.match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i); if (matches !== null && matches.length >= 1) return matches[1]; }