Permalink
Browse files

When Chosen is disabled, don't allow deselect.

Fixes #539
  • Loading branch information...
1 parent 175dd1c commit 0bdcc48ada97badfc4a92ad2a6ea364786082efa @pfiller pfiller committed May 11, 2012
View
@@ -76,6 +76,9 @@
.chzn-container-single .chzn-single abbr:hover {
background-position: right -11px;
}
+.chzn-container-single.chzn-disabled .chzn-single abbr:hover {
+ background-position: right top;
+}
.chzn-container-single .chzn-single div {
position: absolute;
right: 0;
View
@@ -448,7 +448,9 @@ Copyright (c) 2011 by Harvest
};
Chosen.prototype.container_mouseup = function(evt) {
- if (evt.target.nodeName === "ABBR") return this.results_reset(evt);
+ if (evt.target.nodeName === "ABBR" && !this.is_disabled) {
+ return this.results_reset(evt);
+ }
};
Chosen.prototype.blur_test = function(evt) {

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -436,7 +436,9 @@ Copyright (c) 2011 by Harvest
};
Chosen.prototype.container_mouseup = function(evt) {
- if (evt.target.nodeName === "ABBR") return this.results_reset(evt);
+ if (evt.target.nodeName === "ABBR" && !this.is_disabled) {
+ return this.results_reset(evt);
+ }
};
Chosen.prototype.blur_test = function(evt) {

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -123,7 +123,7 @@ class Chosen extends AbstractChosen
@pending_destroy_click = false
container_mouseup: (evt) ->
- this.results_reset(evt) if evt.target.nodeName is "ABBR"
+ this.results_reset(evt) if evt.target.nodeName is "ABBR" and not @is_disabled
blur_test: (evt) ->
this.close_field() if not @active_field and @container.hasClass "chzn-container-active"
@@ -114,7 +114,7 @@ class Chosen extends AbstractChosen
@pending_destroy_click = false
container_mouseup: (evt) ->
- this.results_reset(evt) if evt.target.nodeName is "ABBR"
+ this.results_reset(evt) if evt.target.nodeName is "ABBR" and not @is_disabled
blur_test: (evt) ->
this.close_field() if not @active_field and @container.hasClassName("chzn-container-active")

0 comments on commit 0bdcc48

Please sign in to comment.