Closed
Bug 242234
Opened 21 years ago
Closed 21 years ago
support onclick type attributes
Categories
(Core :: SVG, defect)
Core
SVG
Tracking
()
RESOLVED
FIXED
People
(Reporter: sicking, Assigned: sicking)
Details
Attachments
(4 files, 2 obsolete files)
9.64 KB,
patch
|
Details | Diff | Splinter Review | |
25.41 KB,
patch
|
bryner
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
1.96 KB,
patch
|
sicking
:
review+
|
Details | Diff | Splinter Review |
1.21 KB,
patch
|
sicking
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
Assignee | ||
Comment 1•21 years ago
|
||
Assignee: alex → bugmail
Status: NEW → ASSIGNED
Comment 2•21 years ago
|
||
This is where we run into the evt/event issue I guess.
Assignee | ||
Comment 3•21 years ago
|
||
Yes. It's probably not a big problem implementation wise, the bigger issue is
going to be webauthors.
Assignee | ||
Comment 4•21 years ago
|
||
tor pointed out that the argument name 'event' is decided in the function
nsJSContext::CompileEventHandler. Specifically in the |gEventArgv| variable.
Unfortunatly that function doesn't know which element (or namespace thereof) the
eventhandler is sitting on, so we'll probably have to add another argument
Comment 6•21 years ago
|
||
(do we have to hardcode the event name in two places?)
Orginally I was thinking of passing the namespace down to CompileEventHandler,
but jst didn't want it knowing about namespaces and suggested passing the
character string around. I'll see what he thinks of using a aIsSVG flag instead.
Assignee | ||
Comment 8•21 years ago
|
||
I'm fine with the current way I think, though maybe I'd prefer to pass an atom.
Of course, I'd be fine with a bool too (which could be expanded to an enum in
case some another WG smokes a little too much weed too).
Attachment #151984 -
Attachment is obsolete: true
Comment 10•21 years ago
|
||
There are two problems with this patch, which probably be addressed as
followup bugs/patches.
* Some event names will be wrong - mozilla's event code generates html
events (ex. "focus") instead of the DOM names (ex. "DOMfocus"). Fixing
this would involve changing the event manager and probably some other
code.
* Only one "onload" is allowed, as it gets hooked up to the window object.
This is a problem shared with html.
Comment 11•21 years ago
|
||
As a compromise that hopefully will provide the least surprise until the
matter of multiple onloads is addressed, this patch will only allow "onload"
on the root node. While this won't help mixed namespace documents, it
should be useful for initialization in standalone svg files.
Attachment #152064 -
Attachment is obsolete: true
Attachment #152529 -
Flags: review?(bryner)
Comment 12•21 years ago
|
||
Comment on attachment 152529 [details] [diff] [review]
onload only on root
Looks ok to me; i'd suggest having jst sr=
Attachment #152529 -
Flags: review?(bryner) → review+
Attachment #152529 -
Flags: superreview?(jst)
Comment 13•21 years ago
|
||
Comment on attachment 152529 [details] [diff] [review]
onload only on root
+nsContentUtils::GetEventArgName(PRInt32 aNameSpaceID)
+{
+ if (aNameSpaceID == kNameSpaceID_SVG)
+ return gSVGEventName;
+ else
+ return gEventName;
+}
I'd loose the else-after-return there :-)
sr=jst
Attachment #152529 -
Flags: superreview?(jst) → superreview+
Comment 14•21 years ago
|
||
Checked in. Bug 252631 filed about the one onload per document limit.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Comment 15•21 years ago
|
||
Slight problem with xbl handlers:
If you now attach a binding to an element in the SVG namespace and the binding
contains a handler, then the handler's event parameter is undefined (it is now
called 'evt'). I guess that's a bad thing; xbl handler event args should always
be called 'event' as given by the xbl specs.
Testcases:
http://www.croczilla.com/svg/samples/xbl1/ : not working anymore because event
is not defined in xbl1-bindings.xml line 72
http://www.croczilla.com/svg/samples/xbl-shapes/ : still working, since the
elements bound are not in the svg namespace
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 16•21 years ago
|
||
Another problem:
onload doesn't appear to be working.
Testcase: http://www.croczilla.com/~alex/testcases/onload.svg
Comment 17•21 years ago
|
||
The onload problem was caused by two things:
* onload wasn't being accepted as an event name
* check for root element was going wrong because <svg> is parsed before
being added to the document
Jonas, why did you seperate off most of the event attributes into
IsGraphicElementEventName?
Assignee | ||
Comment 18•21 years ago
|
||
Comment on attachment 154119 [details] [diff] [review]
repair onload
>Index: nsSVGElement.cpp
>- mDocument->GetRootContent() == NS_STATIC_CAST(nsIContent*, this)) {
>+ mDocument->GetRootContent() == NULL) {
Ack, this is a big hack. This will no longer enforce the root-element
requirement, but rather some empty-document requirement. Which in theory could
be any element if a DOM is created in javascript. I think it's ok for now
though since onload will be changed anyway later on. Please add a comment
though.
The reason i had a separate IsGraphicElementEventName is that many elements
will have only those eventattributes. My idea was that different elements will
override IsEventName and all "graphic elements" will in their implementation
call IsGraphicElementEventName.
Attachment #154119 -
Flags: review+
Assignee | ||
Comment 19•21 years ago
|
||
> mDocument->GetRootContent() == NULL
yay, scc and jst would slap you hard for that. Make that
!mDocument->GetRootContent()
Comment 20•21 years ago
|
||
Onload fix checked in with the test changed and the comment expanded.
Comment 21•21 years ago
|
||
Assignee | ||
Updated•21 years ago
|
Attachment #154141 -
Flags: review+
Attachment #154141 -
Flags: superreview?(jst)
Comment 22•21 years ago
|
||
Comment on attachment 154141 [details] [diff] [review]
always compile xbl bindings with XBL namespace event name
sr=jst
Attachment #154141 -
Flags: superreview?(jst) → superreview+
Comment 23•21 years ago
|
||
XBL binding patch checked in.
Status: REOPENED → RESOLVED
Closed: 21 years ago → 21 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•