Since we started talking about events, I felt like I needed to reacclimate myself with whether there is a point to some of these functions with Event in their name. Currently the first occurring runtime error in one of the sites we're testing on, xqsuperschool.org, involves dispatchEvent. But what does it do? I looked it up and found out. The flavor of why dispatchEvent is used is a little like calling raise() in code. It's like you're simulating something. So the role for dispatchEvent would be if you want to call an event handler from elsewhere in the code. If there is a button1 with a handler on click, the users might click the button and the handler code would run. But if you want to trigger that code and you want to do it "the right way", you do it via interacting with that element. So you call dispatchEvent(button,"click") and you have done just what your user would have. An MDN page says "Such events are commonly called synthetic events, as opposed to the events fired by the browser itself."

It reminds me of OO. You're reaching the handler code by addressing it through a published way of reaching it. It reminds me of public and private members, and that type of flavor.

I suppose it would come up in the context of testing. Also in the edbrowse code itself we have had situations where, I don't know, you're writing one DOM method, and you call another DOM method from within that, because it's already been tested and is as good a solution as revisiting the lower level stuff.

So based on this information, I think dispatchEvent is good solid functionality and once I get it together, I'll send some code.

Kevin

_______________________________________________
Edbrowse-dev mailing list
[email protected]
http://lists.the-brannons.com/mailman/listinfo/edbrowse-dev

Reply via email to