Created
December 5, 2013 22:20
-
-
Save crissmancd/7815049 to your computer and use it in GitHub Desktop.
This file contains 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
#= Trying to put the last condition into its own function | |
#= Leaving the "not" in the last condition in the list WORKS: | |
parentIsText = -> | |
$(target.parentNode).hasClass("cke_dialog_ui_input_text") | |
true if elementIsNotTarget and elementHasNoTarget and parentIsNotSelect and not parentIsText | |
#= Putting the "not" inside the last condition function DOES NOT WORK | |
parentIsNotText = -> | |
not $(target.parentNode).hasClass("cke_dialog_ui_input_text") | |
true if elementIsNotTarget and elementHasNoTarget and parentIsNotSelect and parentIsText | |
#= Why does moving the "not" to inside the function break it? |
Also, there is another almost identical function that does work:
parentIsNotSelect = ->
not $(target.parentNode).hasClass("cke_dialog_ui_input_select")
parentIsNotText = ->
not $(target.parentNode).hasClass("cke_dialog_ui_input_text")
true if elementIsNotTarget and elementHasNoTarget and parentIsNotSelect and parentIsNotText
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I guess in the not working version I forgot to change the function name to parentIsNotText, but only in the gist