Factor out RecompileScriptEventListeners
Categories
(Core :: DOM: Events, enhancement)
Tracking
()
Tracking | Status | |
---|---|---|
firefox96 | --- | fixed |
People
(Reporter: fredw, Assigned: sd2187)
References
Details
(Keywords: good-first-bug, helpwanted)
Attachments
(2 files)
RecompileScriptEventListeners is implemented very similarly in SVG, HTML, XUL and (after bug 1571487) MathML. We should try to avoid duplicate code.
Updated•5 years ago
|
Reporter | ||
Comment 1•5 years ago
|
||
Checking now... First, nsXULElement::RecompileScriptEventListeners can be modified to just call "IsEventAttributeName(attr)" (without the XUL namespace parameter).
Then the only difference between
SVGElement::RecompileScriptEventListeners
MathMLElement::RecompileScriptEventListeners
nsGenericHTMLElement::RecompileScriptEventListeners
nsXULElement::RecompileScriptEventListeners
is that SVG uses GetEventNameForAttr(attr).
One can easily declare a default Element::GetEventNameForAttr function that just returns its parameter and override it in the SVGElement class. However per bug 1571487 comment 5, maybe we just want to drop this renaming...
Hello,
I am Somdatta and I am an outreachy applicant.I would like to work on this bug.
Could you please clarify the following statement-
One can easily declare a default Element::GetEventNameForAttr function that just returns its parameter and override it in the SVGElement class. However per bug 1571487 comment 5, maybe we just want to drop this renaming...
Reporter | ||
Comment 4•3 years ago
|
||
(In reply to Somdatta from comment #3)
Could you please clarify the following statement-
One can easily declare a default Element::GetEventNameForAttr function that just returns its parameter and override it in the SVGElement class.
However per bug 1571487 comment 5, maybe we just want to drop this renaming...
Hi, yes so SVG has SVGElement::GetEventNameForAttr has some special renaming, for example <svg onload="..."> will register an onSVGLoad event.
So IIRC, I was thinking create a method
Element::GetEventNameForAttr(nsAtom* aAttr) { return aAttr; }
then
either (a) override it in SVGElement::GetEventNameForAttr to keep the special renaming
or (b) wait clarification on the spec side, hopefully we don't need this kind of renaming https://github.com/w3c/svgwg/issues/467
That said, it seems since then Boris introduced Element::GetEventNameForAttr in bug 1607918, so you can probably just directly merge the RecompileScriptEventListeners implementations now.
(would still be nice to clarify the event thing in the SVG spec though)
Comment 5•3 years ago
|
||
First off, I don't think this bug should change any behavior.
It makes sense to me to make Element::GetEventNameForAttr
virtual rather than static, and make Element::RecompileScriptEventListeners
non-virtual. That would lead to slightly more virtual calls (one more per event handler attribute), but it's only called from nsINode::CloneAndAdopt, so that's probably fine.
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Hello,I am an outreachy applicant.Actually you(Emilio) reviewed my revision for this bug and requested some changes.I have made the required changes.Tomorrow(5th nov) is the deadline for my final application.So,I was wondering if you could look into the revision so that if it is okay,I can add this.Thanks in advance@emilio
Comment 8•3 years ago
|
||
Updated•3 years ago
|
Comment 10•3 years ago
|
||
bugherder |
Comment 11•3 years ago
|
||
Comment 12•3 years ago
|
||
bugherder |
Description
•