From 746298700ed6b17ced8141b05114af76e8ef2c81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bilal=20=C3=87=C4=B1narl=C4=B1?= Date: Fri, 11 Sep 2015 10:47:03 +0300 Subject: [PATCH 1/2] IDs containing `:` like chars escaped --- lib/uxrocket.select.js | 15 +++++++++++---- tests/sample.html | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/uxrocket.select.js b/lib/uxrocket.select.js index 9df955b..5d97bd1 100644 --- a/lib/uxrocket.select.js +++ b/lib/uxrocket.select.js @@ -99,8 +99,8 @@ if($el.is('.readonly')) { columns += ' ' + ns.readonly; } - - if($el.is(':disabled')){ + + if($el.is(':disabled')) { columns += ' ' + ns.disabled } @@ -188,7 +188,7 @@ var selectOption = function($option) { var $list = $option.parents('.' + ns.list), - $el = $("#" + $list.data('select')), + $el = $(escapeSelector("#" + $list.data('select'))), _opts = $el.data(ns.data), $v = $option.data('value'); @@ -231,6 +231,13 @@ return text.replace(/\[/g, '<').replace(/]/g, '>'); }; + var escapeSelector = function(selector) { + var is_ID = selector.charAt(0) === '#', + re = /([ !"#$%&'()*+,.\/:;<=>?@[\\\]^`{|}~])/g; + + return is_ID ? '#' + selector.substring(1).replace(re, '\\$1') : selector; + }; + // global callback var callback = function(fn) { // if callback string is function call it directly @@ -331,7 +338,7 @@ }; // Version - ux.version = "2.7.1"; + ux.version = "2.7.2"; // settings ux.settings = defaults; diff --git a/tests/sample.html b/tests/sample.html index 57c9710..4cb2103 100644 --- a/tests/sample.html +++ b/tests/sample.html @@ -69,7 +69,7 @@

- From f756e1c77f5f7b2565b94458b3d8f25445b761bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bilal=20=C3=87=C4=B1narl=C4=B1?= Date: Fri, 11 Sep 2015 10:47:33 +0300 Subject: [PATCH 2/2] Version bump --- bower.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bower.json b/bower.json index b586e4d..0d7cc38 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "uxrocket.select", - "version": "2.7.1", + "version": "2.7.2", "homepage": "https://github.com/uxrocket/uxrocket.select", "authors": [ "Bilal Çınarlı " diff --git a/package.json b/package.json index 3f99582..4a2827c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "uxrocket.select", - "version": "2.7.1", + "version": "2.7.2", "description": "jQuery based Select box replacement function", "repository": { "type": "git",