Created
September 14, 2010 21:50
-
-
Save getify/579849 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
$("#foo").click(function(e){ | |
if (e.clientX) { | |
// native mouse click | |
} | |
else { | |
// triggered mouse click | |
} | |
}); |
@getify Indeed - as a general coding pattern, it's really bad practice. However, the solution is not to remove the support à la
i would consider that kind of code (and the ability to do it in JavaScript and jQuery, etc) wrong and evil
We shouldn't remove democracy just because it lets us do evil, right? ;)
@krawaller -- i mean, i understand your point. not necessarily saying it should be removed, but it should be avoided under almost all cases, just like what crockford says about the "good parts" and "bad parts" -- i definitely consider that a "bad part".
btw, there are some things that are so evil they should be removed... like "document.write"... my new banner: "document.write() must die". :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@jdalton - triggering events is definitely not evil. in my opinion, triggering a native event is bad. triggering a native event and pretending to be that native event with bogus information like fake mousex/mousey values is evil.