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 @@
-