Created
May 10, 2012 18:11
-
-
Save kriswill/2654826 to your computer and use it in GitHub Desktop.
Chosen IE7 Prototype.js git-diff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/chosen/chosen.proto.js b/chosen/chosen.proto.js | |
| index e5049b0..0200299 100644 | |
| --- a/chosen/chosen.proto.js | |
| +++ b/chosen/chosen.proto.js | |
| @@ -408,14 +408,15 @@ Copyright (c) 2011 by Harvest | |
| Chosen.prototype.container_mousedown = function(evt) { | |
| var target_closelink; | |
| if (!this.is_disabled) { | |
| - target_closelink = evt != null ? evt.target.hasClassName("search-choice-close") : false; | |
| + var target = evt != null && evt.target ? $(evt.target) : null | |
| + target_closelink = target ? target.hasClassName("search-choice-close") : false; | |
| if (evt && evt.type === "mousedown" && !this.results_showing) evt.stop(); | |
| if (!this.pending_destroy_click && !target_closelink) { | |
| if (!this.active_field) { | |
| if (this.is_multiple) this.search_field.clear(); | |
| document.observe("click", this.click_test_action); | |
| this.results_show(); | |
| - } else if (!this.is_multiple && evt && (evt.target === this.selected_item || evt.target.up("a.chzn-single"))) { | |
| + } else if (!this.is_multiple && evt && (evt.target === this.selected_item || target.up("a.chzn-single"))) { | |
| this.results_toggle(); | |
| } | |
| return this.activate_field(); | |
| @@ -462,7 +463,8 @@ Copyright (c) 2011 by Harvest | |
| }; | |
| Chosen.prototype.test_active_click = function(evt) { | |
| - if (evt.target.up('#' + this.container_id)) { | |
| + var target = evt.target ? $(evt.target) : null; | |
| + if (target && target.up('#' + this.container_id)) { | |
| return this.active_field = true; | |
| } else { | |
| return this.close_field(); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
IE7 doesn't allow prototype.js to modify the built-in types so this breaks in chosen.js.
We should make a pull request in coffeescript for this.