Open
Description
Element
and SvgElement
both declare an onClick
getter:
class Element extends Node ... {
...
static const EventStreamProvider<MouseEvent> clickEvent =
const EventStreamProvider<MouseEvent>('click');
...
ElementStream<MouseEvent> get onClick => clickEvent.forElement(this);
class SvgElement extends Element implements GlobalEventHandlers {
...
static const EventStreamProvider<MouseEvent> clickEvent =
const EventStreamProvider<MouseEvent>('click');
...
ElementStream<MouseEvent> get onClick => clickEvent.forElement(this);
These declarations are the same, so it would me more efficient if SvgElement
inherited the onClick
getter from Element
.
With inheritance, there would be one declaration, which would allow get:onClick
to be inlined (on dart2js).
We know the inlining is beneficial: onClick can currently be inlined when the receiver is known to be HtmlElement, and the inlined code avoids an allocation.