Skip to content

Commit

Permalink
Released 0.6.13.
Browse files Browse the repository at this point in the history
  • Loading branch information
brianreavis committed Aug 9, 2013
1 parent 5eff6e1 commit 9208f73
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 79 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "selectize",
"keywords": ["select", "ui", "form", "input", "control", "autocomplete", "tagging", "tag"],
"description": "Selectize is a jQuery-based custom <select> UI control. Useful for tagging, contact lists, country selectors, etc.",
"version": "0.6.12",
"version": "0.6.13",
"license": "Apache License, Version 2.0",
"readmeFilename": "README.md",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion selectize.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! selectize.css - v0.6.12 | https://github.com/brianreavis/selectize.js | Apache License (v2) */
/*! selectize.css - v0.6.13 | https://github.com/brianreavis/selectize.js | Apache License (v2) */

/* --- file: "src/selectize.css" --- */

Expand Down
2 changes: 1 addition & 1 deletion selectize.jquery.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "selectize",
"version": "0.6.12",
"version": "0.6.13",
"title": "Selectize.js",
"author": {
"name": "Brian Reavis",
Expand Down
33 changes: 18 additions & 15 deletions selectize.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! selectize.js - v0.6.12 | https://github.com/brianreavis/selectize.js | Apache License (v2) */
/*! selectize.js - v0.6.13 | https://github.com/brianreavis/selectize.js | Apache License (v2) */

(function(factory) {
if (typeof exports === 'object') {
Expand Down Expand Up @@ -295,6 +295,17 @@
return (str + '').replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1');
};

/**
* Escapes quotation marks with backslashes. Useful
* for escaping values for use in CSS attribute selectors.
*
* @param {string} str
* @return {string}
*/
var escape_quotes = function(str) {
return str.replace(/(['"])/g, '\\$1');
};

var hook = {};

/**
Expand Down Expand Up @@ -782,12 +793,12 @@
});

$(window).on({
resize: function() {
'scroll resize': function() {
if (self.isOpen) {
self.positionDropdown.apply(self, arguments);
}
},
mousemove: function() {
'mousemove': function() {
self.ignoreHover = false;
}
});
Expand Down Expand Up @@ -1707,7 +1718,7 @@
updateOption: function(value, data) {
var self = this;
var $item, $item_new;
var value, value_new, index_item, cache_items, cache_options;
var value_new, index_item, cache_items, cache_options;

value = hash_key(value);
value_new = hash_key(data[self.settings.valueField]);
Expand Down Expand Up @@ -1792,7 +1803,7 @@
*/
getOption: function(value) {
value = hash_key(value);
return value ? this.$dropdown_content.find('[data-selectable]').filter('[data-value="' + value.replace(/(['"])/g, '\\$1') + '"]:first') : $();
return value ? this.$dropdown_content.find('[data-selectable]').filter('[data-value="' + escape_quotes(value) + '"]:first') : $();
},

/**
Expand All @@ -1818,15 +1829,7 @@
* @returns {object}
*/
getItem: function(value) {
var i = this.items.indexOf(value);
if (i !== -1) {
if (i >= this.caretPos) i++;
var $el = $(this.$control[0].childNodes[i]);
if ($el.attr('data-value') === value) {
return $el;
}
}
return $();
return this.$control.children('[data-value="' + escape_quotes(hash_key(value)) + '"]');
},

/**
Expand Down Expand Up @@ -1859,7 +1862,7 @@
// update menu / remove the option
$option = self.getOption(value);
value_next = self.getAdjacentOption($option, 1).attr('data-value');
self.refreshOptions(inputMode !== 'single');
self.refreshOptions(self.isFocused && inputMode !== 'single');
if (value_next) {
self.setActiveOption(self.getOption(value_next));
}
Expand Down
Loading

0 comments on commit 9208f73

Please sign in to comment.