Test for presence of event before using its target!
This commit is contained in:
parent
66e5da9dec
commit
5a783bbb96
|
@ -161,13 +161,13 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Chosen.prototype.container_mousedown = function(evt) {
|
Chosen.prototype.container_mousedown = function(evt) {
|
||||||
var target;
|
var target_node;
|
||||||
if (!this.is_disabled) {
|
if (!this.is_disabled) {
|
||||||
target = evt.target;
|
target_node = evt != null ? evt.target.nodeName : null;
|
||||||
if (evt && evt.type === "mousedown") {
|
if (evt && evt.type === "mousedown") {
|
||||||
evt.stopPropagation();
|
evt.stopPropagation();
|
||||||
}
|
}
|
||||||
if (!this.pending_destroy_click && target.nodeName !== "ABBR") {
|
if (!this.pending_destroy_click && target_node !== "ABBR") {
|
||||||
if (!this.active_field) {
|
if (!this.active_field) {
|
||||||
if (this.is_multiple) {
|
if (this.is_multiple) {
|
||||||
this.search_field.val("");
|
this.search_field.val("");
|
||||||
|
|
2
chosen/chosen.jquery.min.js
vendored
2
chosen/chosen.jquery.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -152,13 +152,13 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Chosen.prototype.container_mousedown = function(evt) {
|
Chosen.prototype.container_mousedown = function(evt) {
|
||||||
var target;
|
var target_node;
|
||||||
if (!this.is_disabled) {
|
if (!this.is_disabled) {
|
||||||
target = evt.target;
|
target_node = evt != null ? evt.target.nodeName : null;
|
||||||
if (evt && evt.type === "mousedown") {
|
if (evt && evt.type === "mousedown") {
|
||||||
evt.stop();
|
evt.stop();
|
||||||
}
|
}
|
||||||
if (!this.pending_destroy_click && target.nodeName !== "ABBR") {
|
if (!this.pending_destroy_click && target_node !== "ABBR") {
|
||||||
if (!this.active_field) {
|
if (!this.active_field) {
|
||||||
if (this.is_multiple) {
|
if (this.is_multiple) {
|
||||||
this.search_field.clear();
|
this.search_field.clear();
|
||||||
|
|
2
chosen/chosen.proto.min.js
vendored
2
chosen/chosen.proto.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -123,10 +123,10 @@ class Chosen
|
||||||
|
|
||||||
container_mousedown: (evt) ->
|
container_mousedown: (evt) ->
|
||||||
if !@is_disabled
|
if !@is_disabled
|
||||||
target = evt.target
|
target_node = if evt? then evt.target.nodeName else null
|
||||||
if evt and evt.type is "mousedown"
|
if evt and evt.type is "mousedown"
|
||||||
evt.stopPropagation()
|
evt.stopPropagation()
|
||||||
if not @pending_destroy_click and target.nodeName != "ABBR"
|
if not @pending_destroy_click and target_node != "ABBR"
|
||||||
if not @active_field
|
if not @active_field
|
||||||
@search_field.val "" if @is_multiple
|
@search_field.val "" if @is_multiple
|
||||||
$(document).click @click_test_action
|
$(document).click @click_test_action
|
||||||
|
|
|
@ -118,10 +118,10 @@ class Chosen
|
||||||
|
|
||||||
container_mousedown: (evt) ->
|
container_mousedown: (evt) ->
|
||||||
if !@is_disabled
|
if !@is_disabled
|
||||||
target = evt.target
|
target_node = if evt? then evt.target.nodeName else null
|
||||||
if evt and evt.type is "mousedown"
|
if evt and evt.type is "mousedown"
|
||||||
evt.stop()
|
evt.stop()
|
||||||
if not @pending_destroy_click and target.nodeName != "ABBR"
|
if not @pending_destroy_click and target_node != "ABBR"
|
||||||
if not @active_field
|
if not @active_field
|
||||||
@search_field.clear() if @is_multiple
|
@search_field.clear() if @is_multiple
|
||||||
document.observe "click", @click_test_action
|
document.observe "click", @click_test_action
|
||||||
|
|
Loading…
Reference in a new issue