I have some JavaScript click handlers which I want in IE8. What I want to do is click on a handler Call and then call another handler on all subsequent clicks. The way I do this puts the original handler in the onclick attribute, and then use that handler to erase the onclick attribute and set the handler to call the subsequent clicks. Event # Use Inspection , but for some reasons IE8 refuses to cooperate
I get unexpected program flows
click-> gt; Elemental Handler- & gt; Exclude Origin- & gt; New Handler- & gt; Set new & gt; Call newhander I did not know why click on a single event to fire both handlers here is the snippet of the attacker code, and on that page which consistently bugs with IE8 on my laptop Re-presents.
// Strange behavior in the latest prototype version ie8 function Original handler (event)) {event. Stop (incident); // This does not help either, this event still runs the new handler var button = $ ('button'); Warning ("first click"); Button.writeAttribute ({onclick: null}); The function should show newHandler (event) {// on the second click //, but it shows the alerts along with the first click ('second click'); } Button.observe ('click', newHandler); } So to get the desired behavior, I really feel weird that an additional layer of indirection should be added. So the following code resolves the problem with IE8, but breaks Firefox and Chrome behavior because now the "second click" does not appear until the third click on Chrome and Firefox on the IE8 version and correctly behaving on IE8 Additional clicks are required.
function fundamental handler (event) {event .stop (event)); Var button = $ ('button'); Warning ("first click"); Button.writeAttribute ({onclick: null}); Var newHandler = function (ev) {button.stopObserving (); Button.observe ('click', function () {warning ("second click");}); } Button.observe ('click', newHandler); } Any ideas about fixing this bug and consistent behavior in all browsers?
I also asked on the prototype mailing list and the answer I got is basically happening IE8 has called the DOM0 handler and then calls the DOM2 handler which I have to set the way delay of Element # and its surroundings so that the DOM2 handler is not set up That first event bubbles will be set up all the way without any DOM2 operators. O How do I hate cross-browser compatibility
Comments
Post a Comment