![]() |
|
#1
|
|||
|
|||
|
When you use attachEvent, the fpNotify is executed in global scope.
[code:kl73t3exye] function handleClick() { alert(this == document.body); alert(event.srcElement == document.body); } document.body.attachEvent("onclick", handleClick);[/code:kl73t3exye] Since IE is really lame, they left out currentTarget (a fly on the pile of shit that is IE's event model). I can check the srcElement to see what I clicked on, but sometimes we design things with a certain level of abstraction where we don't know the element that the handler was assigned to. The srcElement might be deeply nested in the currentTarget (which doesn't exist in IE). The currentTarget has no uniquely identifying information (other than the fact that it is the one that the event-hook notified, of course). Theres probably a few stupid hacky ways I could "make it work". But they all require code redesign and the code at this point is not wanting that at all. Simple workaround? http://dhtmlkitchen.com/ - The best DHTML website! |
|
#2
|
|||
|
|||
|
Use a closure to keep the reference to the node. You'll run into memory leakage problems then, though.
- [url="http://neo.dzygn.com/"]Mark[/url:m6qooemcac] |
|
#3
|
|||
|
|||
|
That's really funny, Mark. The way to solve the problem, and it introduces a mem leak. I know exactly what you mean, too.
[code:bupun2266i]el.attachEvent("onclick", function() { alert(el.tagName); });[/code:bupun2266i] js function -> el -> js function, or something like that. == Well, I'm working on a listener class that can handle that. It is about 50 lines of code. I hate doing this. I hate writing workarounds that should not be necessary. The good news is that the listener class I'm working on works for custom objects, too. It should be pretty efficient, theoretically. It works well, but I have to test for memory leaks in IE and right now, I don't have IE. I may need to use a cleanup onunload. Hopefully not. God, I hate IE. http://dhtmlkitchen.com/ - The best DHTML website! |
|
#4
|
|||
|
|||
|
God I hate shitfox
-- Regards, Tim Scarfe <dc@developer-x.com> http://www.developer-x.com http://www.dotnetsolutions.ltd.uk |
|
#5
|
|||
|
|||
|
There's a guy here at work just like that. He loves IE. I asked him: "So what about IE do you like?"
He said: "99% of all users use IE!" (this is not true) and then "Well, I don't see why we need more than one browser, and most people have IE." and then "I don't know why anyone needs to do something weird. I just want to do normal things in browsers." So I said: "Yeah, I like to do normal things, too. I like to use "width" and "height" and "display", but IE doesn't support any of these things." He just got a virus from IE and last I saw, he was still in safe mode. http://dhtmlkitchen.com/ - The best DHTML website! |
|
#6
|
|||
|
|||
|
And you are comparing this clueless guy to me?
-- Regards, Tim Scarfe <dc@developer-x.com> http://www.developer-x.com http://www.dotnetsolutions.ltd.uk |
|
#7
|
|||
|
|||
|
Hmm, you have other arguments then, Tim? ;-)
- [url="http://neo.dzygn.com/"]Mark[/url:s0qw3iuxpp] |
|
#8
|
|||
|
|||
|
It's the principle of the thing
-- Regards, Tim Scarfe <dc@developer-x.com> http://www.developer-x.com http://www.dotnetsolutions.ltd.uk |
|
#9
|
|||
|
|||
|
<blockquote id="quote"><span class="smalltext" id="quote">quote:<hr id="quote">Originally posted by Tim Scarfe
And you are comparing this clueless guy to me? -- Regards, Tim Scarfe <dc@developer-x.com> http://www.developer-x.com http://www.dotnetsolutions.ltd.uk <hr id="quote"></blockquote id="quote"></span id="quote"> No, not trying to compare; just some random coincidental though association. I was tired that day and it just popped into my head; kinda click. Well I'm tired almost every day because I work my ass of at work and I exercise 13x/wk (on avg). But now that I think of it, I don't think he has the ability to be as obnoxious as you ![]() http://dhtmlkitchen.com/ - The best DHTML website! |
|
#10
|
|||
|
|||
|
Great, glad we cleared that that one up!
-- Regards, Tim Scarfe <dc@developer-x.com> http://www.developer-x.com http://www.dotnetsolutions.ltd.uk |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|