From 6f70ffa4ffc92abd2b1e5339c7412e4146ab9d72 Mon Sep 17 00:00:00 2001 From: Sigmund Cherem Date: Tue, 11 Mar 2025 13:25:58 -0700 Subject: [PATCH] [dart:html] Disallow extending html elements. This change removes the `.created` constructor in the html class hierarchy. These classes now only offer public factory constructors. As a result, developers will no longer be able to extend these classes in their libraries. This is a breaking change, however we don't expect there to be as much use of this feature (extending html element classes). In particular, the ability to extend html elements was intended for web components. Dart only ever supported the 0.5 spec of web components, which is old and long deprecated. Previously, in Dart 3.0, we removed APIs used to register custom elements from `dart:html`, so the ability to extend html elements has not been useful since then. For more details see https://github.com/dart-lang/sdk/issues/53264 CoreLibraryReviewExempt: ddc/dart2js-specific library. Change-Id: I43d8c9ae99dc83545e70e1f3b9dfc9f1b274a5c7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321741 Reviewed-by: Lasse Nielsen Reviewed-by: Srujan Gaddam Reviewed-by: Stephen Adams Commit-Queue: Srujan Gaddam --- CHANGELOG.md | 11 + pkg/compiler/test/inlining/data/native.dart | 73 --- sdk/lib/html/dart2js/html_dart2js.dart | 506 ++---------------- sdk/lib/svg/dart2js/svg_dart2js.dart | 432 --------------- tests/co19/co19-co19.status | 2 + tools/dom/scripts/systemhtml.py | 15 - .../html/dart2js/html_dart2js.darttemplate | 7 - .../html/impl/impl_Element.darttemplate | 18 - .../html/impl/impl_EventTarget.darttemplate | 40 +- .../html/impl/impl_Node.darttemplate | 3 - 10 files changed, 89 insertions(+), 1018 deletions(-) delete mode 100644 pkg/compiler/test/inlining/data/native.dart diff --git a/CHANGELOG.md b/CHANGELOG.md index c6b0cb61f94..7a4433f3db9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,17 @@ - Added `Iterable.withIterator` constructor. +#### `dart:html` + +- **Breaking change**: Native classes in `dart:html`, like `HtmlElement`, can no + longer be extended. Long ago, to support custom elements, element classes + exposed a `.created` constructor that adhered to the v0.5 spec of web + components. On this release, those constructors has been removed and with that + change, the classes can no longer be extended. In a future change, they may be + marked as interface classes as well. This is a follow up from an earlier + breaking change in 3.0.0 that removed the `registerElement` APIs. See + [#53264](https://github.com/dart-lang/sdk/issues/53264) for details. + ### Tools #### Analyzer diff --git a/pkg/compiler/test/inlining/data/native.dart b/pkg/compiler/test/inlining/data/native.dart deleted file mode 100644 index 897333b9bd8..00000000000 --- a/pkg/compiler/test/inlining/data/native.dart +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'dart:html'; - -/*member: main:[]*/ -main() { - document.createElement(CustomElement.tag); - newCustom(); - newCustomCreated(); - newNormal(); - newNormalCreated(); -} - -//////////////////////////////////////////////////////////////////////////////// -// Create a custom element. The factory is inlined but the generative -// constructor isn't. -//////////////////////////////////////////////////////////////////////////////// - -/*member: newCustom:[]*/ -@pragma('dart2js:noInline') -newCustom() { - CustomElement(); -} - -/*member: newCustomCreated:[]*/ -@pragma('dart2js:noInline') -newCustomCreated() { - CustomElement.created(); -} - -class CustomElement extends HtmlElement { - static final tag = 'x-foo'; - - /*member: CustomElement.:[newCustom:CustomElement]*/ - factory CustomElement() => Element.tag(tag) as CustomElement; - - /*member: CustomElement.created:[]*/ - CustomElement.created() : super.created() { - print('boo'); - } -} - -//////////////////////////////////////////////////////////////////////////////// -// Create a normal class, similar to a custom element. Both the factory and -// the generative constructor are inlined. -//////////////////////////////////////////////////////////////////////////////// - -/*member: newNormal:[]*/ -@pragma('dart2js:noInline') -newNormal() { - NormalElement(); -} - -/*member: newNormalCreated:[]*/ -@pragma('dart2js:noInline') -newNormalCreated() { - NormalElement.created(); -} - -class NormalElement { - /*member: NormalElement._:[newNormal:NormalElement]*/ - NormalElement._(); - - /*member: NormalElement.:[newNormal:NormalElement]*/ - factory NormalElement() => NormalElement._(); - - /*member: NormalElement.created:[newNormalCreated+,newNormalCreated:NormalElement]*/ - NormalElement.created() { - print('foo'); - } -} diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart index f6510b051fc..06d7042c715 100644 --- a/sdk/lib/html/dart2js/html_dart2js.dart +++ b/sdk/lib/html/dart2js/html_dart2js.dart @@ -112,13 +112,6 @@ class HtmlElement extends Element implements NoncedElement { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - HtmlElement.created() : super.created(); - // From NoncedElement String? get nonce native; set nonce(String? value) native; @@ -557,12 +550,6 @@ class AnchorElement extends HtmlElement implements HtmlHyperlinkElementUtils { if (href != null) e.href = href; return e; } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - AnchorElement.created() : super.created(); String? get download native; @@ -1111,12 +1098,6 @@ class AreaElement extends HtmlElement implements HtmlHyperlinkElementUtils { document, "area", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - AreaElement.created() : super.created(); String get alt native; @@ -1206,12 +1187,6 @@ class AudioElement extends MediaElement { } static AudioElement _create_1(src) => JS('AudioElement', 'new Audio(#)', src); static AudioElement _create_2() => JS('AudioElement', 'new Audio()'); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - AudioElement.created() : super.created(); factory AudioElement([String? src]) => new AudioElement._(src); } @@ -1274,12 +1249,6 @@ class BRElement extends HtmlElement { document, "br", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - BRElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -1531,12 +1500,6 @@ class BaseElement extends HtmlElement { document, "base", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - BaseElement.created() : super.created(); String get href native; @@ -1858,12 +1821,6 @@ class BodyElement extends HtmlElement implements WindowEventHandlers { document, "body", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - BodyElement.created() : super.created(); /// Stream of `blur` events handled by this [BodyElement]. ElementStream get onBlur => blurEvent.forElement(this); @@ -1963,12 +1920,6 @@ class ButtonElement extends HtmlElement { document, "button", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - ButtonElement.created() : super.created(); bool get autofocus native; @@ -2161,12 +2112,6 @@ class CanvasElement extends HtmlElement implements CanvasImageSource { if (height != null) e.height = height; return e; } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - CanvasElement.created() : super.created(); /// The height of this canvas element in CSS pixels. @@ -3382,12 +3327,6 @@ class ContentElement extends HtmlElement { factory ContentElement() => document.createElement("content") as ContentElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - ContentElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => Element.isTagSupported('content'); @@ -9266,12 +9205,6 @@ class DListElement extends HtmlElement { document, "dl", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - DListElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -9283,12 +9216,6 @@ class DataElement extends HtmlElement { factory DataElement._() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - DataElement.created() : super.created(); String? get value native; @@ -9311,12 +9238,6 @@ class DataListElement extends HtmlElement { factory DataListElement() => document.createElement("datalist") as DataListElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - DataListElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => Element.isTagSupported('datalist'); @@ -9613,12 +9534,6 @@ class DetailsElement extends HtmlElement { factory DetailsElement() => document.createElement("details") as DetailsElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - DetailsElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => Element.isTagSupported('details'); @@ -9807,12 +9722,6 @@ class DialogElement extends HtmlElement { factory DialogElement._() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - DialogElement.created() : super.created(); bool? get open native; @@ -10112,12 +10021,6 @@ class DivElement extends HtmlElement { document, "div", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - DivElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -13197,24 +13100,6 @@ class Element extends Node return fragment.nodes.where((e) => e is Element).single as Element; } - /** - * Custom element creation constructor. - * - * This constructor is used by the DOM when a custom element has been - * created. It can only be invoked by subclasses of Element from - * that classes created constructor. - * - * class CustomElement extends Element { - * factory CustomElement() => new Element.tag('x-custom'); - * - * CustomElement.created() : super.created() { - * // Perform any element initialization. - * } - * } - * document.registerElement('x-custom', CustomElement); - */ - Element.created() : super._created(); - /** * Creates the HTML element specified by the tag name. * @@ -15818,12 +15703,6 @@ class EmbedElement extends HtmlElement { } factory EmbedElement() => document.createElement("embed") as EmbedElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - EmbedElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => Element.isTagSupported('embed'); @@ -16373,8 +16252,44 @@ class ElementEvents extends Events { */ @Native("EventTarget") class EventTarget extends JavaScriptObject { - // Custom element created callback. - EventTarget._created(); + // A private constructor to act as super-constructor for mixin-applications. + // + // The `dart:html` library predates the class modifiers feature, and it + // effectively seals many of its classes by using private and factory + // constructors. This allows the classes to be extended within the library, + // but seals them to code outside the SDK. + // + // Currently a mixin application on a class with no generative constructors + // will get a default constructor which tries to forward to the unnamed + // constructor of the superclass. That superclass constructor either doesn't + // exist or is not generative, so that's always an invalid default constructor. + // + // For now, this makes sure that the class has a private generative + // constructor that a mixin application *inside this library* can forward to, + // to avoid getting an invalid default constructor. + // + // Here is a simple example to illustrate the kind of error this constructor + // prevents: + // ``` + // class A { // Equivalent to `EventTarget` here + // // Adding A._unused(); fixes the errors below + // factory A._() => throw ''; + // } + // + // abstract mixin class M { + // get y; + // } + // + // abstract class B extends A with M { + // // ^ Error because A&M's default constructor needs a + // // superclass constructor to forward to. + // factory B._() => throw ''; + // + // @override + // get y => 3; + // } + // ``` + EventTarget._unused(); /** * This is an ease-of-use accessor for event streams which should only be @@ -16597,12 +16512,6 @@ class FieldSetElement extends HtmlElement { document, "fieldset", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - FieldSetElement.created() : super.created(); bool? get disabled native; @@ -17306,12 +17215,6 @@ class FormElement extends HtmlElement { document, "form", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - FormElement.created() : super.created(); String? get acceptCharset native; @@ -18058,12 +17961,6 @@ class HRElement extends HtmlElement { document, "hr", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - HRElement.created() : super.created(); String get color native; @@ -18140,12 +18037,6 @@ class HeadElement extends HtmlElement { document, "head", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - HeadElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -18219,12 +18110,6 @@ class HeadingElement extends HtmlElement { document, "h6", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - HeadingElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -18502,12 +18387,6 @@ class HtmlHtmlElement extends HtmlElement { document, "html", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - HtmlHtmlElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -19416,12 +19295,6 @@ class IFrameElement extends HtmlElement { document, "iframe", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - IFrameElement.created() : super.created(); String? get allow native; @@ -19633,12 +19506,6 @@ class ImageElement extends HtmlElement implements CanvasImageSource { if (height != null) e.height = height; return e; } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - ImageElement.created() : super.created(); String? get alt native; @@ -19765,12 +19632,6 @@ class InputElement extends HtmlElement factory InputElement._() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - InputElement.created() : super.created(); String? get accept native; @@ -20891,12 +20752,6 @@ class LIElement extends HtmlElement { document, "li", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - LIElement.created() : super.created(); int get value native; @@ -20919,12 +20774,6 @@ class LabelElement extends HtmlElement { document, "label", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - LabelElement.created() : super.created(); HtmlElement? get control native; @@ -20951,12 +20800,6 @@ class LegendElement extends HtmlElement { document, "legend", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - LegendElement.created() : super.created(); FormElement? get form native; } @@ -21003,12 +20846,6 @@ class LinkElement extends HtmlElement { document, "link", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - LinkElement.created() : super.created(); String? get as native; @@ -21178,12 +21015,6 @@ class MapElement extends HtmlElement { document, "map", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - MapElement.created() : super.created(); @Returns('HtmlCollection') @Creates('HtmlCollection') @@ -21203,12 +21034,6 @@ class MathMLElement extends Element { factory MathMLElement._() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - MathMLElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -21323,12 +21148,6 @@ class MediaElement extends HtmlElement { factory MediaElement._() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - MediaElement.created() : super.created(); static const int HAVE_CURRENT_DATA = 2; @@ -22232,12 +22051,6 @@ class MenuElement extends HtmlElement { document, "menu", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - MenuElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -22473,12 +22286,6 @@ class MetaElement extends HtmlElement { document, "meta", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - MetaElement.created() : super.created(); String get content native; @@ -22534,12 +22341,6 @@ class MeterElement extends HtmlElement { } factory MeterElement() => document.createElement("meter") as MeterElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - MeterElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => Element.isTagSupported('meter'); @@ -22942,12 +22743,6 @@ class ModElement extends HtmlElement { factory ModElement._() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - ModElement.created() : super.created(); String get cite native; @@ -23995,9 +23790,6 @@ class _ChildNodeListLazy extends ListBase implements NodeListWrapper { @Native("Node") class Node extends EventTarget { - // Custom element created callback. - Node._created() : super._created(); - /** * A modifiable list of this node's children. */ @@ -24712,12 +24504,6 @@ class OListElement extends HtmlElement { document, "ol", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - OListElement.created() : super.created(); bool? get reversed native; @@ -24747,12 +24533,6 @@ class ObjectElement extends HtmlElement { } factory ObjectElement() => document.createElement("object") as ObjectElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - ObjectElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => Element.isTagSupported('object'); @@ -25209,12 +24989,6 @@ class OptGroupElement extends HtmlElement { document, "optgroup", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - OptGroupElement.created() : super.created(); bool get disabled native; @@ -25273,12 +25047,6 @@ class OptionElement extends HtmlElement { static OptionElement _create_4(data) => JS('OptionElement', 'new Option(#)', data); static OptionElement _create_5() => JS('OptionElement', 'new Option()'); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - OptionElement.created() : super.created(); bool get defaultSelected native; @@ -25334,12 +25102,6 @@ class OutputElement extends HtmlElement { } factory OutputElement() => document.createElement("output") as OutputElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - OutputElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => Element.isTagSupported('output'); @@ -25675,12 +25437,6 @@ class ParagraphElement extends HtmlElement { document, "p", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - ParagraphElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -25700,12 +25456,6 @@ class ParamElement extends HtmlElement { document, "param", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - ParamElement.created() : super.created(); String get name native; @@ -26571,12 +26321,6 @@ class PictureElement extends HtmlElement { factory PictureElement._() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - PictureElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -26812,12 +26556,6 @@ class PreElement extends HtmlElement { document, "pre", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - PreElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -27043,12 +26781,6 @@ class ProgressElement extends HtmlElement { factory ProgressElement() => document.createElement("progress") as ProgressElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - ProgressElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => Element.isTagSupported('progress'); @@ -27271,12 +27003,6 @@ class QuoteElement extends HtmlElement { document, "q", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - QuoteElement.created() : super.created(); String get cite native; @@ -28459,12 +28185,6 @@ class ScriptElement extends HtmlElement { document, "script", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - ScriptElement.created() : super.created(); bool? get async native; @@ -28657,12 +28377,6 @@ class SelectElement extends HtmlElement { document, "select", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - SelectElement.created() : super.created(); bool get autofocus native; @@ -29065,12 +28779,6 @@ class ShadowElement extends HtmlElement { } factory ShadowElement() => document.createElement("shadow") as ShadowElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - ShadowElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => Element.isTagSupported('shadow'); @@ -29296,12 +29004,6 @@ class SlotElement extends HtmlElement { factory SlotElement._() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - SlotElement.created() : super.created(); String? get name native; @@ -29455,12 +29157,6 @@ class SourceElement extends HtmlElement { document, "source", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - SourceElement.created() : super.created(); String get media native; @@ -29499,12 +29195,6 @@ class SpanElement extends HtmlElement { document, "span", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - SpanElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -30352,12 +30042,6 @@ class StyleElement extends HtmlElement { document, "style", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - StyleElement.created() : super.created(); bool get disabled native; @@ -30507,12 +30191,6 @@ class TableCaptionElement extends HtmlElement { document, "caption", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - TableCaptionElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -30533,12 +30211,6 @@ class TableCellElement extends HtmlElement { document, "td", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - TableCellElement.created() : super.created(); int get cellIndex native; @@ -30571,12 +30243,6 @@ class TableColElement extends HtmlElement { document, "col", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - TableColElement.created() : super.created(); int get span native; @@ -30651,12 +30317,6 @@ class TableElement extends HtmlElement { document, "table", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - TableElement.created() : super.created(); TableCaptionElement? get caption native; @@ -30755,12 +30415,6 @@ class TableRowElement extends HtmlElement { document, "tr", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - TableRowElement.created() : super.created(); @JSName('cells') @Returns('HtmlCollection') @@ -30821,12 +30475,6 @@ class TableSectionElement extends HtmlElement { factory TableSectionElement._() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - TableSectionElement.created() : super.created(); @JSName('rows') @Returns('HtmlCollection') @@ -30876,12 +30524,6 @@ class TemplateElement extends HtmlElement { factory TemplateElement() => document.createElement("template") as TemplateElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - TemplateElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => Element.isTagSupported('template'); @@ -30957,12 +30599,6 @@ class TextAreaElement extends HtmlElement { document, "textarea", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - TextAreaElement.created() : super.created(); String? get autocapitalize native; @@ -31410,12 +31046,6 @@ class TimeElement extends HtmlElement { factory TimeElement._() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - TimeElement.created() : super.created(); String? get dateTime native; @@ -31463,12 +31093,6 @@ class TitleElement extends HtmlElement { document, "title", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - TitleElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -31769,12 +31393,6 @@ class TrackElement extends HtmlElement { } factory TrackElement() => document.createElement("track") as TrackElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - TrackElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => Element.isTagSupported('track'); @@ -32031,12 +31649,6 @@ class UListElement extends HtmlElement { document, "ul", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - UListElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -32071,12 +31683,6 @@ class UnknownElement extends HtmlElement { factory UnknownElement._() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - UnknownElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -32633,12 +32239,6 @@ class VideoElement extends MediaElement implements CanvasImageSource { document, "video", ); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - VideoElement.created() : super.created(); int get height native; @@ -36093,12 +35693,6 @@ abstract class _HTMLDirectoryElement extends HtmlElement { factory _HTMLDirectoryElement._() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - _HTMLDirectoryElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -36112,12 +35706,6 @@ abstract class _HTMLFontElement extends HtmlElement { factory _HTMLFontElement._() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - _HTMLFontElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -36131,12 +35719,6 @@ abstract class _HTMLFrameElement extends HtmlElement { factory _HTMLFrameElement._() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - _HTMLFrameElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -36151,12 +35733,6 @@ abstract class _HTMLFrameSetElement extends HtmlElement factory _HTMLFrameSetElement._() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - _HTMLFrameSetElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file @@ -36171,12 +35747,6 @@ abstract class _HTMLMarqueeElement extends HtmlElement { factory _HTMLMarqueeElement._() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - _HTMLMarqueeElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a diff --git a/sdk/lib/svg/dart2js/svg_dart2js.dart b/sdk/lib/svg/dart2js/svg_dart2js.dart index ab49d893e05..b1f3e960376 100644 --- a/sdk/lib/svg/dart2js/svg_dart2js.dart +++ b/sdk/lib/svg/dart2js/svg_dart2js.dart @@ -54,12 +54,6 @@ class AElement extends GraphicsElement implements UriReference { factory AElement() => _SvgElementFactoryProvider.createSvgElement_tag("a") as AElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - AElement.created() : super.created(); AnimatedString get target native; @@ -125,12 +119,6 @@ class AnimateElement extends AnimationElement { factory AnimateElement() => _SvgElementFactoryProvider.createSvgElement_tag("animate") as AnimateElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - AnimateElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => @@ -155,12 +143,6 @@ class AnimateMotionElement extends AnimationElement { factory AnimateMotionElement() => _SvgElementFactoryProvider.createSvgElement_tag("animateMotion") as AnimateMotionElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - AnimateMotionElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => @@ -185,12 +167,6 @@ class AnimateTransformElement extends AnimationElement { factory AnimateTransformElement() => _SvgElementFactoryProvider.createSvgElement_tag("animateTransform") as AnimateTransformElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - AnimateTransformElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => @@ -414,12 +390,6 @@ class AnimationElement extends SvgElement implements Tests { factory AnimationElement() => _SvgElementFactoryProvider.createSvgElement_tag("animation") as AnimationElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - AnimationElement.created() : super.created(); SvgElement? get targetElement native; @@ -458,12 +428,6 @@ class CircleElement extends GeometryElement { factory CircleElement() => _SvgElementFactoryProvider.createSvgElement_tag("circle") as CircleElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - CircleElement.created() : super.created(); AnimatedLength? get cx native; @@ -486,12 +450,6 @@ class ClipPathElement extends GraphicsElement { factory ClipPathElement() => _SvgElementFactoryProvider.createSvgElement_tag("clipPath") as ClipPathElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - ClipPathElement.created() : super.created(); AnimatedEnumeration? get clipPathUnits native; } @@ -509,12 +467,6 @@ class DefsElement extends GraphicsElement { factory DefsElement() => _SvgElementFactoryProvider.createSvgElement_tag("defs") as DefsElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - DefsElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -530,12 +482,6 @@ class DescElement extends SvgElement { factory DescElement() => _SvgElementFactoryProvider.createSvgElement_tag("desc") as DescElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - DescElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -547,12 +493,6 @@ class DiscardElement extends SvgElement { factory DiscardElement._() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - DiscardElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -569,12 +509,6 @@ class EllipseElement extends GeometryElement { factory EllipseElement() => _SvgElementFactoryProvider.createSvgElement_tag("ellipse") as EllipseElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - EllipseElement.created() : super.created(); AnimatedLength? get cx native; @@ -604,12 +538,6 @@ class FEBlendElement extends SvgElement factory FEBlendElement() => _SvgElementFactoryProvider.createSvgElement_tag("feBlend") as FEBlendElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - FEBlendElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => @@ -666,12 +594,6 @@ class FEColorMatrixElement extends SvgElement factory FEColorMatrixElement() => _SvgElementFactoryProvider.createSvgElement_tag("feColorMatrix") as FEColorMatrixElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - FEColorMatrixElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => @@ -726,12 +648,6 @@ class FEComponentTransferElement extends SvgElement factory FEComponentTransferElement() => _SvgElementFactoryProvider.createSvgElement_tag("feComponentTransfer") as FEComponentTransferElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - FEComponentTransferElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => @@ -764,12 +680,6 @@ class FECompositeElement extends SvgElement factory FECompositeElement._() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - FECompositeElement.created() : super.created(); static const int SVG_FECOMPOSITE_OPERATOR_ARITHMETIC = 6; @@ -831,12 +741,6 @@ class FEConvolveMatrixElement extends SvgElement factory FEConvolveMatrixElement() => _SvgElementFactoryProvider.createSvgElement_tag("feConvolveMatrix") as FEConvolveMatrixElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - FEConvolveMatrixElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => @@ -907,12 +811,6 @@ class FEDiffuseLightingElement extends SvgElement factory FEDiffuseLightingElement() => _SvgElementFactoryProvider.createSvgElement_tag("feDiffuseLighting") as FEDiffuseLightingElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - FEDiffuseLightingElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => @@ -961,12 +859,6 @@ class FEDisplacementMapElement extends SvgElement factory FEDisplacementMapElement() => _SvgElementFactoryProvider.createSvgElement_tag("feDisplacementMap") as FEDisplacementMapElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - FEDisplacementMapElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => @@ -1024,12 +916,6 @@ class FEDistantLightElement extends SvgElement { factory FEDistantLightElement() => _SvgElementFactoryProvider.createSvgElement_tag("feDistantLight") as FEDistantLightElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - FEDistantLightElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => @@ -1060,12 +946,6 @@ class FEFloodElement extends SvgElement factory FEFloodElement() => _SvgElementFactoryProvider.createSvgElement_tag("feFlood") as FEFloodElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - FEFloodElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => @@ -1103,12 +983,6 @@ class FEFuncAElement extends _SVGComponentTransferFunctionElement { factory FEFuncAElement() => _SvgElementFactoryProvider.createSvgElement_tag("feFuncA") as FEFuncAElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - FEFuncAElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => @@ -1134,12 +1008,6 @@ class FEFuncBElement extends _SVGComponentTransferFunctionElement { factory FEFuncBElement() => _SvgElementFactoryProvider.createSvgElement_tag("feFuncB") as FEFuncBElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - FEFuncBElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => @@ -1165,12 +1033,6 @@ class FEFuncGElement extends _SVGComponentTransferFunctionElement { factory FEFuncGElement() => _SvgElementFactoryProvider.createSvgElement_tag("feFuncG") as FEFuncGElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - FEFuncGElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => @@ -1196,12 +1058,6 @@ class FEFuncRElement extends _SVGComponentTransferFunctionElement { factory FEFuncRElement() => _SvgElementFactoryProvider.createSvgElement_tag("feFuncR") as FEFuncRElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - FEFuncRElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => @@ -1228,12 +1084,6 @@ class FEGaussianBlurElement extends SvgElement factory FEGaussianBlurElement() => _SvgElementFactoryProvider.createSvgElement_tag("feGaussianBlur") as FEGaussianBlurElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - FEGaussianBlurElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => @@ -1280,12 +1130,6 @@ class FEImageElement extends SvgElement factory FEImageElement() => _SvgElementFactoryProvider.createSvgElement_tag("feImage") as FEImageElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - FEImageElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => @@ -1330,12 +1174,6 @@ class FEMergeElement extends SvgElement factory FEMergeElement() => _SvgElementFactoryProvider.createSvgElement_tag("feMerge") as FEMergeElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - FEMergeElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => @@ -1373,12 +1211,6 @@ class FEMergeNodeElement extends SvgElement { factory FEMergeNodeElement() => _SvgElementFactoryProvider.createSvgElement_tag("feMergeNode") as FEMergeNodeElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - FEMergeNodeElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => @@ -1403,12 +1235,6 @@ class FEMorphologyElement extends SvgElement factory FEMorphologyElement._() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - FEMorphologyElement.created() : super.created(); static const int SVG_MORPHOLOGY_OPERATOR_DILATE = 2; @@ -1456,12 +1282,6 @@ class FEOffsetElement extends SvgElement factory FEOffsetElement() => _SvgElementFactoryProvider.createSvgElement_tag("feOffset") as FEOffsetElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - FEOffsetElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => @@ -1505,12 +1325,6 @@ class FEPointLightElement extends SvgElement { factory FEPointLightElement() => _SvgElementFactoryProvider.createSvgElement_tag("fePointLight") as FEPointLightElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - FEPointLightElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => @@ -1543,12 +1357,6 @@ class FESpecularLightingElement extends SvgElement factory FESpecularLightingElement() => _SvgElementFactoryProvider.createSvgElement_tag("feSpecularLighting") as FESpecularLightingElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - FESpecularLightingElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => @@ -1598,12 +1406,6 @@ class FESpotLightElement extends SvgElement { factory FESpotLightElement() => _SvgElementFactoryProvider.createSvgElement_tag("feSpotLight") as FESpotLightElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - FESpotLightElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => @@ -1646,12 +1448,6 @@ class FETileElement extends SvgElement factory FETileElement() => _SvgElementFactoryProvider.createSvgElement_tag("feTile") as FETileElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - FETileElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => @@ -1692,12 +1488,6 @@ class FETurbulenceElement extends SvgElement factory FETurbulenceElement() => _SvgElementFactoryProvider.createSvgElement_tag("feTurbulence") as FETurbulenceElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - FETurbulenceElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => @@ -1759,12 +1549,6 @@ class FilterElement extends SvgElement implements UriReference { factory FilterElement() => _SvgElementFactoryProvider.createSvgElement_tag("filter") as FilterElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - FilterElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => @@ -1841,12 +1625,6 @@ class ForeignObjectElement extends GraphicsElement { factory ForeignObjectElement() => _SvgElementFactoryProvider.createSvgElement_tag("foreignObject") as ForeignObjectElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - ForeignObjectElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => @@ -1875,12 +1653,6 @@ class GElement extends GraphicsElement { factory GElement() => _SvgElementFactoryProvider.createSvgElement_tag("g") as GElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - GElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -1892,12 +1664,6 @@ class GeometryElement extends GraphicsElement { factory GeometryElement._() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - GeometryElement.created() : super.created(); AnimatedNumber? get pathLength native; @@ -1919,12 +1685,6 @@ class GraphicsElement extends SvgElement implements Tests { factory GraphicsElement._() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - GraphicsElement.created() : super.created(); SvgElement? get farthestViewportElement native; @@ -1960,12 +1720,6 @@ class ImageElement extends GraphicsElement implements UriReference { factory ImageElement() => _SvgElementFactoryProvider.createSvgElement_tag("image") as ImageElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - ImageElement.created() : super.created(); String? get async native; @@ -2130,12 +1884,6 @@ class LineElement extends GeometryElement { factory LineElement() => _SvgElementFactoryProvider.createSvgElement_tag("line") as LineElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - LineElement.created() : super.created(); AnimatedLength? get x1 native; @@ -2160,12 +1908,6 @@ class LinearGradientElement extends _GradientElement { factory LinearGradientElement() => _SvgElementFactoryProvider.createSvgElement_tag("linearGradient") as LinearGradientElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - LinearGradientElement.created() : super.created(); AnimatedLength? get x1 native; @@ -2190,12 +1932,6 @@ class MarkerElement extends SvgElement implements FitToViewBox { factory MarkerElement() => _SvgElementFactoryProvider.createSvgElement_tag("marker") as MarkerElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - MarkerElement.created() : super.created(); static const int SVG_MARKERUNITS_STROKEWIDTH = 2; @@ -2247,12 +1983,6 @@ class MaskElement extends SvgElement implements Tests { factory MaskElement() => _SvgElementFactoryProvider.createSvgElement_tag("mask") as MaskElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - MaskElement.created() : super.created(); AnimatedLength? get height native; @@ -2341,12 +2071,6 @@ class MetadataElement extends SvgElement { factory MetadataElement._() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - MetadataElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -2455,12 +2179,6 @@ class PathElement extends GeometryElement { factory PathElement() => _SvgElementFactoryProvider.createSvgElement_tag("path") as PathElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - PathElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -2478,12 +2196,6 @@ class PatternElement extends SvgElement factory PatternElement() => _SvgElementFactoryProvider.createSvgElement_tag("pattern") as PatternElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - PatternElement.created() : super.created(); AnimatedLength? get height native; @@ -2584,12 +2296,6 @@ class PolygonElement extends GeometryElement { factory PolygonElement() => _SvgElementFactoryProvider.createSvgElement_tag("polygon") as PolygonElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - PolygonElement.created() : super.created(); PointList? get animatedPoints native; @@ -2610,12 +2316,6 @@ class PolylineElement extends GeometryElement { factory PolylineElement() => _SvgElementFactoryProvider.createSvgElement_tag("polyline") as PolylineElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - PolylineElement.created() : super.created(); PointList? get animatedPoints native; @@ -2684,12 +2384,6 @@ class RadialGradientElement extends _GradientElement { factory RadialGradientElement() => _SvgElementFactoryProvider.createSvgElement_tag("radialGradient") as RadialGradientElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - RadialGradientElement.created() : super.created(); AnimatedLength? get cx native; @@ -2745,12 +2439,6 @@ class RectElement extends GeometryElement { factory RectElement() => _SvgElementFactoryProvider.createSvgElement_tag("rect") as RectElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - RectElement.created() : super.created(); AnimatedLength? get height native; @@ -2779,12 +2467,6 @@ class ScriptElement extends SvgElement implements UriReference { factory ScriptElement() => _SvgElementFactoryProvider.createSvgElement_tag("script") as ScriptElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - ScriptElement.created() : super.created(); String? get type native; @@ -2811,12 +2493,6 @@ class SetElement extends AnimationElement { factory SetElement() => _SvgElementFactoryProvider.createSvgElement_tag("set") as SetElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - SetElement.created() : super.created(); /// Checks if this type is supported on the current platform. static bool get supported => @@ -2837,12 +2513,6 @@ class StopElement extends SvgElement { factory StopElement() => _SvgElementFactoryProvider.createSvgElement_tag("stop") as StopElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - StopElement.created() : super.created(); @JSName('offset') AnimatedNumber get gradientOffset native; @@ -2937,12 +2607,6 @@ class StyleElement extends SvgElement { factory StyleElement() => _SvgElementFactoryProvider.createSvgElement_tag("style") as StyleElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - StyleElement.created() : super.created(); bool? get disabled native; @@ -3296,12 +2960,6 @@ class SvgElement extends Element implements GlobalEventHandlers, NoncedElement { static const EventStreamProvider wheelEvent = const EventStreamProvider('wheel'); - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - SvgElement.created() : super.created(); // Shadowing definition. @JSName('className') @@ -3473,12 +3131,6 @@ class SvgSvgElement extends GraphicsElement factory SvgSvgElement._() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - SvgSvgElement.created() : super.created(); num? get currentScale native; @@ -3582,12 +3234,6 @@ class SwitchElement extends GraphicsElement { factory SwitchElement() => _SvgElementFactoryProvider.createSvgElement_tag("switch") as SwitchElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - SwitchElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -3604,12 +3250,6 @@ class SymbolElement extends SvgElement implements FitToViewBox { factory SymbolElement() => _SvgElementFactoryProvider.createSvgElement_tag("symbol") as SymbolElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - SymbolElement.created() : super.created(); // From SVGFitToViewBox @@ -3631,12 +3271,6 @@ class TSpanElement extends TextPositioningElement { factory TSpanElement() => _SvgElementFactoryProvider.createSvgElement_tag("tspan") as TSpanElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - TSpanElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -3664,12 +3298,6 @@ class TextContentElement extends GraphicsElement { factory TextContentElement._() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - TextContentElement.created() : super.created(); static const int LENGTHADJUST_SPACING = 1; @@ -3713,12 +3341,6 @@ class TextElement extends TextPositioningElement { factory TextElement() => _SvgElementFactoryProvider.createSvgElement_tag("text") as TextElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - TextElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -3731,12 +3353,6 @@ class TextPathElement extends TextContentElement implements UriReference { factory TextPathElement._() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - TextPathElement.created() : super.created(); static const int TEXTPATH_METHODTYPE_ALIGN = 1; @@ -3771,12 +3387,6 @@ class TextPositioningElement extends TextContentElement { factory TextPositioningElement._() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - TextPositioningElement.created() : super.created(); AnimatedLengthList? get dx native; @@ -3802,12 +3412,6 @@ class TitleElement extends SvgElement { factory TitleElement() => _SvgElementFactoryProvider.createSvgElement_tag("title") as TitleElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - TitleElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -3980,12 +3584,6 @@ class UseElement extends GraphicsElement implements UriReference { factory UseElement() => _SvgElementFactoryProvider.createSvgElement_tag("use") as UseElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - UseElement.created() : super.created(); AnimatedLength? get height native; @@ -4013,12 +3611,6 @@ class ViewElement extends SvgElement implements FitToViewBox, ZoomAndPan { factory ViewElement() => _SvgElementFactoryProvider.createSvgElement_tag("view") as ViewElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - ViewElement.created() : super.created(); // From SVGFitToViewBox @@ -4064,12 +3656,6 @@ class _GradientElement extends SvgElement implements UriReference { factory _GradientElement._() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - _GradientElement.created() : super.created(); static const int SVG_SPREADMETHOD_PAD = 1; @@ -4100,12 +3686,6 @@ abstract class _SVGComponentTransferFunctionElement extends SvgElement { factory _SVGComponentTransferFunctionElement._() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - _SVGComponentTransferFunctionElement.created() : super.created(); } // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a @@ -4118,12 +3698,6 @@ abstract class _SVGFEDropShadowElement extends SvgElement factory _SVGFEDropShadowElement._() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - _SVGFEDropShadowElement.created() : super.created(); // From SVGFilterPrimitiveStandardAttributes } @@ -4142,12 +3716,6 @@ abstract class _SVGMPathElement extends SvgElement implements UriReference { factory _SVGMPathElement() => _SvgElementFactoryProvider.createSvgElement_tag("mpath") as _SVGMPathElement; - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - _SVGMPathElement.created() : super.created(); // From SVGURIReference } diff --git a/tests/co19/co19-co19.status b/tests/co19/co19-co19.status index 64db75ace7b..b10af3f5862 100644 --- a/tests/co19/co19-co19.status +++ b/tests/co19/co19-co19.status @@ -1,3 +1,5 @@ # Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. + +LibTest/html/IFrameElement/attributeChanged_A01_t01: SkipByDesign # uses deprecated custom element constructors, see https://github.com/dart-lang/sdk/issues/53264 diff --git a/tools/dom/scripts/systemhtml.py b/tools/dom/scripts/systemhtml.py index f1d801f83ea..6508f375297 100644 --- a/tools/dom/scripts/systemhtml.py +++ b/tools/dom/scripts/systemhtml.py @@ -858,11 +858,6 @@ class HtmlDartInterfaceGenerator(object): factory_constructor_name, class_members_emitter) - isElement = False - for parent in self._database.Hierarchy(self._interface): - if parent.id == 'Element': - isElement = True - # Write out the JsInterop code. if (implementation_members_emitter and self._options.templates._conditions['DARTIUM'] and @@ -870,16 +865,6 @@ class HtmlDartInterfaceGenerator(object): not IsPureInterface(self._interface.id, self._database)): implementation_members_emitter.Emit(js_interop_wrapper) - if isElement and self._interface.id != 'Element': - implementation_members_emitter.Emit( - ' /**\n' - ' * Constructor instantiated by the DOM when a custom element has been created.\n' - ' *\n' - ' * This can only be called by subclasses from their created constructor.\n' - ' */\n' - ' $CLASSNAME.created() : super.created();\n', - CLASSNAME=self._interface_type_info.implementation_name()) - self._backend.EmitSupportCheck() merged_interface = self._interface_type_info.merged_interface() diff --git a/tools/dom/templates/html/dart2js/html_dart2js.darttemplate b/tools/dom/templates/html/dart2js/html_dart2js.darttemplate index e2947591f74..3ae58f7aabc 100644 --- a/tools/dom/templates/html/dart2js/html_dart2js.darttemplate +++ b/tools/dom/templates/html/dart2js/html_dart2js.darttemplate @@ -130,13 +130,6 @@ Future$NULLABLE> promiseToFutureAsMap(jsPromise) => class HtmlElement extends Element implements NoncedElement { factory HtmlElement() { throw new UnsupportedError("Not supported"); } - /** - * Constructor instantiated by the DOM when a custom element has been created. - * - * This can only be called by subclasses from their created constructor. - */ - HtmlElement.created() : super.created(); - // From NoncedElement String$NULLABLE get nonce native; set nonce(String$NULLABLE value) native; diff --git a/tools/dom/templates/html/impl/impl_Element.darttemplate b/tools/dom/templates/html/impl/impl_Element.darttemplate index 9aaaf8b6d84..be3ca6a9001 100644 --- a/tools/dom/templates/html/impl/impl_Element.darttemplate +++ b/tools/dom/templates/html/impl/impl_Element.darttemplate @@ -372,24 +372,6 @@ $(ANNOTATIONS)$(NATIVESPEC)class $CLASSNAME$EXTENDS$IMPLEMENTS { return fragment.nodes.where((e) => e is Element).single $#NULLSAFECAST(as Element); } - /** - * Custom element creation constructor. - * - * This constructor is used by the DOM when a custom element has been - * created. It can only be invoked by subclasses of Element from - * that classes created constructor. - * - * class CustomElement extends Element { - * factory CustomElement() => new Element.tag('x-custom'); - * - * CustomElement.created() : super.created() { - * // Perform any element initialization. - * } - * } - * document.registerElement('x-custom', CustomElement); - */ - Element.created() : super._created(); - /** * Creates the HTML element specified by the tag name. * diff --git a/tools/dom/templates/html/impl/impl_EventTarget.darttemplate b/tools/dom/templates/html/impl/impl_EventTarget.darttemplate index 2026d53b203..1c89ef5ac08 100644 --- a/tools/dom/templates/html/impl/impl_EventTarget.darttemplate +++ b/tools/dom/templates/html/impl/impl_EventTarget.darttemplate @@ -90,8 +90,44 @@ class ElementEvents extends Events { */ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS { - // Custom element created callback. - EventTarget._created(); + // A private constructor to act as super-constructor for mixin-applications. + // + // The `dart:html` library predates the class modifiers feature, and it + // effectively seals many of its classes by using private and factory + // constructors. This allows the classes to be extended within the library, + // but seals them to code outside the SDK. + // + // Currently a mixin application on a class with no generative constructors + // will get a default constructor which tries to forward to the unnamed + // constructor of the superclass. That superclass constructor either doesn't + // exist or is not generative, so that's always an invalid default constructor. + // + // For now, this makes sure that the class has a private generative + // constructor that a mixin application *inside this library* can forward to, + // to avoid getting an invalid default constructor. + // + // Here is a simple example to illustrate the kind of error this constructor + // prevents: + // ``` + // class A { // Equivalent to `EventTarget` here + // // Adding A._unused(); fixes the errors below + // factory A._() => throw ''; + // } + // + // abstract mixin class M { + // get y; + // } + // + // abstract class B extends A with M { + // // ^ Error because A&M's default constructor needs a + // // superclass constructor to forward to. + // factory B._() => throw ''; + // + // @override + // get y => 3; + // } + // ``` + EventTarget._unused(); /** * This is an ease-of-use accessor for event streams which should only be diff --git a/tools/dom/templates/html/impl/impl_Node.darttemplate b/tools/dom/templates/html/impl/impl_Node.darttemplate index 5fdb97217b4..e7dd908ac15 100644 --- a/tools/dom/templates/html/impl/impl_Node.darttemplate +++ b/tools/dom/templates/html/impl/impl_Node.darttemplate @@ -176,9 +176,6 @@ class _ChildNodeListLazy extends ListBase implements NodeListWrapper { $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS { - // Custom element created callback. - Node._created() : super._created(); - /** * A modifiable list of this node's children. */