selectize-rails 0.7.6 → 0.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -41,6 +41,7 @@ See the [demo page of Brian Reavis](http://brianreavis.github.io/selectize.js/)
41
41
 
42
42
  | Version | Notes |
43
43
  | -------:| ----------------------------------------------------------- |
44
+ | 0.7.7 | Update to v0.7.7 of selectize.js |
44
45
  | 0.7.6 | Update to v0.7.6 of selectize.js |
45
46
  | 0.7.5 | Update to v0.7.5 of selectize.js |
46
47
  | 0.7.4 | Update to v0.7.4 of selectize.js |
@@ -1,5 +1,5 @@
1
1
  module Selectize
2
2
  module Rails
3
- VERSION = "0.7.6"
3
+ VERSION = "0.7.7"
4
4
  end
5
5
  end
@@ -470,7 +470,7 @@
470
470
  }));
471
471
 
472
472
  /**
473
- * selectize.js (v0.7.6)
473
+ * selectize.js (v0.7.7)
474
474
  * Copyright (c) 2013 Brian Reavis & contributors
475
475
  *
476
476
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
@@ -628,17 +628,6 @@
628
628
  .replace(/"/g, '"');
629
629
  };
630
630
 
631
- /**
632
- * Escapes quotation marks with backslashes. Useful
633
- * for escaping values for use in CSS attribute selectors.
634
- *
635
- * @param {string} str
636
- * @return {string}
637
- */
638
- var escape_quotes = function(str) {
639
- return str.replace(/(['"])/g, '\\$1');
640
- };
641
-
642
631
  var hook = {};
643
632
 
644
633
  /**
@@ -1900,7 +1889,7 @@
1900
1889
  */
1901
1890
  addOptionGroup: function(id, data) {
1902
1891
  this.optgroups[id] = data;
1903
- this.trigger('optgroup_add', value, data);
1892
+ this.trigger('optgroup_add', id, data);
1904
1893
  },
1905
1894
 
1906
1895
  /**
@@ -1998,8 +1987,7 @@
1998
1987
  * @returns {object}
1999
1988
  */
2000
1989
  getOption: function(value) {
2001
- value = hash_key(value);
2002
- return value ? this.$dropdown_content.find('[data-selectable]').filter('[data-value="' + escape_quotes(value) + '"]:first') : $();
1990
+ return this.getElementWithValue(value, this.$dropdown_content.find('[data-selectable]'));
2003
1991
  },
2004
1992
 
2005
1993
  /**
@@ -2017,6 +2005,28 @@
2017
2005
  return index >= 0 && index < $options.length ? $options.eq(index) : $();
2018
2006
  },
2019
2007
 
2008
+ /**
2009
+ * Finds the first element with a "data-value" attribute
2010
+ * that matches the given value.
2011
+ *
2012
+ * @param {mixed} value
2013
+ * @param {object} $els
2014
+ * @return {object}
2015
+ */
2016
+ getElementWithValue: function(value, $els) {
2017
+ value = hash_key(value);
2018
+
2019
+ if (value) {
2020
+ for (var i = 0, n = $els.length; i < n; i++) {
2021
+ if ($els[i].getAttribute('data-value') === value) {
2022
+ return $($els[i]);
2023
+ }
2024
+ }
2025
+ }
2026
+
2027
+ return $();
2028
+ },
2029
+
2020
2030
  /**
2021
2031
  * Returns the jQuery element of the item
2022
2032
  * matching the given value.
@@ -2025,7 +2035,7 @@
2025
2035
  * @returns {object}
2026
2036
  */
2027
2037
  getItem: function(value) {
2028
- return this.$control.children('[data-value="' + escape_quotes(hash_key(value)) + '"]');
2038
+ return this.getElementWithValue(value, this.$control.children());
2029
2039
  },
2030
2040
 
2031
2041
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * selectize.bootstrap2.css (v0.7.6) - Bootstrap 2 Theme
2
+ * selectize.bootstrap2.css (v0.7.7) - Bootstrap 2 Theme
3
3
  * Copyright (c) 2013 Brian Reavis & contributors
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
@@ -1,5 +1,5 @@
1
1
  /**
2
- * selectize.bootstrap3.css (v0.7.6) - Bootstrap 3 Theme
2
+ * selectize.bootstrap3.css (v0.7.7) - Bootstrap 3 Theme
3
3
  * Copyright (c) 2013 Brian Reavis & contributors
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
@@ -1,5 +1,5 @@
1
1
  /**
2
- * selectize.css (v0.7.6)
2
+ * selectize.css (v0.7.7)
3
3
  * Copyright (c) 2013 Brian Reavis & contributors
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
@@ -1,5 +1,5 @@
1
1
  /**
2
- * selectize.default.css (v0.7.6) - Default Theme
2
+ * selectize.default.css (v0.7.7) - Default Theme
3
3
  * Copyright (c) 2013 Brian Reavis & contributors
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
@@ -1,5 +1,5 @@
1
1
  /**
2
- * selectize.legacy.css (v0.7.6) - Default Theme
2
+ * selectize.legacy.css (v0.7.7) - Default Theme
3
3
  * Copyright (c) 2013 Brian Reavis & contributors
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selectize-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.6
4
+ version: 0.7.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: