HN2new | past | comments | ask | show | jobs | submitlogin
A crash course in how DOM events work (jupiterit.com)
126 points by JeffJenkins on Oct 15, 2010 | hide | past | favorite | 5 comments


While this is intended to be a crash course, I do want to note that event listeners don't quite get called like that. The event bubbling and capturing is quite accurate, but there are some specific differences in how listeners on any given element's event are called when compared to simply looping through and executing them:

The order in which they are called is not determinate. All of them will be called, but you cannot rely on the order in which they are called. Throwing an exception will also not prevent other event listeners from executing.

See: http://ajaxian.com/archives/the-differences-between-callback...


I feel like, now that the magic trick has been explained, my world is slightly less full of wonder and excitement.

Thanks, I think.


The first time I finished reading through the complete source of an operating system, I felt the same way: "Wait, where was the magic? Did I miss it?"


I bet we're going to feel the same way when we figure out how our brain works.


Funny, whenever I first understand something mysterious like that, I feel more hopeful and confident. If it's magic, how can I trust it? What do I do if it doesn't behave as expected?

If I understand it, I can face it. I can figure out problems. I can find creative approaches.

It isn't magic, so I don't have to be afraid.

I think that's a good feeling.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: