Bug 20865 - Kill JSSVGLazyEventListener and cleanup event handling
Summary: Kill JSSVGLazyEventListener and cleanup event handling
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Nikolas Zimmermann
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-15 16:22 PDT by Nikolas Zimmermann
Modified: 2008-09-15 17:38 PDT (History)
3 users (show)

See Also:


Attachments
Initial patch (94.38 KB, patch)
2008-09-15 16:22 PDT, Nikolas Zimmermann
eric: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nikolas Zimmermann 2008-09-15 16:22:16 PDT
Kill JSSVGLazyEventListener, merge with JSLazyEventListener.

Cleanup all event handling related functions, rename & generalize the functions (dispatchHTMLEvent, setHTMLWindowEventListener etc..)
Comment 1 Nikolas Zimmermann 2008-09-15 16:22:59 PDT
Created attachment 23450 [details]
Initial patch
Comment 2 Eric Seidel (no email) 2008-09-15 16:46:44 PDT
Comment on attachment 23450 [details]
Initial patch

I'm not really sure ForType and ForTypeAndAtrribute are really worth the extra characters.  I think they're probably just as clear w/o the extra typing.

I think it's strange that a bool flips between "attached to a node" and "attached to the window".  That could also be a 2-value enum (and might be clearer that way).

Seems fine.  Certainly better than what we have today.  We'll probably go through another round of cleanup yet.
Comment 3 Nikolas Zimmermann 2008-09-15 16:52:41 PDT
(In reply to comment #2)
> (From update of attachment 23450 [details] [edit])
> I'm not really sure ForType and ForTypeAndAtrribute are really worth the extra
> characters.  I think they're probably just as clear w/o the extra typing.
I agree the name is weak, we should eventually find a nicer one, before landing. Though some extra characters should be preserved to differentiate between the DOM dispatchEvent/addEV/removeEV methods and our version.
> 
> I think it's strange that a bool flips between "attached to a node" and
> "attached to the window".  That could also be a 2-value enum (and might be
> clearer that way).
Yeah, I should talk to Sam, about that.

> Seems fine.  Certainly better than what we have today.  We'll probably go
> through another round of cleanup yet.
Definately. Thanks for r+ :-)
Comment 4 Nikolas Zimmermann 2008-09-15 17:03:16 PDT
Landed in r36466.
Comment 5 Darin Adler 2008-09-15 17:04:00 PDT
(In reply to comment #3)
> (In reply to comment #2)
> > I'm not really sure ForType and ForTypeAndAtrribute are really worth the extra
> > characters.  I think they're probably just as clear w/o the extra typing.
>
> I agree the name is weak, we should eventually find a nicer one, before
> landing. Though some extra characters should be preserved to differentiate
> between the DOM dispatchEvent/addEV/removeEV methods and our version.

Don't the extra arguments differentiate the function enough? Do we really need the different name? When function names get that long it starts to really hurt readability.

> > I think it's strange that a bool flips between "attached to a node" and
> > "attached to the window". That could also be a 2-value enum (and might be
> > clearer that way).
>
> Yeah, I should talk to Sam, about that.

I think an enum would be better than a bool. But how about two separate functions?
Comment 6 Nikolas Zimmermann 2008-09-15 17:38:22 PDT
> Don't the extra arguments differentiate the function enough? Do we really need
> the different name? When function names get that long it starts to really hurt
> readability.

The arguments are indeed sufficient to differentiate, I could prepare a new patch, if you like.
Proposal:
setEventListenerForType -> setEventListener
setEventListenerForTypeAndAttribute -> setEventListenerByAttribute
removeEventListenerForType -> removeEventListener
eventListenerForType -> getEventListener

I don't really like getEventListener, maybe retrieve/cached/whatever as prefix?
I'm open for any suggestions.
 
> > > I think it's strange that a bool flips between "attached to a node" and
> > > "attached to the window". That could also be a 2-value enum (and might be
> > > clearer that way).
> >
> > Yeah, I should talk to Sam, about that.
> 
> I think an enum would be better than a bool. But how about two separate
> functions?
That's definately possible, but we'd need to store the enum anyways to differentiate between "attached to node" / "attached to window".