Skip to content

Commit

Permalink
verify click is in our dropdown instance
Browse files Browse the repository at this point in the history
  • Loading branch information
redmunds committed Dec 5, 2013
1 parent 8fcdb96 commit 149026b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/editor/CSSInlineEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,11 @@ define(function (require, exports, module) {
* @private
* Handle click
*/
function _onClick(event) {
function _onClickOutside(event) {
var $container = $(event.target).closest(".stylesheet-dropdown");

// If click is outside dropdown list, then close dropdown list
if ($container.length === 0) {
if ($container.length === 0 || $container[0] !== $dropdown[0]) {
_closeDropdown();
}
}
Expand All @@ -215,7 +215,7 @@ define(function (require, exports, module) {
* PopUpManager when the dropdown is closed.
*/
function _cleanupDropdown() {
window.document.body.removeEventListener("click", _onClick, true);
window.document.body.removeEventListener("click", _onClickOutside, true);
$(hostEditor).off("scroll", _closeDropdown);
$(PanelManager).off("editorAreaResize", _closeDropdown);
dropdownEventHandler = null;
Expand Down Expand Up @@ -274,7 +274,7 @@ define(function (require, exports, module) {

$dropdown.focus();

window.document.body.addEventListener("click", _onClick, true);
window.document.body.addEventListener("click", _onClickOutside, true);
$(hostEditor).on("scroll", _closeDropdown);
$(PanelManager).on("editorAreaResize", _closeDropdown);
}
Expand Down

0 comments on commit 149026b

Please sign in to comment.