[Pkg-javascript-commits] [jquery-minicolors] 13/46: Fixed bug where partial keywords would fire change
David Prévot
taffit at moszumanska.debian.org
Sun Oct 25 17:18:24 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository jquery-minicolors.
commit ff9a08e0f895d3db85c382d9fd45815ac3ec8def
Author: Cory LaViska <cory at abeautifulsite.net>
Date: Thu Sep 17 14:57:09 2015 -0400
Fixed bug where partial keywords would fire change
---
index.html | 1 -
jquery.minicolors.js | 20 ++++++++++++++------
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/index.html b/index.html
index 17de52f..0976b70 100644
--- a/index.html
+++ b/index.html
@@ -276,7 +276,6 @@
<span class="help-block">
CSS-wide keywords can be assigned by including the <code>data-keywords</code> attribute
or by setting the <code>keywords</code> option to a comma-separated list of valid keywords: <code>transparent, initial, inherit</code>.<br />
- <small>Note: <code>none</code> is accepted, but will be converted to valid <code>transparent</code>.</small>
</span>
</div>
</div>
diff --git a/jquery.minicolors.js b/jquery.minicolors.js
index a8946a6..e7ef423 100644
--- a/jquery.minicolors.js
+++ b/jquery.minicolors.js
@@ -542,10 +542,14 @@
}
hsb = hex2hsb(hex);
+ // Get array of lowercase keywords
+ keywords = !keywords ? [] : $.map(keywords.split(','), function(a) {
+ return $.trim(a.toLowerCase());
+ });
+
// Set color string
- if( keywords && keywords.indexOf(input.val()) >= 0 && input.val() !== '' ) {
- // Returns CSS-wide keyword ('none' will return 'transparent')
- value = input.val() === 'none' ? 'transparent' : input.val();
+ if( input.val() !== '' && $.inArray(input.val().toLowerCase(), keywords) > -1 ) {
+ value = convertCase(input.val());
} else if (format === 'rgb') {
// Returns RGB(A) string
value = isRgb(input.val()) ? parseRgb(input.val()) : '';
@@ -926,10 +930,14 @@
settings = input.data('minicolors-settings');
if( !input.data('minicolors-initialized') ) return;
+ // Get array of lowercase keywords
+ keywords = !keywords ? [] : $.map(keywords.split(','), function(a) {
+ return $.trim(a.toLowerCase());
+ });
+
// Set color string
- if( keywords && keywords.indexOf(input.val()) >= 0 && input.val() !== '' ) {
- // Returns CSS-wide keyword ('none' will return 'transparent')
- value = input.val() === 'none' ? 'transparent' : input.val();
+ if( input.val() !== '' && $.inArray(input.val().toLowerCase(), keywords) > -1 ) {
+ value = convertCase(input.val());
} else if( isRgb(input.val()) ) {
// Returns RGB(A) string
value = parseRgb(input.val());
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/jquery-minicolors.git
More information about the Pkg-javascript-commits
mailing list