Re: Event binding/this problem
Scott Sauyet <[email protected]>
| Newsgroups | gmane.comp.web.dom.wdf |
|---|---|
| Message-ID | <[email protected]> |
Seb Frost wrote:
> cheers Scott, I have the following functions I use normally, I just stripped
> them out for the example in the email:
>
> they work in firefox for me.
> [ ... ] function addClass(e,c)
> [ ... ] function delClass(e,c)
> [ ... ] function hasClass(e,c)
I figured you'd probably tested and had it working in FF, but you never
know...
I really just wanted to make my most recent contribution to this list
something useful rather than some global variable nonsense. :-)
I do something similar to this although I attach the functions to the
HTMLElement prototype. One possible simplification that has always
worked for me would be:
function delClass(e,c) {
if (e.className!=undefined)
e.className = e.className.replace(new RegExp('\\b' + c +
'\\b'), '');
Cheers,
-- Scott
------------------------ Yahoo! Groups Sponsor --------------------~-->
Get fast access to your favorite Yahoo! Groups. Make Yahoo! your home page
http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/9rHolB/TM
--------------------------------------------------------------------~->
Unsubscribe
[email protected]
List info
http://www.quirksmode.org/dom/list.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/wdf-dom/
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/