From a93a093b3f84857e0d226632601e7a26e4a34e99 Mon Sep 17 00:00:00 2001 From: Srujan Gaddam Date: Fri, 23 Feb 2024 09:20:12 -0800 Subject: [PATCH 1/7] Add generation code for Element constructors For every tag that the interface supports, emits a Dart constructor that can be used to create an element of that tag using either createElement or createElementNS. Adds a dependency to @webref/elements to fetch the element data. Note that not every element interface has a tag associated with it. --- README.md | 3 +- tool/generator/banned_names.dart | 15 +++- tool/generator/generate_bindings.dart | 28 ++++++- tool/generator/main.mjs | 12 +-- tool/generator/package-lock.json | 6 ++ tool/generator/package.json | 3 +- tool/generator/translator.dart | 104 +++++++++++++++++------- tool/generator/webidl_api.dart | 5 ++ tool/generator/webref_elements_api.dart | 35 ++++++++ tool/update_bindings.dart | 9 +- 10 files changed, 178 insertions(+), 42 deletions(-) create mode 100644 tool/generator/webref_elements_api.dart diff --git a/README.md b/README.md index 63ddf670..8d6a67f2 100644 --- a/README.md +++ b/README.md @@ -65,8 +65,9 @@ definitions: Based on: -- @webref/idl [3.43.1](https://www.npmjs.com/package/@webref/idl/v/3.43.1) - @webref/css [6.11.0](https://www.npmjs.com/package/@webref/css/v/6.11.0) +- @webref/elements [2.2.2](https://www.npmjs.com/package/@webref/elements/v/2.2.2) +- @webref/idl [3.43.1](https://www.npmjs.com/package/@webref/idl/v/3.43.1) For instructions on re-generating the DOM bindings, see the diff --git a/tool/generator/banned_names.dart b/tool/generator/banned_names.dart index 41193501..e6e2d0ee 100644 --- a/tool/generator/banned_names.dart +++ b/tool/generator/banned_names.dart @@ -4,10 +4,21 @@ const bannedNames = { 'assert', + 'break', 'continue', + 'extends', 'default', 'in', 'is', - 'extends', - 'break', + 'var', }; + +/// Given a [jsName], returns the allowed Dart equivalent accounting for invalid +/// characters and reserved keywords. +String dartRename(String jsName) { + var dartName = jsName.replaceAll('-', '_'); + if (bannedNames.contains(dartName)) { + dartName = '${dartName}_'; + } + return dartName; +} diff --git a/tool/generator/generate_bindings.dart b/tool/generator/generate_bindings.dart index a2f2f308..e8de011e 100644 --- a/tool/generator/generate_bindings.dart +++ b/tool/generator/generate_bindings.dart @@ -8,6 +8,7 @@ import 'translator.dart'; import 'util.dart'; import 'webidl_api.dart' as webidl; import 'webref_css_api.dart'; +import 'webref_elements_api.dart'; import 'webref_idl_api.dart'; /// Generate CSS property names for setting / getting CSS properties in JS. @@ -45,11 +46,34 @@ Future> _generateCSSStyleDeclarations() async { return cssStyleDeclarations.toList()..sort(); } +/// Parse the elements spec and construct a map of element interfaces to the +/// tag names that correspond to the interface. +Future>> _generateElementTagMap() async { + final elementMap = >{}; + final array = objectEntries(await elements.listAll().toDart); + for (var i = 0; i < array.length; i++) { + final entry = array[i] as JSArray; + final data = entry[1] as ElementsEntries; + final elements = data.elements; + if (elements != null) { + for (var j = 0; j < elements.length; j++) { + final element = elements[j]; + final tag = element.name; + final interface = element.interface; + if (tag == null || interface == null) continue; + elementMap.putIfAbsent(interface, () => {}).add(tag); + } + } + } + return elementMap; +} + Future generateBindings( String packageRoot, String librarySubDir) async { final cssStyleDeclarations = await _generateCSSStyleDeclarations(); - final translator = - Translator(packageRoot, librarySubDir, cssStyleDeclarations); + final elementHTMLMap = await _generateElementTagMap(); + final translator = Translator( + packageRoot, librarySubDir, cssStyleDeclarations, elementHTMLMap); final array = objectEntries(await idl.parseAll().toDart); for (var i = 0; i < array.length; i++) { final entry = array[i] as JSArray; diff --git a/tool/generator/main.mjs b/tool/generator/main.mjs index 4d7c8d04..b60821e7 100644 --- a/tool/generator/main.mjs +++ b/tool/generator/main.mjs @@ -2,11 +2,12 @@ // 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 * as fs from 'fs'; import * as childProcess from 'child_process'; +import * as fs from 'fs'; import { createRequire } from 'module'; -import * as idl from '@webref/idl'; import * as css from '@webref/css'; +import * as elements from '@webref/elements'; +import * as idl from '@webref/idl'; const require = createRequire(import.meta.url); @@ -14,11 +15,12 @@ const require = createRequire(import.meta.url); globalThis.self = globalThis; globalThis.childProcess = childProcess; globalThis.css = css; -globalThis.idl = idl; +globalThis.elements = elements; globalThis.fs = fs; -globalThis.location = { href: `file://${process.cwd()}/`} +globalThis.idl = idl; +globalThis.location = { href: `file://${process.cwd()}/` } -globalThis.dartMainRunner = async function(main, args) { +globalThis.dartMainRunner = async function (main, args) { const dir = process.argv[2]; await main(dir); } diff --git a/tool/generator/package-lock.json b/tool/generator/package-lock.json index 80ec4eb0..890d85f0 100644 --- a/tool/generator/package-lock.json +++ b/tool/generator/package-lock.json @@ -11,6 +11,7 @@ "dependencies": { "@mdn/browser-compat-data": "^5.5.2", "@webref/css": "^6.11.0", + "@webref/elements": "^2.2.2", "@webref/idl": "^3.43.1" }, "devDependencies": { @@ -30,6 +31,11 @@ "css-tree": "^2.3.1" } }, + "node_modules/@webref/elements": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/@webref/elements/-/elements-2.2.2.tgz", + "integrity": "sha512-gl6IaktIBI8xufIFozMKGjqlvRty1iZ4EuD+ksSKir6MV8Qkc1Sxy36FCbAmmyoUx6ODGFXCGu06hJJ2V+/tlg==" + }, "node_modules/@webref/idl": { "version": "3.43.1", "resolved": "https://registry.npmjs.org/@webref/idl/-/idl-3.43.1.tgz", diff --git a/tool/generator/package.json b/tool/generator/package.json index 13a71f23..a3049889 100644 --- a/tool/generator/package.json +++ b/tool/generator/package.json @@ -11,9 +11,10 @@ "dependencies": { "@mdn/browser-compat-data": "^5.5.2", "@webref/css": "^6.11.0", + "@webref/elements": "^2.2.2", "@webref/idl": "^3.43.1" }, "devDependencies": { "webidl2": "^24.2.2" } -} +} \ No newline at end of file diff --git a/tool/generator/translator.dart b/tool/generator/translator.dart index 94ce9439..8beadda8 100644 --- a/tool/generator/translator.dart +++ b/tool/generator/translator.dart @@ -14,6 +14,7 @@ import 'type_aliases.dart'; import 'type_union.dart'; import 'util.dart'; import 'webidl_api.dart' as idl; +import 'webref_elements_api.dart'; typedef TranslationResult = Map; @@ -368,6 +369,7 @@ class _PartialInterfacelike { switch (type) { case 'constructor': final idlConstructor = member as idl.Constructor; + if (_hasHTMLConstructorAttribute(idlConstructor)) continue; if (constructor == null) { constructor = _OverridableConstructor(idlConstructor); } else { @@ -451,6 +453,13 @@ class _PartialInterfacelike { inheritance ??= interfacelike.inheritance; _processMembers(interfacelike.members); } + + // Constructors with the attribute `HTMLConstructor` are intended for custom + // element behavior, and are not useful otherwise, so avoid emitting them. + // https://html.spec.whatwg.org/#html-element-constructors + bool _hasHTMLConstructorAttribute(idl.Constructor constructor) => + constructor.extAttrs.toDart + .any((extAttr) => extAttr.name == 'HTMLConstructor'); } class _MemberName { @@ -460,11 +469,9 @@ class _MemberName { _MemberName._(this.name, this.jsOverride); factory _MemberName(String name, [String jsOverride = '']) { - if (bannedNames.contains(name)) { - if (jsOverride.isEmpty) jsOverride = name; - name = '${name}_'; - } - return _MemberName._(name, jsOverride); + final rename = dartRename(name); + if (rename != name && jsOverride.isEmpty) jsOverride = name; + return _MemberName._(rename, jsOverride); } } @@ -472,6 +479,7 @@ class Translator { final String packageRoot; final String _librarySubDir; final List _cssStyleDeclarations; + final Map> _elementTagMap; final _libraries = {}; final _typeToDeclaration = {}; @@ -485,8 +493,8 @@ class Translator { /// Singleton so that various helper methods can access info about the AST. static Translator? instance; - Translator( - this.packageRoot, this._librarySubDir, this._cssStyleDeclarations) { + Translator(this.packageRoot, this._librarySubDir, this._cssStyleDeclarations, + this._elementTagMap) { instance = this; browserCompatData = BrowserCompatData.read(); } @@ -561,14 +569,6 @@ class Translator { ..name = getterName ..type = code.MethodType.getter); - String _parameterName(String name) { - if (bannedNames.contains(name)) { - return '${name}_'; - } else { - return name; - } - } - // Given a raw type, convert it to the Dart type that will be emitted by the // translator. // @@ -619,6 +619,17 @@ class Translator { typeArguments .add(_typeReference(typeParameter, onlyEmitInteropTypes: true)); } + final url = _urlForType(dartType); + return code.TypeReference((b) => b + ..symbol = dartType + ..isNullable = nullable + ..types.addAll(typeArguments) + ..url = url); + } + + // Given a [dartType] that is part of a reference, returns the url that needs + // to be imported to use it, if any. + String? _urlForType(String dartType) { // Unfortunately, `code_builder` doesn't know the url of the library we are // emitting, so we have to remove it here to avoid importing ourselves. var url = _typeToLibrary[dartType]?.url; @@ -634,11 +645,7 @@ class Translator { } else if (p.dirname(url) == p.dirname(_currentlyTranslatingUrl)) { url = p.basename(url); } - return code.TypeReference((b) => b - ..symbol = dartType - ..isNullable = nullable - ..types.addAll(typeArguments) - ..url = url); + return url; } code.TypeReference _idlTypeToTypeReference(idl.IDLType idlType) => @@ -656,7 +663,7 @@ class Translator { final optionalParameters = []; for (final rawParameter in member.parameters) { final parameter = code.Parameter((b) => b - ..name = _parameterName(rawParameter.name) + ..name = dartRename(rawParameter.name) ..type = _typeToTypeReference(rawParameter.type)); if (rawParameter.isOptional) { optionalParameters.add(parameter); @@ -688,7 +695,7 @@ class Translator { final field = member as idl.Field; final isRequired = field.required; final parameter = code.Parameter((b) => b - ..name = _parameterName(field.name) + ..name = dartRename(field.name) ..type = _idlTypeToTypeReference(field.idlType) ..required = isRequired ..named = true); @@ -821,6 +828,44 @@ class Translator { readOnly: false), ]; + // If [jsName] is an element type, creates a constructor for each tag that the + // element interface corresponds to using either `createElement` or + // `createElementNS`. + List _elementConstructors( + String jsName, String dartClassName, String representationFieldName) { + final elementConstructors = []; + final tags = _elementTagMap[jsName]; + if (tags != null) { + final uri = uriForElement(jsName); + assert(tags.isNotEmpty); + final createElementMethod = + uri != null ? 'createElementNS' : 'createElement'; + for (final tag in tags) { + elementConstructors.add(code.Constructor((b) => b + ..docs.addAll( + ["/// Creates a(n) [$dartClassName] using the tag '$tag'."]) + // If there are multiple tags, use a named constructor. + ..name = tags.length == 1 ? null : dartRename(tag) + ..initializers.addAll([ + code + .refer(representationFieldName) + .assign(code + .refer('document', _urlForType('Document')) + .property(createElementMethod) + .call([ + // TODO(srujzs): Should we make these URIs a constant and + // refer to the constant instead? Downside is that it requires + // another manual hack to generate them. + if (uri != null) code.literalString(uri), + code.literalString(tag) + ])) + .code + ]))); + } + } + return elementConstructors; + } + code.Extension _extension( {required _RawType type, required List extensionMembers}) => @@ -842,22 +887,25 @@ class Translator { required bool isObjectLiteral, }) { final jsObject = _typeReference(_RawType('JSObject', false)); + const representationFieldName = '_'; return code.ExtensionType((b) => b ..annotations.addAll( _jsOverride(isObjectLiteral || jsName == dartClassName ? '' : jsName)) ..name = dartClassName ..primaryConstructorName = '_' ..representationDeclaration = code.RepresentationDeclaration((b) => b - ..name = '_' + ..name = representationFieldName ..declaredRepresentationType = jsObject) ..implements.addAll(implements .map((interface) => _typeReference(_RawType(interface, false))) .followedBy([jsObject])) - ..constructors.addAll(isObjectLiteral - ? [_objectLiteral(members)] - : constructor != null - ? [_constructor(constructor)] - : []) + ..constructors.addAll((isObjectLiteral + ? [_objectLiteral(members)] + : constructor != null + ? [_constructor(constructor)] + : []) + .followedBy(_elementConstructors( + jsName, dartClassName, representationFieldName))) ..methods.addAll(_operations(staticOperations) .followedBy(_members(staticMembers)) .followedBy(_operations(operations)) diff --git a/tool/generator/webidl_api.dart b/tool/generator/webidl_api.dart index f467a642..9b99271d 100644 --- a/tool/generator/webidl_api.dart +++ b/tool/generator/webidl_api.dart @@ -61,6 +61,11 @@ extension type Includes._(JSObject _) implements Node { /// All members inherit from the [Member] node. extension type Member._(JSObject _) implements JSObject { external String get type; + external JSArray get extAttrs; +} + +extension type ExtendedAttribute._(JSObject _) implements JSObject { + external String get name; } extension type Argument._(JSObject _) implements JSObject { diff --git a/tool/generator/webref_elements_api.dart b/tool/generator/webref_elements_api.dart new file mode 100644 index 00000000..1101cbcc --- /dev/null +++ b/tool/generator/webref_elements_api.dart @@ -0,0 +1,35 @@ +// Copyright (c) 2024, 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:js_interop'; + +// Namespace URIs that are needed to construct non-HTML elements. +// https://developer.mozilla.org/en-US/docs/Web/API/Document/createElementNS#important_namespace_uris +const _svgNamespaceURI = 'http://www.w3.org/2000/svg'; +const _mathMLNamespaceURI = 'http://www.w3.org/1998/Math/MathML'; + +// Gets the URI needed to create an element of type [elementInterface]. +String? uriForElement(String elementInterface) { + if (elementInterface.startsWith('SVG')) return _svgNamespaceURI; + if (elementInterface.startsWith('MathML')) return _mathMLNamespaceURI; + // URI is not needed for HTML elements as they can just use `createElement`. + assert(elementInterface.startsWith('HTML')); + return null; +} + +@JS() +external WebRefElements get elements; + +extension type WebRefElements._(JSObject _) implements JSObject { + external JSPromise listAll(); +} + +extension type ElementsEntries._(JSObject _) implements JSObject { + external JSArray? elements; +} + +extension type ElementEntry._(JSObject _) implements JSObject { + external String? get name; + external String? get interface; +} diff --git a/tool/update_bindings.dart b/tool/update_bindings.dart index a6001b0d..eee51d4b 100644 --- a/tool/update_bindings.dart +++ b/tool/update_bindings.dart @@ -98,12 +98,14 @@ $_usage'''); final sourceContent = readmeFile.readAsStringSync(); - final idlVersion = _packageLockVersion(_webRefIdl); final cssVersion = _packageLockVersion(_webRefCss); + final elementsVersion = _packageLockVersion(_webRefElements); + final idlVersion = _packageLockVersion(_webRefIdl); final versions = ''' $_startComment -- $_webRefIdl [$idlVersion](https://www.npmjs.com/package/$_webRefIdl/v/$idlVersion) - $_webRefCss [$cssVersion](https://www.npmjs.com/package/$_webRefCss/v/$cssVersion) +- $_webRefElements [$elementsVersion](https://www.npmjs.com/package/$_webRefElements/v/$elementsVersion) +- $_webRefIdl [$idlVersion](https://www.npmjs.com/package/$_webRefIdl/v/$idlVersion) '''; final newContent = @@ -131,8 +133,9 @@ String _packageLockVersion(String package) { final _bindingsGeneratorPath = p.join('tool', 'generator'); -const _webRefIdl = '@webref/idl'; const _webRefCss = '@webref/css'; +const _webRefElements = '@webref/elements'; +const _webRefIdl = '@webref/idl'; const _thisScript = 'tool/update_bindings.dart'; From 0a52242ebb8c97c065e326fe3dc3bcdcdd24a3d3 Mon Sep 17 00:00:00 2001 From: Srujan Gaddam Date: Fri, 23 Feb 2024 14:57:16 -0800 Subject: [PATCH 2/7] Generate new Element constructors Adds a test and modifies existing helper messages to point to the new constructors instead. Also deprecates createAudioElement. As we remove some members that don't work, and this deprecation is a breaking change, we update the major version number. --- CHANGELOG.md | 6 +- lib/src/dom/css_masking.dart | 15 ++ lib/src/dom/filter_effects.dart | 191 +++++++++++++- lib/src/dom/html.dart | 425 ++++++++++++++++++++++++++------ lib/src/dom/mathml_core.dart | 210 ++++++++++++++++ lib/src/dom/svg.dart | 228 ++++++++++++++++- lib/src/dom/svg_animations.dart | 43 +++- lib/src/helpers.dart | 10 +- pubspec.yaml | 2 +- 9 files changed, 1038 insertions(+), 92 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a6dcdcd9..a2b6c928 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ -## 0.5.1-wip +## 0.6.0-wip - Add [`TrustedTypes`](https://web.dev/trusted-types) members. +- Add a constructor for each Element tag onto their respective Element + interfaces. +- Remove `external` Element constructors that would result in a runtime error. +- Deprecate `createAudioElement` in favor of the `HTMLAudioElement` constructor. ## 0.5.0 diff --git a/lib/src/dom/css_masking.dart b/lib/src/dom/css_masking.dart index 172e4139..4cb33751 100644 --- a/lib/src/dom/css_masking.dart +++ b/lib/src/dom/css_masking.dart @@ -9,14 +9,29 @@ library; import 'dart:js_interop'; +import 'dom.dart'; import 'svg.dart'; extension type SVGClipPathElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGClipPathElement] using the tag 'clipPath'. + SVGClipPathElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'clipPath', + ); + external SVGAnimatedEnumeration get clipPathUnits; external SVGAnimatedTransformList get transform; } extension type SVGMaskElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGMaskElement] using the tag 'mask'. + SVGMaskElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'mask', + ); + external SVGAnimatedEnumeration get maskUnits; external SVGAnimatedEnumeration get maskContentUnits; external SVGAnimatedLength get x; diff --git a/lib/src/dom/filter_effects.dart b/lib/src/dom/filter_effects.dart index db1ba30f..22e3e09b 100644 --- a/lib/src/dom/filter_effects.dart +++ b/lib/src/dom/filter_effects.dart @@ -9,9 +9,17 @@ library; import 'dart:js_interop'; +import 'dom.dart'; import 'svg.dart'; extension type SVGFilterElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGFilterElement] using the tag 'filter'. + SVGFilterElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'filter', + ); + external SVGAnimatedEnumeration get filterUnits; external SVGAnimatedEnumeration get primitiveUnits; external SVGAnimatedLength get x; @@ -21,6 +29,13 @@ extension type SVGFilterElement._(JSObject _) implements SVGElement, JSObject { external SVGAnimatedString get href; } extension type SVGFEBlendElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGFEBlendElement] using the tag 'feBlend'. + SVGFEBlendElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'feBlend', + ); + external static int get SVG_FEBLEND_MODE_UNKNOWN; external static int get SVG_FEBLEND_MODE_NORMAL; external static int get SVG_FEBLEND_MODE_MULTIPLY; @@ -49,6 +64,13 @@ extension type SVGFEBlendElement._(JSObject _) implements SVGElement, JSObject { } extension type SVGFEColorMatrixElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGFEColorMatrixElement] using the tag 'feColorMatrix'. + SVGFEColorMatrixElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'feColorMatrix', + ); + external static int get SVG_FECOLORMATRIX_TYPE_UNKNOWN; external static int get SVG_FECOLORMATRIX_TYPE_MATRIX; external static int get SVG_FECOLORMATRIX_TYPE_SATURATE; @@ -65,6 +87,13 @@ extension type SVGFEColorMatrixElement._(JSObject _) } extension type SVGFEComponentTransferElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGFEComponentTransferElement] using the tag 'feComponentTransfer'. + SVGFEComponentTransferElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'feComponentTransfer', + ); + external SVGAnimatedString get in1; external SVGAnimatedLength get x; external SVGAnimatedLength get y; @@ -89,15 +118,50 @@ extension type SVGComponentTransferFunctionElement._(JSObject _) external SVGAnimatedNumber get offset; } extension type SVGFEFuncRElement._(JSObject _) - implements SVGComponentTransferFunctionElement, JSObject {} + implements SVGComponentTransferFunctionElement, JSObject { + /// Creates a(n) [SVGFEFuncRElement] using the tag 'feFuncR'. + SVGFEFuncRElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'feFuncR', + ); +} extension type SVGFEFuncGElement._(JSObject _) - implements SVGComponentTransferFunctionElement, JSObject {} + implements SVGComponentTransferFunctionElement, JSObject { + /// Creates a(n) [SVGFEFuncGElement] using the tag 'feFuncG'. + SVGFEFuncGElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'feFuncG', + ); +} extension type SVGFEFuncBElement._(JSObject _) - implements SVGComponentTransferFunctionElement, JSObject {} + implements SVGComponentTransferFunctionElement, JSObject { + /// Creates a(n) [SVGFEFuncBElement] using the tag 'feFuncB'. + SVGFEFuncBElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'feFuncB', + ); +} extension type SVGFEFuncAElement._(JSObject _) - implements SVGComponentTransferFunctionElement, JSObject {} + implements SVGComponentTransferFunctionElement, JSObject { + /// Creates a(n) [SVGFEFuncAElement] using the tag 'feFuncA'. + SVGFEFuncAElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'feFuncA', + ); +} extension type SVGFECompositeElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGFECompositeElement] using the tag 'feComposite'. + SVGFECompositeElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'feComposite', + ); + external static int get SVG_FECOMPOSITE_OPERATOR_UNKNOWN; external static int get SVG_FECOMPOSITE_OPERATOR_OVER; external static int get SVG_FECOMPOSITE_OPERATOR_IN; @@ -120,6 +184,13 @@ extension type SVGFECompositeElement._(JSObject _) } extension type SVGFEConvolveMatrixElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGFEConvolveMatrixElement] using the tag 'feConvolveMatrix'. + SVGFEConvolveMatrixElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'feConvolveMatrix', + ); + external static int get SVG_EDGEMODE_UNKNOWN; external static int get SVG_EDGEMODE_DUPLICATE; external static int get SVG_EDGEMODE_WRAP; @@ -144,6 +215,13 @@ extension type SVGFEConvolveMatrixElement._(JSObject _) } extension type SVGFEDiffuseLightingElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGFEDiffuseLightingElement] using the tag 'feDiffuseLighting'. + SVGFEDiffuseLightingElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'feDiffuseLighting', + ); + external SVGAnimatedString get in1; external SVGAnimatedNumber get surfaceScale; external SVGAnimatedNumber get diffuseConstant; @@ -157,17 +235,38 @@ extension type SVGFEDiffuseLightingElement._(JSObject _) } extension type SVGFEDistantLightElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGFEDistantLightElement] using the tag 'feDistantLight'. + SVGFEDistantLightElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'feDistantLight', + ); + external SVGAnimatedNumber get azimuth; external SVGAnimatedNumber get elevation; } extension type SVGFEPointLightElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGFEPointLightElement] using the tag 'fePointLight'. + SVGFEPointLightElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'fePointLight', + ); + external SVGAnimatedNumber get x; external SVGAnimatedNumber get y; external SVGAnimatedNumber get z; } extension type SVGFESpotLightElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGFESpotLightElement] using the tag 'feSpotLight'. + SVGFESpotLightElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'feSpotLight', + ); + external SVGAnimatedNumber get x; external SVGAnimatedNumber get y; external SVGAnimatedNumber get z; @@ -179,6 +278,13 @@ extension type SVGFESpotLightElement._(JSObject _) } extension type SVGFEDisplacementMapElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGFEDisplacementMapElement] using the tag 'feDisplacementMap'. + SVGFEDisplacementMapElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'feDisplacementMap', + ); + external static int get SVG_CHANNEL_UNKNOWN; external static int get SVG_CHANNEL_R; external static int get SVG_CHANNEL_G; @@ -197,6 +303,13 @@ extension type SVGFEDisplacementMapElement._(JSObject _) } extension type SVGFEDropShadowElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGFEDropShadowElement] using the tag 'feDropShadow'. + SVGFEDropShadowElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'feDropShadow', + ); + external void setStdDeviation( num stdDeviationX, num stdDeviationY, @@ -213,6 +326,13 @@ extension type SVGFEDropShadowElement._(JSObject _) external SVGAnimatedString get result; } extension type SVGFEFloodElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGFEFloodElement] using the tag 'feFlood'. + SVGFEFloodElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'feFlood', + ); + external SVGAnimatedLength get x; external SVGAnimatedLength get y; external SVGAnimatedLength get width; @@ -221,6 +341,13 @@ extension type SVGFEFloodElement._(JSObject _) implements SVGElement, JSObject { } extension type SVGFEGaussianBlurElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGFEGaussianBlurElement] using the tag 'feGaussianBlur'. + SVGFEGaussianBlurElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'feGaussianBlur', + ); + external static int get SVG_EDGEMODE_UNKNOWN; external static int get SVG_EDGEMODE_DUPLICATE; external static int get SVG_EDGEMODE_WRAP; @@ -240,6 +367,13 @@ extension type SVGFEGaussianBlurElement._(JSObject _) external SVGAnimatedString get result; } extension type SVGFEImageElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGFEImageElement] using the tag 'feImage'. + SVGFEImageElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'feImage', + ); + external SVGAnimatedPreserveAspectRatio get preserveAspectRatio; external SVGAnimatedString get crossOrigin; external SVGAnimatedLength get x; @@ -250,6 +384,13 @@ extension type SVGFEImageElement._(JSObject _) implements SVGElement, JSObject { external SVGAnimatedString get href; } extension type SVGFEMergeElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGFEMergeElement] using the tag 'feMerge'. + SVGFEMergeElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'feMerge', + ); + external SVGAnimatedLength get x; external SVGAnimatedLength get y; external SVGAnimatedLength get width; @@ -258,10 +399,24 @@ extension type SVGFEMergeElement._(JSObject _) implements SVGElement, JSObject { } extension type SVGFEMergeNodeElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGFEMergeNodeElement] using the tag 'feMergeNode'. + SVGFEMergeNodeElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'feMergeNode', + ); + external SVGAnimatedString get in1; } extension type SVGFEMorphologyElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGFEMorphologyElement] using the tag 'feMorphology'. + SVGFEMorphologyElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'feMorphology', + ); + external static int get SVG_MORPHOLOGY_OPERATOR_UNKNOWN; external static int get SVG_MORPHOLOGY_OPERATOR_ERODE; external static int get SVG_MORPHOLOGY_OPERATOR_DILATE; @@ -277,6 +432,13 @@ extension type SVGFEMorphologyElement._(JSObject _) } extension type SVGFEOffsetElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGFEOffsetElement] using the tag 'feOffset'. + SVGFEOffsetElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'feOffset', + ); + external SVGAnimatedString get in1; external SVGAnimatedNumber get dx; external SVGAnimatedNumber get dy; @@ -288,6 +450,13 @@ extension type SVGFEOffsetElement._(JSObject _) } extension type SVGFESpecularLightingElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGFESpecularLightingElement] using the tag 'feSpecularLighting'. + SVGFESpecularLightingElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'feSpecularLighting', + ); + external SVGAnimatedString get in1; external SVGAnimatedNumber get surfaceScale; external SVGAnimatedNumber get specularConstant; @@ -301,6 +470,13 @@ extension type SVGFESpecularLightingElement._(JSObject _) external SVGAnimatedString get result; } extension type SVGFETileElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGFETileElement] using the tag 'feTile'. + SVGFETileElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'feTile', + ); + external SVGAnimatedString get in1; external SVGAnimatedLength get x; external SVGAnimatedLength get y; @@ -310,6 +486,13 @@ extension type SVGFETileElement._(JSObject _) implements SVGElement, JSObject { } extension type SVGFETurbulenceElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGFETurbulenceElement] using the tag 'feTurbulence'. + SVGFETurbulenceElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'feTurbulence', + ); + external static int get SVG_TURBULENCE_TYPE_UNKNOWN; external static int get SVG_TURBULENCE_TYPE_FRACTALNOISE; external static int get SVG_TURBULENCE_TYPE_TURBULENCE; diff --git a/lib/src/dom/html.dart b/lib/src/dom/html.dart index f3fd6edb..d06ca84c 100644 --- a/lib/src/dom/html.dart +++ b/lib/src/dom/html.dart @@ -127,7 +127,161 @@ extension type DOMStringList._(JSObject _) implements JSObject { external int get length; } extension type HTMLElement._(JSObject _) implements Element, JSObject { - external factory HTMLElement(); + /// Creates a(n) [HTMLElement] using the tag 'article'. + HTMLElement.article() : _ = document.createElement('article'); + + /// Creates a(n) [HTMLElement] using the tag 'section'. + HTMLElement.section() : _ = document.createElement('section'); + + /// Creates a(n) [HTMLElement] using the tag 'nav'. + HTMLElement.nav() : _ = document.createElement('nav'); + + /// Creates a(n) [HTMLElement] using the tag 'aside'. + HTMLElement.aside() : _ = document.createElement('aside'); + + /// Creates a(n) [HTMLElement] using the tag 'hgroup'. + HTMLElement.hgroup() : _ = document.createElement('hgroup'); + + /// Creates a(n) [HTMLElement] using the tag 'header'. + HTMLElement.header() : _ = document.createElement('header'); + + /// Creates a(n) [HTMLElement] using the tag 'footer'. + HTMLElement.footer() : _ = document.createElement('footer'); + + /// Creates a(n) [HTMLElement] using the tag 'address'. + HTMLElement.address() : _ = document.createElement('address'); + + /// Creates a(n) [HTMLElement] using the tag 'dt'. + HTMLElement.dt() : _ = document.createElement('dt'); + + /// Creates a(n) [HTMLElement] using the tag 'dd'. + HTMLElement.dd() : _ = document.createElement('dd'); + + /// Creates a(n) [HTMLElement] using the tag 'figure'. + HTMLElement.figure() : _ = document.createElement('figure'); + + /// Creates a(n) [HTMLElement] using the tag 'figcaption'. + HTMLElement.figcaption() : _ = document.createElement('figcaption'); + + /// Creates a(n) [HTMLElement] using the tag 'main'. + HTMLElement.main() : _ = document.createElement('main'); + + /// Creates a(n) [HTMLElement] using the tag 'search'. + HTMLElement.search() : _ = document.createElement('search'); + + /// Creates a(n) [HTMLElement] using the tag 'em'. + HTMLElement.em() : _ = document.createElement('em'); + + /// Creates a(n) [HTMLElement] using the tag 'strong'. + HTMLElement.strong() : _ = document.createElement('strong'); + + /// Creates a(n) [HTMLElement] using the tag 'small'. + HTMLElement.small() : _ = document.createElement('small'); + + /// Creates a(n) [HTMLElement] using the tag 's'. + HTMLElement.s() : _ = document.createElement('s'); + + /// Creates a(n) [HTMLElement] using the tag 'cite'. + HTMLElement.cite() : _ = document.createElement('cite'); + + /// Creates a(n) [HTMLElement] using the tag 'dfn'. + HTMLElement.dfn() : _ = document.createElement('dfn'); + + /// Creates a(n) [HTMLElement] using the tag 'abbr'. + HTMLElement.abbr() : _ = document.createElement('abbr'); + + /// Creates a(n) [HTMLElement] using the tag 'ruby'. + HTMLElement.ruby() : _ = document.createElement('ruby'); + + /// Creates a(n) [HTMLElement] using the tag 'rt'. + HTMLElement.rt() : _ = document.createElement('rt'); + + /// Creates a(n) [HTMLElement] using the tag 'rp'. + HTMLElement.rp() : _ = document.createElement('rp'); + + /// Creates a(n) [HTMLElement] using the tag 'code'. + HTMLElement.code() : _ = document.createElement('code'); + + /// Creates a(n) [HTMLElement] using the tag 'var'. + HTMLElement.var_() : _ = document.createElement('var'); + + /// Creates a(n) [HTMLElement] using the tag 'samp'. + HTMLElement.samp() : _ = document.createElement('samp'); + + /// Creates a(n) [HTMLElement] using the tag 'kbd'. + HTMLElement.kbd() : _ = document.createElement('kbd'); + + /// Creates a(n) [HTMLElement] using the tag 'sub'. + HTMLElement.sub() : _ = document.createElement('sub'); + + /// Creates a(n) [HTMLElement] using the tag 'sup'. + HTMLElement.sup() : _ = document.createElement('sup'); + + /// Creates a(n) [HTMLElement] using the tag 'i'. + HTMLElement.i() : _ = document.createElement('i'); + + /// Creates a(n) [HTMLElement] using the tag 'b'. + HTMLElement.b() : _ = document.createElement('b'); + + /// Creates a(n) [HTMLElement] using the tag 'u'. + HTMLElement.u() : _ = document.createElement('u'); + + /// Creates a(n) [HTMLElement] using the tag 'mark'. + HTMLElement.mark() : _ = document.createElement('mark'); + + /// Creates a(n) [HTMLElement] using the tag 'bdi'. + HTMLElement.bdi() : _ = document.createElement('bdi'); + + /// Creates a(n) [HTMLElement] using the tag 'bdo'. + HTMLElement.bdo() : _ = document.createElement('bdo'); + + /// Creates a(n) [HTMLElement] using the tag 'wbr'. + HTMLElement.wbr() : _ = document.createElement('wbr'); + + /// Creates a(n) [HTMLElement] using the tag 'summary'. + HTMLElement.summary() : _ = document.createElement('summary'); + + /// Creates a(n) [HTMLElement] using the tag 'noscript'. + HTMLElement.noscript() : _ = document.createElement('noscript'); + + /// Creates a(n) [HTMLElement] using the tag 'acronym'. + HTMLElement.acronym() : _ = document.createElement('acronym'); + + /// Creates a(n) [HTMLElement] using the tag 'noframes'. + HTMLElement.noframes() : _ = document.createElement('noframes'); + + /// Creates a(n) [HTMLElement] using the tag 'menuitem'. + HTMLElement.menuitem() : _ = document.createElement('menuitem'); + + /// Creates a(n) [HTMLElement] using the tag 'noembed'. + HTMLElement.noembed() : _ = document.createElement('noembed'); + + /// Creates a(n) [HTMLElement] using the tag 'plaintext'. + HTMLElement.plaintext() : _ = document.createElement('plaintext'); + + /// Creates a(n) [HTMLElement] using the tag 'rb'. + HTMLElement.rb() : _ = document.createElement('rb'); + + /// Creates a(n) [HTMLElement] using the tag 'rtc'. + HTMLElement.rtc() : _ = document.createElement('rtc'); + + /// Creates a(n) [HTMLElement] using the tag 'strike'. + HTMLElement.strike() : _ = document.createElement('strike'); + + /// Creates a(n) [HTMLElement] using the tag 'basefont'. + HTMLElement.basefont() : _ = document.createElement('basefont'); + + /// Creates a(n) [HTMLElement] using the tag 'big'. + HTMLElement.big() : _ = document.createElement('big'); + + /// Creates a(n) [HTMLElement] using the tag 'center'. + HTMLElement.center() : _ = document.createElement('center'); + + /// Creates a(n) [HTMLElement] using the tag 'nobr'. + HTMLElement.nobr() : _ = document.createElement('nobr'); + + /// Creates a(n) [HTMLElement] using the tag 'tt'. + HTMLElement.tt() : _ = document.createElement('tt'); external void click(); external ElementInternals attachInternals(); @@ -386,25 +540,53 @@ extension type HTMLElement._(JSObject _) implements Element, JSObject { external int get tabIndex; } extension type HTMLUnknownElement._(JSObject _) - implements HTMLElement, JSObject {} + implements HTMLElement, JSObject { + /// Creates a(n) [HTMLUnknownElement] using the tag 'applet'. + HTMLUnknownElement.applet() : _ = document.createElement('applet'); + + /// Creates a(n) [HTMLUnknownElement] using the tag 'bgsound'. + HTMLUnknownElement.bgsound() : _ = document.createElement('bgsound'); + + /// Creates a(n) [HTMLUnknownElement] using the tag 'isindex'. + HTMLUnknownElement.isindex() : _ = document.createElement('isindex'); + + /// Creates a(n) [HTMLUnknownElement] using the tag 'keygen'. + HTMLUnknownElement.keygen() : _ = document.createElement('keygen'); + + /// Creates a(n) [HTMLUnknownElement] using the tag 'nextid'. + HTMLUnknownElement.nextid() : _ = document.createElement('nextid'); + + /// Creates a(n) [HTMLUnknownElement] using the tag 'blink'. + HTMLUnknownElement.blink() : _ = document.createElement('blink'); + + /// Creates a(n) [HTMLUnknownElement] using the tag 'multicol'. + HTMLUnknownElement.multicol() : _ = document.createElement('multicol'); + + /// Creates a(n) [HTMLUnknownElement] using the tag 'spacer'. + HTMLUnknownElement.spacer() : _ = document.createElement('spacer'); +} extension type DOMStringMap._(JSObject _) implements JSObject {} extension type HTMLHtmlElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLHtmlElement(); + /// Creates a(n) [HTMLHtmlElement] using the tag 'html'. + HTMLHtmlElement() : _ = document.createElement('html'); external set version(String value); external String get version; } extension type HTMLHeadElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLHeadElement(); + /// Creates a(n) [HTMLHeadElement] using the tag 'head'. + HTMLHeadElement() : _ = document.createElement('head'); } extension type HTMLTitleElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLTitleElement(); + /// Creates a(n) [HTMLTitleElement] using the tag 'title'. + HTMLTitleElement() : _ = document.createElement('title'); external set text(String value); external String get text; } extension type HTMLBaseElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLBaseElement(); + /// Creates a(n) [HTMLBaseElement] using the tag 'base'. + HTMLBaseElement() : _ = document.createElement('base'); external set href(String value); external String get href; @@ -412,7 +594,8 @@ extension type HTMLBaseElement._(JSObject _) implements HTMLElement, JSObject { external String get target; } extension type HTMLLinkElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLLinkElement(); + /// Creates a(n) [HTMLLinkElement] using the tag 'link'. + HTMLLinkElement() : _ = document.createElement('link'); external set href(String value); external String get href; @@ -452,7 +635,8 @@ extension type HTMLLinkElement._(JSObject _) implements HTMLElement, JSObject { external CSSStyleSheet? get sheet; } extension type HTMLMetaElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLMetaElement(); + /// Creates a(n) [HTMLMetaElement] using the tag 'meta'. + HTMLMetaElement() : _ = document.createElement('meta'); external set name(String value); external String get name; @@ -466,7 +650,8 @@ extension type HTMLMetaElement._(JSObject _) implements HTMLElement, JSObject { external String get scheme; } extension type HTMLStyleElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLStyleElement(); + /// Creates a(n) [HTMLStyleElement] using the tag 'style'. + HTMLStyleElement() : _ = document.createElement('style'); external set disabled(bool value); external bool get disabled; @@ -478,7 +663,8 @@ extension type HTMLStyleElement._(JSObject _) implements HTMLElement, JSObject { external CSSStyleSheet? get sheet; } extension type HTMLBodyElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLBodyElement(); + /// Creates a(n) [HTMLBodyElement] using the tag 'body'. + HTMLBodyElement() : _ = document.createElement('body'); external set text(String value); external String get text; @@ -533,20 +719,38 @@ extension type HTMLBodyElement._(JSObject _) implements HTMLElement, JSObject { } extension type HTMLHeadingElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLHeadingElement(); + /// Creates a(n) [HTMLHeadingElement] using the tag 'h1'. + HTMLHeadingElement.h1() : _ = document.createElement('h1'); + + /// Creates a(n) [HTMLHeadingElement] using the tag 'h2'. + HTMLHeadingElement.h2() : _ = document.createElement('h2'); + + /// Creates a(n) [HTMLHeadingElement] using the tag 'h3'. + HTMLHeadingElement.h3() : _ = document.createElement('h3'); + + /// Creates a(n) [HTMLHeadingElement] using the tag 'h4'. + HTMLHeadingElement.h4() : _ = document.createElement('h4'); + + /// Creates a(n) [HTMLHeadingElement] using the tag 'h5'. + HTMLHeadingElement.h5() : _ = document.createElement('h5'); + + /// Creates a(n) [HTMLHeadingElement] using the tag 'h6'. + HTMLHeadingElement.h6() : _ = document.createElement('h6'); external set align(String value); external String get align; } extension type HTMLParagraphElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLParagraphElement(); + /// Creates a(n) [HTMLParagraphElement] using the tag 'p'. + HTMLParagraphElement() : _ = document.createElement('p'); external set align(String value); external String get align; } extension type HTMLHRElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLHRElement(); + /// Creates a(n) [HTMLHRElement] using the tag 'hr'. + HTMLHRElement() : _ = document.createElement('hr'); external set align(String value); external String get align; @@ -560,19 +764,31 @@ extension type HTMLHRElement._(JSObject _) implements HTMLElement, JSObject { external String get width; } extension type HTMLPreElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLPreElement(); + /// Creates a(n) [HTMLPreElement] using the tag 'pre'. + HTMLPreElement.pre() : _ = document.createElement('pre'); + + /// Creates a(n) [HTMLPreElement] using the tag 'listing'. + HTMLPreElement.listing() : _ = document.createElement('listing'); + + /// Creates a(n) [HTMLPreElement] using the tag 'xmp'. + HTMLPreElement.xmp() : _ = document.createElement('xmp'); external set width(int value); external int get width; } extension type HTMLQuoteElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLQuoteElement(); + /// Creates a(n) [HTMLQuoteElement] using the tag 'blockquote'. + HTMLQuoteElement.blockquote() : _ = document.createElement('blockquote'); + + /// Creates a(n) [HTMLQuoteElement] using the tag 'q'. + HTMLQuoteElement.q() : _ = document.createElement('q'); external set cite(String value); external String get cite; } extension type HTMLOListElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLOListElement(); + /// Creates a(n) [HTMLOListElement] using the tag 'ol'. + HTMLOListElement() : _ = document.createElement('ol'); external set reversed(bool value); external bool get reversed; @@ -584,7 +800,8 @@ extension type HTMLOListElement._(JSObject _) implements HTMLElement, JSObject { external bool get compact; } extension type HTMLUListElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLUListElement(); + /// Creates a(n) [HTMLUListElement] using the tag 'ul'. + HTMLUListElement() : _ = document.createElement('ul'); external set compact(bool value); external bool get compact; @@ -592,13 +809,15 @@ extension type HTMLUListElement._(JSObject _) implements HTMLElement, JSObject { external String get type; } extension type HTMLMenuElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLMenuElement(); + /// Creates a(n) [HTMLMenuElement] using the tag 'menu'. + HTMLMenuElement() : _ = document.createElement('menu'); external set compact(bool value); external bool get compact; } extension type HTMLLIElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLLIElement(); + /// Creates a(n) [HTMLLIElement] using the tag 'li'. + HTMLLIElement() : _ = document.createElement('li'); external set value(int value); external int get value; @@ -606,20 +825,23 @@ extension type HTMLLIElement._(JSObject _) implements HTMLElement, JSObject { external String get type; } extension type HTMLDListElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLDListElement(); + /// Creates a(n) [HTMLDListElement] using the tag 'dl'. + HTMLDListElement() : _ = document.createElement('dl'); external set compact(bool value); external bool get compact; } extension type HTMLDivElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLDivElement(); + /// Creates a(n) [HTMLDivElement] using the tag 'div'. + HTMLDivElement() : _ = document.createElement('div'); external set align(String value); external String get align; } extension type HTMLAnchorElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLAnchorElement(); + /// Creates a(n) [HTMLAnchorElement] using the tag 'a'. + HTMLAnchorElement() : _ = document.createElement('a'); external set target(String value); external String get target; @@ -671,28 +893,36 @@ extension type HTMLAnchorElement._(JSObject _) external String get hash; } extension type HTMLDataElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLDataElement(); + /// Creates a(n) [HTMLDataElement] using the tag 'data'. + HTMLDataElement() : _ = document.createElement('data'); external set value(String value); external String get value; } extension type HTMLTimeElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLTimeElement(); + /// Creates a(n) [HTMLTimeElement] using the tag 'time'. + HTMLTimeElement() : _ = document.createElement('time'); external set dateTime(String value); external String get dateTime; } extension type HTMLSpanElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLSpanElement(); + /// Creates a(n) [HTMLSpanElement] using the tag 'span'. + HTMLSpanElement() : _ = document.createElement('span'); } extension type HTMLBRElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLBRElement(); + /// Creates a(n) [HTMLBRElement] using the tag 'br'. + HTMLBRElement() : _ = document.createElement('br'); external set clear(String value); external String get clear; } extension type HTMLModElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLModElement(); + /// Creates a(n) [HTMLModElement] using the tag 'ins'. + HTMLModElement.ins() : _ = document.createElement('ins'); + + /// Creates a(n) [HTMLModElement] using the tag 'del'. + HTMLModElement.del() : _ = document.createElement('del'); external set cite(String value); external String get cite; @@ -701,11 +931,13 @@ extension type HTMLModElement._(JSObject _) implements HTMLElement, JSObject { } extension type HTMLPictureElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLPictureElement(); + /// Creates a(n) [HTMLPictureElement] using the tag 'picture'. + HTMLPictureElement() : _ = document.createElement('picture'); } extension type HTMLSourceElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLSourceElement(); + /// Creates a(n) [HTMLSourceElement] using the tag 'source'. + HTMLSourceElement() : _ = document.createElement('source'); external set src(String value); external String get src; @@ -723,7 +955,8 @@ extension type HTMLSourceElement._(JSObject _) external int get height; } extension type HTMLImageElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLImageElement(); + /// Creates a(n) [HTMLImageElement] using the tag 'img'. + HTMLImageElement() : _ = document.createElement('img'); external JSPromise decode(); external int get x; @@ -775,7 +1008,8 @@ extension type HTMLImageElement._(JSObject _) implements HTMLElement, JSObject { } extension type HTMLIFrameElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLIFrameElement(); + /// Creates a(n) [HTMLIFrameElement] using the tag 'iframe'. + HTMLIFrameElement() : _ = document.createElement('iframe'); external Document? getSVGDocument(); external set src(String value); @@ -813,7 +1047,8 @@ extension type HTMLIFrameElement._(JSObject _) external String get marginWidth; } extension type HTMLEmbedElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLEmbedElement(); + /// Creates a(n) [HTMLEmbedElement] using the tag 'embed'. + HTMLEmbedElement() : _ = document.createElement('embed'); external Document? getSVGDocument(); external set src(String value); @@ -831,7 +1066,8 @@ extension type HTMLEmbedElement._(JSObject _) implements HTMLElement, JSObject { } extension type HTMLObjectElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLObjectElement(); + /// Creates a(n) [HTMLObjectElement] using the tag 'object'. + HTMLObjectElement() : _ = document.createElement('object'); external Document? getSVGDocument(); external bool checkValidity(); @@ -878,7 +1114,8 @@ extension type HTMLObjectElement._(JSObject _) } extension type HTMLVideoElement._(JSObject _) implements HTMLMediaElement, JSObject { - external factory HTMLVideoElement(); + /// Creates a(n) [HTMLVideoElement] using the tag 'video'. + HTMLVideoElement() : _ = document.createElement('video'); external VideoPlaybackQuality getVideoPlaybackQuality(); external set width(int value); @@ -894,10 +1131,12 @@ extension type HTMLVideoElement._(JSObject _) } extension type HTMLAudioElement._(JSObject _) implements HTMLMediaElement, JSObject { - external factory HTMLAudioElement(); + /// Creates a(n) [HTMLAudioElement] using the tag 'audio'. + HTMLAudioElement() : _ = document.createElement('audio'); } extension type HTMLTrackElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLTrackElement(); + /// Creates a(n) [HTMLTrackElement] using the tag 'track'. + HTMLTrackElement() : _ = document.createElement('track'); external static int get NONE; external static int get LOADING; @@ -1100,14 +1339,16 @@ extension type TrackEventInit._(JSObject _) implements EventInit, JSObject { external JSObject? get track; } extension type HTMLMapElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLMapElement(); + /// Creates a(n) [HTMLMapElement] using the tag 'map'. + HTMLMapElement() : _ = document.createElement('map'); external set name(String value); external String get name; external HTMLCollection get areas; } extension type HTMLAreaElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLAreaElement(); + /// Creates a(n) [HTMLAreaElement] using the tag 'area'. + HTMLAreaElement() : _ = document.createElement('area'); external set alt(String value); external String get alt; @@ -1151,7 +1392,8 @@ extension type HTMLAreaElement._(JSObject _) implements HTMLElement, JSObject { external String get hash; } extension type HTMLTableElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLTableElement(); + /// Creates a(n) [HTMLTableElement] using the tag 'table'. + HTMLTableElement() : _ = document.createElement('table'); external HTMLTableCaptionElement createCaption(); external void deleteCaption(); @@ -1191,14 +1433,19 @@ extension type HTMLTableElement._(JSObject _) implements HTMLElement, JSObject { } extension type HTMLTableCaptionElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLTableCaptionElement(); + /// Creates a(n) [HTMLTableCaptionElement] using the tag 'caption'. + HTMLTableCaptionElement() : _ = document.createElement('caption'); external set align(String value); external String get align; } extension type HTMLTableColElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLTableColElement(); + /// Creates a(n) [HTMLTableColElement] using the tag 'colgroup'. + HTMLTableColElement.colgroup() : _ = document.createElement('colgroup'); + + /// Creates a(n) [HTMLTableColElement] using the tag 'col'. + HTMLTableColElement.col() : _ = document.createElement('col'); external set span(int value); external int get span; @@ -1215,7 +1462,14 @@ extension type HTMLTableColElement._(JSObject _) } extension type HTMLTableSectionElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLTableSectionElement(); + /// Creates a(n) [HTMLTableSectionElement] using the tag 'tbody'. + HTMLTableSectionElement.tbody() : _ = document.createElement('tbody'); + + /// Creates a(n) [HTMLTableSectionElement] using the tag 'thead'. + HTMLTableSectionElement.thead() : _ = document.createElement('thead'); + + /// Creates a(n) [HTMLTableSectionElement] using the tag 'tfoot'. + HTMLTableSectionElement.tfoot() : _ = document.createElement('tfoot'); external HTMLTableRowElement insertRow([int index]); external void deleteRow(int index); @@ -1231,7 +1485,8 @@ extension type HTMLTableSectionElement._(JSObject _) } extension type HTMLTableRowElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLTableRowElement(); + /// Creates a(n) [HTMLTableRowElement] using the tag 'tr'. + HTMLTableRowElement() : _ = document.createElement('tr'); external HTMLTableCellElement insertCell([int index]); external void deleteCell(int index); @@ -1251,7 +1506,11 @@ extension type HTMLTableRowElement._(JSObject _) } extension type HTMLTableCellElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLTableCellElement(); + /// Creates a(n) [HTMLTableCellElement] using the tag 'td'. + HTMLTableCellElement.td() : _ = document.createElement('td'); + + /// Creates a(n) [HTMLTableCellElement] using the tag 'th'. + HTMLTableCellElement.th() : _ = document.createElement('th'); external set colSpan(int value); external int get colSpan; @@ -1284,7 +1543,8 @@ extension type HTMLTableCellElement._(JSObject _) external String get bgColor; } extension type HTMLFormElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLFormElement(); + /// Creates a(n) [HTMLFormElement] using the tag 'form'. + HTMLFormElement() : _ = document.createElement('form'); external void submit(); external void requestSubmit([HTMLElement? submitter]); @@ -1316,7 +1576,8 @@ extension type HTMLFormElement._(JSObject _) implements HTMLElement, JSObject { external int get length; } extension type HTMLLabelElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLLabelElement(); + /// Creates a(n) [HTMLLabelElement] using the tag 'label'. + HTMLLabelElement() : _ = document.createElement('label'); external HTMLFormElement? get form; external set htmlFor(String value); @@ -1324,7 +1585,8 @@ extension type HTMLLabelElement._(JSObject _) implements HTMLElement, JSObject { external HTMLElement? get control; } extension type HTMLInputElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLInputElement(); + /// Creates a(n) [HTMLInputElement] using the tag 'input'. + HTMLInputElement() : _ = document.createElement('input'); external void stepUp([int n]); external void stepDown([int n]); @@ -1438,7 +1700,8 @@ extension type HTMLInputElement._(JSObject _) implements HTMLElement, JSObject { } extension type HTMLButtonElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLButtonElement(); + /// Creates a(n) [HTMLButtonElement] using the tag 'button'. + HTMLButtonElement() : _ = document.createElement('button'); external bool checkValidity(); external bool reportValidity(); @@ -1473,7 +1736,8 @@ extension type HTMLButtonElement._(JSObject _) } extension type HTMLSelectElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLSelectElement(); + /// Creates a(n) [HTMLSelectElement] using the tag 'select'. + HTMLSelectElement() : _ = document.createElement('select'); external HTMLOptionElement? item(int index); external HTMLOptionElement? namedItem(String name); @@ -1515,13 +1779,15 @@ extension type HTMLSelectElement._(JSObject _) } extension type HTMLDataListElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLDataListElement(); + /// Creates a(n) [HTMLDataListElement] using the tag 'datalist'. + HTMLDataListElement() : _ = document.createElement('datalist'); external HTMLCollection get options; } extension type HTMLOptGroupElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLOptGroupElement(); + /// Creates a(n) [HTMLOptGroupElement] using the tag 'optgroup'. + HTMLOptGroupElement() : _ = document.createElement('optgroup'); external set disabled(bool value); external bool get disabled; @@ -1530,7 +1796,8 @@ extension type HTMLOptGroupElement._(JSObject _) } extension type HTMLOptionElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLOptionElement(); + /// Creates a(n) [HTMLOptionElement] using the tag 'option'. + HTMLOptionElement() : _ = document.createElement('option'); external set disabled(bool value); external bool get disabled; @@ -1549,7 +1816,8 @@ extension type HTMLOptionElement._(JSObject _) } extension type HTMLTextAreaElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLTextAreaElement(); + /// Creates a(n) [HTMLTextAreaElement] using the tag 'textarea'. + HTMLTextAreaElement() : _ = document.createElement('textarea'); external bool checkValidity(); external bool reportValidity(); @@ -1610,7 +1878,8 @@ extension type HTMLTextAreaElement._(JSObject _) } extension type HTMLOutputElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLOutputElement(); + /// Creates a(n) [HTMLOutputElement] using the tag 'output'. + HTMLOutputElement() : _ = document.createElement('output'); external bool checkValidity(); external bool reportValidity(); @@ -1631,7 +1900,8 @@ extension type HTMLOutputElement._(JSObject _) } extension type HTMLProgressElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLProgressElement(); + /// Creates a(n) [HTMLProgressElement] using the tag 'progress'. + HTMLProgressElement() : _ = document.createElement('progress'); external set value(num value); external num get value; @@ -1641,7 +1911,8 @@ extension type HTMLProgressElement._(JSObject _) external NodeList get labels; } extension type HTMLMeterElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLMeterElement(); + /// Creates a(n) [HTMLMeterElement] using the tag 'meter'. + HTMLMeterElement() : _ = document.createElement('meter'); external set value(num value); external num get value; @@ -1659,7 +1930,8 @@ extension type HTMLMeterElement._(JSObject _) implements HTMLElement, JSObject { } extension type HTMLFieldSetElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLFieldSetElement(); + /// Creates a(n) [HTMLFieldSetElement] using the tag 'fieldset'. + HTMLFieldSetElement() : _ = document.createElement('fieldset'); external bool checkValidity(); external bool reportValidity(); @@ -1677,7 +1949,8 @@ extension type HTMLFieldSetElement._(JSObject _) } extension type HTMLLegendElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLLegendElement(); + /// Creates a(n) [HTMLLegendElement] using the tag 'legend'. + HTMLLegendElement() : _ = document.createElement('legend'); external HTMLFormElement? get form; external set align(String value); @@ -1726,7 +1999,8 @@ extension type FormDataEventInit._(JSObject _) implements EventInit, JSObject { } extension type HTMLDetailsElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLDetailsElement(); + /// Creates a(n) [HTMLDetailsElement] using the tag 'details'. + HTMLDetailsElement() : _ = document.createElement('details'); external set name(String value); external String get name; @@ -1735,7 +2009,8 @@ extension type HTMLDetailsElement._(JSObject _) } extension type HTMLDialogElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLDialogElement(); + /// Creates a(n) [HTMLDialogElement] using the tag 'dialog'. + HTMLDialogElement() : _ = document.createElement('dialog'); external void show(); external void showModal(); @@ -1747,7 +2022,8 @@ extension type HTMLDialogElement._(JSObject _) } extension type HTMLScriptElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLScriptElement(); + /// Creates a(n) [HTMLScriptElement] using the tag 'script'. + HTMLScriptElement() : _ = document.createElement('script'); external static bool supports(String type); external set src(String value); @@ -1780,7 +2056,8 @@ extension type HTMLScriptElement._(JSObject _) } extension type HTMLTemplateElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLTemplateElement(); + /// Creates a(n) [HTMLTemplateElement] using the tag 'template'. + HTMLTemplateElement() : _ = document.createElement('template'); external DocumentFragment get content; external set shadowRootMode(String value); @@ -1789,7 +2066,8 @@ extension type HTMLTemplateElement._(JSObject _) external bool get shadowRootDelegatesFocus; } extension type HTMLSlotElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLSlotElement(); + /// Creates a(n) [HTMLSlotElement] using the tag 'slot'. + HTMLSlotElement() : _ = document.createElement('slot'); external JSArray assignedNodes([AssignedNodesOptions options]); external JSArray assignedElements([AssignedNodesOptions options]); @@ -1805,7 +2083,8 @@ extension type AssignedNodesOptions._(JSObject _) implements JSObject { } extension type HTMLCanvasElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLCanvasElement(); + /// Creates a(n) [HTMLCanvasElement] using the tag 'canvas'. + HTMLCanvasElement() : _ = document.createElement('canvas'); external RenderingContext? getContext( String contextId, [ @@ -3916,7 +4195,8 @@ extension type StorageEventInit._(JSObject _) implements EventInit, JSObject { } extension type HTMLMarqueeElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLMarqueeElement(); + /// Creates a(n) [HTMLMarqueeElement] using the tag 'marquee'. + HTMLMarqueeElement() : _ = document.createElement('marquee'); external void start(); external void stop(); @@ -3945,7 +4225,8 @@ extension type HTMLMarqueeElement._(JSObject _) } extension type HTMLFrameSetElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLFrameSetElement(); + /// Creates a(n) [HTMLFrameSetElement] using the tag 'frameset'. + HTMLFrameSetElement() : _ = document.createElement('frameset'); external set cols(String value); external String get cols; @@ -3991,7 +4272,8 @@ extension type HTMLFrameSetElement._(JSObject _) external EventHandler get onunload; } extension type HTMLFrameElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLFrameElement(); + /// Creates a(n) [HTMLFrameElement] using the tag 'frame'. + HTMLFrameElement() : _ = document.createElement('frame'); external set name(String value); external String get name; @@ -4014,13 +4296,15 @@ extension type HTMLFrameElement._(JSObject _) implements HTMLElement, JSObject { } extension type HTMLDirectoryElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLDirectoryElement(); + /// Creates a(n) [HTMLDirectoryElement] using the tag 'dir'. + HTMLDirectoryElement() : _ = document.createElement('dir'); external set compact(bool value); external bool get compact; } extension type HTMLFontElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLFontElement(); + /// Creates a(n) [HTMLFontElement] using the tag 'font'. + HTMLFontElement() : _ = document.createElement('font'); external set color(String value); external String get color; @@ -4030,7 +4314,8 @@ extension type HTMLFontElement._(JSObject _) implements HTMLElement, JSObject { external String get size; } extension type HTMLParamElement._(JSObject _) implements HTMLElement, JSObject { - external factory HTMLParamElement(); + /// Creates a(n) [HTMLParamElement] using the tag 'param'. + HTMLParamElement() : _ = document.createElement('param'); external set name(String value); external String get name; diff --git a/lib/src/dom/mathml_core.dart b/lib/src/dom/mathml_core.dart index 1e337657..e8b342ee 100644 --- a/lib/src/dom/mathml_core.dart +++ b/lib/src/dom/mathml_core.dart @@ -15,6 +15,216 @@ import 'dom.dart'; import 'html.dart'; extension type MathMLElement._(JSObject _) implements Element, JSObject { + /// Creates a(n) [MathMLElement] using the tag 'math'. + MathMLElement.math() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'math', + ); + + /// Creates a(n) [MathMLElement] using the tag 'mtext'. + MathMLElement.mtext() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'mtext', + ); + + /// Creates a(n) [MathMLElement] using the tag 'mi'. + MathMLElement.mi() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'mi', + ); + + /// Creates a(n) [MathMLElement] using the tag 'mn'. + MathMLElement.mn() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'mn', + ); + + /// Creates a(n) [MathMLElement] using the tag 'mo'. + MathMLElement.mo() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'mo', + ); + + /// Creates a(n) [MathMLElement] using the tag 'mspace'. + MathMLElement.mspace() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'mspace', + ); + + /// Creates a(n) [MathMLElement] using the tag 'ms'. + MathMLElement.ms() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'ms', + ); + + /// Creates a(n) [MathMLElement] using the tag 'mrow'. + MathMLElement.mrow() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'mrow', + ); + + /// Creates a(n) [MathMLElement] using the tag 'mfrac'. + MathMLElement.mfrac() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'mfrac', + ); + + /// Creates a(n) [MathMLElement] using the tag 'msqrt'. + MathMLElement.msqrt() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'msqrt', + ); + + /// Creates a(n) [MathMLElement] using the tag 'mroot'. + MathMLElement.mroot() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'mroot', + ); + + /// Creates a(n) [MathMLElement] using the tag 'mstyle'. + MathMLElement.mstyle() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'mstyle', + ); + + /// Creates a(n) [MathMLElement] using the tag 'merror'. + MathMLElement.merror() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'merror', + ); + + /// Creates a(n) [MathMLElement] using the tag 'mpadded'. + MathMLElement.mpadded() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'mpadded', + ); + + /// Creates a(n) [MathMLElement] using the tag 'mphantom'. + MathMLElement.mphantom() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'mphantom', + ); + + /// Creates a(n) [MathMLElement] using the tag 'msub'. + MathMLElement.msub() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'msub', + ); + + /// Creates a(n) [MathMLElement] using the tag 'msup'. + MathMLElement.msup() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'msup', + ); + + /// Creates a(n) [MathMLElement] using the tag 'msubsup'. + MathMLElement.msubsup() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'msubsup', + ); + + /// Creates a(n) [MathMLElement] using the tag 'munder'. + MathMLElement.munder() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'munder', + ); + + /// Creates a(n) [MathMLElement] using the tag 'mover'. + MathMLElement.mover() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'mover', + ); + + /// Creates a(n) [MathMLElement] using the tag 'munderover'. + MathMLElement.munderover() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'munderover', + ); + + /// Creates a(n) [MathMLElement] using the tag 'mmultiscripts'. + MathMLElement.mmultiscripts() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'mmultiscripts', + ); + + /// Creates a(n) [MathMLElement] using the tag 'mprescripts'. + MathMLElement.mprescripts() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'mprescripts', + ); + + /// Creates a(n) [MathMLElement] using the tag 'mtable'. + MathMLElement.mtable() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'mtable', + ); + + /// Creates a(n) [MathMLElement] using the tag 'mtr'. + MathMLElement.mtr() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'mtr', + ); + + /// Creates a(n) [MathMLElement] using the tag 'mtd'. + MathMLElement.mtd() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'mtd', + ); + + /// Creates a(n) [MathMLElement] using the tag 'maction'. + MathMLElement.maction() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'maction', + ); + + /// Creates a(n) [MathMLElement] using the tag 'semantics'. + MathMLElement.semantics() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'semantics', + ); + + /// Creates a(n) [MathMLElement] using the tag 'annotation'. + MathMLElement.annotation() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'annotation', + ); + + /// Creates a(n) [MathMLElement] using the tag 'annotation-xml'. + MathMLElement.annotation_xml() + : _ = document.createElementNS( + 'http://www.w3.org/1998/Math/MathML', + 'annotation-xml', + ); + external void focus([FocusOptions options]); external void blur(); external StylePropertyMap get attributeStyleMap; diff --git a/lib/src/dom/svg.dart b/lib/src/dom/svg.dart index 6c91b0a9..dea01936 100644 --- a/lib/src/dom/svg.dart +++ b/lib/src/dom/svg.dart @@ -423,6 +423,13 @@ extension type SVGUnitTypes._(JSObject _) implements JSObject { } extension type SVGSVGElement._(JSObject _) implements SVGGraphicsElement, JSObject { + /// Creates a(n) [SVGSVGElement] using the tag 'svg'. + SVGSVGElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'svg', + ); + external NodeList getIntersectionList( DOMRectReadOnly rect, SVGElement? referenceElement, @@ -507,20 +514,69 @@ extension type SVGSVGElement._(JSObject _) external EventHandler get onunload; } extension type SVGGElement._(JSObject _) - implements SVGGraphicsElement, JSObject {} + implements SVGGraphicsElement, JSObject { + /// Creates a(n) [SVGGElement] using the tag 'g'. + SVGGElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'g', + ); +} extension type SVGDefsElement._(JSObject _) - implements SVGGraphicsElement, JSObject {} -extension type SVGDescElement._(JSObject _) implements SVGElement, JSObject {} + implements SVGGraphicsElement, JSObject { + /// Creates a(n) [SVGDefsElement] using the tag 'defs'. + SVGDefsElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'defs', + ); +} +extension type SVGDescElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGDescElement] using the tag 'desc'. + SVGDescElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'desc', + ); +} extension type SVGMetadataElement._(JSObject _) - implements SVGElement, JSObject {} -extension type SVGTitleElement._(JSObject _) implements SVGElement, JSObject {} + implements SVGElement, JSObject { + /// Creates a(n) [SVGMetadataElement] using the tag 'metadata'. + SVGMetadataElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'metadata', + ); +} +extension type SVGTitleElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGTitleElement] using the tag 'title'. + SVGTitleElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'title', + ); +} extension type SVGSymbolElement._(JSObject _) implements SVGGraphicsElement, JSObject { + /// Creates a(n) [SVGSymbolElement] using the tag 'symbol'. + SVGSymbolElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'symbol', + ); + external SVGAnimatedRect get viewBox; external SVGAnimatedPreserveAspectRatio get preserveAspectRatio; } extension type SVGUseElement._(JSObject _) implements SVGGraphicsElement, JSObject { + /// Creates a(n) [SVGUseElement] using the tag 'use'. + SVGUseElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'use', + ); + external SVGAnimatedLength get x; external SVGAnimatedLength get y; external SVGAnimatedLength get width; @@ -540,8 +596,22 @@ extension type ShadowAnimation._(JSObject _) implements Animation, JSObject { external Animation get sourceAnimation; } extension type SVGSwitchElement._(JSObject _) - implements SVGGraphicsElement, JSObject {} + implements SVGGraphicsElement, JSObject { + /// Creates a(n) [SVGSwitchElement] using the tag 'switch'. + SVGSwitchElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'switch', + ); +} extension type SVGStyleElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGStyleElement] using the tag 'style'. + SVGStyleElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'style', + ); + external set type(String value); external String get type; external set media(String value); @@ -627,9 +697,23 @@ extension type SVGAnimatedPreserveAspectRatio._(JSObject _) external SVGPreserveAspectRatio get animVal; } extension type SVGPathElement._(JSObject _) - implements SVGGeometryElement, JSObject {} + implements SVGGeometryElement, JSObject { + /// Creates a(n) [SVGPathElement] using the tag 'path'. + SVGPathElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'path', + ); +} extension type SVGRectElement._(JSObject _) implements SVGGeometryElement, JSObject { + /// Creates a(n) [SVGRectElement] using the tag 'rect'. + SVGRectElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'rect', + ); + external SVGAnimatedLength get x; external SVGAnimatedLength get y; external SVGAnimatedLength get width; @@ -639,12 +723,26 @@ extension type SVGRectElement._(JSObject _) } extension type SVGCircleElement._(JSObject _) implements SVGGeometryElement, JSObject { + /// Creates a(n) [SVGCircleElement] using the tag 'circle'. + SVGCircleElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'circle', + ); + external SVGAnimatedLength get cx; external SVGAnimatedLength get cy; external SVGAnimatedLength get r; } extension type SVGEllipseElement._(JSObject _) implements SVGGeometryElement, JSObject { + /// Creates a(n) [SVGEllipseElement] using the tag 'ellipse'. + SVGEllipseElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'ellipse', + ); + external SVGAnimatedLength get cx; external SVGAnimatedLength get cy; external SVGAnimatedLength get rx; @@ -652,6 +750,13 @@ extension type SVGEllipseElement._(JSObject _) } extension type SVGLineElement._(JSObject _) implements SVGGeometryElement, JSObject { + /// Creates a(n) [SVGLineElement] using the tag 'line'. + SVGLineElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'line', + ); + external SVGAnimatedLength get x1; external SVGAnimatedLength get y1; external SVGAnimatedLength get x2; @@ -676,11 +781,25 @@ extension type SVGPointList._(JSObject _) implements JSObject { } extension type SVGPolylineElement._(JSObject _) implements SVGGeometryElement, JSObject { + /// Creates a(n) [SVGPolylineElement] using the tag 'polyline'. + SVGPolylineElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'polyline', + ); + external SVGPointList get points; external SVGPointList get animatedPoints; } extension type SVGPolygonElement._(JSObject _) implements SVGGeometryElement, JSObject { + /// Creates a(n) [SVGPolygonElement] using the tag 'polygon'. + SVGPolygonElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'polygon', + ); + external SVGPointList get points; external SVGPointList get animatedPoints; } @@ -716,11 +835,32 @@ extension type SVGTextPositioningElement._(JSObject _) external SVGAnimatedNumberList get rotate; } extension type SVGTextElement._(JSObject _) - implements SVGTextPositioningElement, JSObject {} + implements SVGTextPositioningElement, JSObject { + /// Creates a(n) [SVGTextElement] using the tag 'text'. + SVGTextElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'text', + ); +} extension type SVGTSpanElement._(JSObject _) - implements SVGTextPositioningElement, JSObject {} + implements SVGTextPositioningElement, JSObject { + /// Creates a(n) [SVGTSpanElement] using the tag 'tspan'. + SVGTSpanElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'tspan', + ); +} extension type SVGTextPathElement._(JSObject _) implements SVGTextContentElement, JSObject { + /// Creates a(n) [SVGTextPathElement] using the tag 'textPath'. + SVGTextPathElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'textPath', + ); + external static int get TEXTPATH_METHODTYPE_UNKNOWN; external static int get TEXTPATH_METHODTYPE_ALIGN; external static int get TEXTPATH_METHODTYPE_STRETCH; @@ -734,6 +874,13 @@ extension type SVGTextPathElement._(JSObject _) } extension type SVGImageElement._(JSObject _) implements SVGGraphicsElement, JSObject { + /// Creates a(n) [SVGImageElement] using the tag 'image'. + SVGImageElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'image', + ); + external SVGAnimatedLength get x; external SVGAnimatedLength get y; external SVGAnimatedLength get width; @@ -745,12 +892,26 @@ extension type SVGImageElement._(JSObject _) } extension type SVGForeignObjectElement._(JSObject _) implements SVGGraphicsElement, JSObject { + /// Creates a(n) [SVGForeignObjectElement] using the tag 'foreignObject'. + SVGForeignObjectElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'foreignObject', + ); + external SVGAnimatedLength get x; external SVGAnimatedLength get y; external SVGAnimatedLength get width; external SVGAnimatedLength get height; } extension type SVGMarkerElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGMarkerElement] using the tag 'marker'. + SVGMarkerElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'marker', + ); + external static int get SVG_MARKERUNITS_UNKNOWN; external static int get SVG_MARKERUNITS_USERSPACEONUSE; external static int get SVG_MARKERUNITS_STROKEWIDTH; @@ -784,6 +945,13 @@ extension type SVGGradientElement._(JSObject _) } extension type SVGLinearGradientElement._(JSObject _) implements SVGGradientElement, JSObject { + /// Creates a(n) [SVGLinearGradientElement] using the tag 'linearGradient'. + SVGLinearGradientElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'linearGradient', + ); + external SVGAnimatedLength get x1; external SVGAnimatedLength get y1; external SVGAnimatedLength get x2; @@ -791,6 +959,13 @@ extension type SVGLinearGradientElement._(JSObject _) } extension type SVGRadialGradientElement._(JSObject _) implements SVGGradientElement, JSObject { + /// Creates a(n) [SVGRadialGradientElement] using the tag 'radialGradient'. + SVGRadialGradientElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'radialGradient', + ); + external SVGAnimatedLength get cx; external SVGAnimatedLength get cy; external SVGAnimatedLength get r; @@ -799,9 +974,23 @@ extension type SVGRadialGradientElement._(JSObject _) external SVGAnimatedLength get fr; } extension type SVGStopElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGStopElement] using the tag 'stop'. + SVGStopElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'stop', + ); + external SVGAnimatedNumber get offset; } extension type SVGPatternElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGPatternElement] using the tag 'pattern'. + SVGPatternElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'pattern', + ); + external SVGAnimatedEnumeration get patternUnits; external SVGAnimatedEnumeration get patternContentUnits; external SVGAnimatedTransformList get patternTransform; @@ -814,6 +1003,13 @@ extension type SVGPatternElement._(JSObject _) implements SVGElement, JSObject { external SVGAnimatedString get href; } extension type SVGScriptElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGScriptElement] using the tag 'script'. + SVGScriptElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'script', + ); + external set type(String value); external String get type; external set crossOrigin(String? value); @@ -822,6 +1018,13 @@ extension type SVGScriptElement._(JSObject _) implements SVGElement, JSObject { } extension type SVGAElement._(JSObject _) implements SVGGraphicsElement, JSObject { + /// Creates a(n) [SVGAElement] using the tag 'a'. + SVGAElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'a', + ); + external SVGAnimatedString get target; external set download(String value); external String get download; @@ -860,6 +1063,13 @@ extension type SVGAElement._(JSObject _) external SVGAnimatedString get href; } extension type SVGViewElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGViewElement] using the tag 'view'. + SVGViewElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'view', + ); + external SVGAnimatedRect get viewBox; external SVGAnimatedPreserveAspectRatio get preserveAspectRatio; } diff --git a/lib/src/dom/svg_animations.dart b/lib/src/dom/svg_animations.dart index 46c63845..f046a215 100644 --- a/lib/src/dom/svg_animations.dart +++ b/lib/src/dom/svg_animations.dart @@ -42,15 +42,50 @@ extension type SVGAnimationElement._(JSObject _) external SVGStringList get systemLanguage; } extension type SVGAnimateElement._(JSObject _) - implements SVGAnimationElement, JSObject {} + implements SVGAnimationElement, JSObject { + /// Creates a(n) [SVGAnimateElement] using the tag 'animate'. + SVGAnimateElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'animate', + ); +} extension type SVGSetElement._(JSObject _) - implements SVGAnimationElement, JSObject {} + implements SVGAnimationElement, JSObject { + /// Creates a(n) [SVGSetElement] using the tag 'set'. + SVGSetElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'set', + ); +} extension type SVGAnimateMotionElement._(JSObject _) - implements SVGAnimationElement, JSObject {} + implements SVGAnimationElement, JSObject { + /// Creates a(n) [SVGAnimateMotionElement] using the tag 'animateMotion'. + SVGAnimateMotionElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'animateMotion', + ); +} extension type SVGMPathElement._(JSObject _) implements SVGElement, JSObject { + /// Creates a(n) [SVGMPathElement] using the tag 'mpath'. + SVGMPathElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'mpath', + ); + external SVGAnimatedString get href; } extension type SVGAnimateTransformElement._(JSObject _) - implements SVGAnimationElement, JSObject {} + implements SVGAnimationElement, JSObject { + /// Creates a(n) [SVGAnimateTransformElement] using the tag 'animateTransform'. + SVGAnimateTransformElement() + : _ = document.createElementNS( + 'http://www.w3.org/2000/svg', + 'animateTransform', + ); +} extension type SVGDiscardElement._(JSObject _) implements SVGAnimationElement, JSObject {} diff --git a/lib/src/helpers.dart b/lib/src/helpers.dart index ce7a4e70..9f10380b 100644 --- a/lib/src/helpers.dart +++ b/lib/src/helpers.dart @@ -43,7 +43,7 @@ export 'helpers/renames.dart'; /// ```dart /// final anchor = document.createElement('a') as HTMLElement; /// ``` -@Deprecated('Directly use document.createElement instead.') +@Deprecated('Use the specific HTMLElement constructor instead.') HTMLElement createElementTag(String tagName) => document.createElement(tagName) as HTMLElement; @@ -56,7 +56,7 @@ HTMLElement createElementTag(String tagName) => /// ..width = 256 /// ..height = 256; /// ``` -@Deprecated('Directly use document.createElement instead.') +@Deprecated('Use the HTMLCanvasElement constructor instead.') HTMLCanvasElement createCanvasElement({int? width, int? height}) { final result = document.createElement('canvas') as HTMLCanvasElement; if (width != null) result.width = width; @@ -71,12 +71,16 @@ HTMLCanvasElement createCanvasElement({int? width, int? height}) { /// ```dart /// final embed = document.createElement('iframe') as HTMLIFrameElement; /// ``` -@Deprecated('Directly use document.createElement instead.') +@Deprecated('Use the HTMLIFrameElement constructor instead.') HTMLIFrameElement createIFrameElement() => document.createElement('iframe') as HTMLIFrameElement; @JS('Audio') external JSFunction get _audioConstructor; +// While `new Audio()` is a different syntax from +// `document.createElement('audio')`, it looks like they're the same: +// https://developer.mozilla.org/en-US/docs/Web/API/HTMLAudioElement/Audio#usage_notes +@Deprecated('Use the HTMLAudioElement constructor instead.') HTMLAudioElement createAudioElement() => _audioConstructor.callAsConstructor(); /// Finds and returns the first element within the [document] diff --git a/pubspec.yaml b/pubspec.yaml index 7e3614da..ae3f7532 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: web -version: 0.5.1-wip +version: 0.6.0-wip description: Lightweight browser API bindings built around JS static interop. repository: https://github.com/dart-lang/web From 03d784a6c5e193fb1ea957c064f056e17190f58b Mon Sep 17 00:00:00 2001 From: Srujan Gaddam Date: Fri, 23 Feb 2024 16:18:56 -0800 Subject: [PATCH 3/7] Address line wrap issues for docs on constructors Adds a helper function wrap doc comments as needed to avoid the analyzer failing on comments exceeding line width. --- lib/src/dom/filter_effects.dart | 15 ++++++++++----- lib/src/dom/svg_animations.dart | 3 ++- tool/generator/translator.dart | 32 ++++++++++++++++++++++++++++++-- 3 files changed, 42 insertions(+), 8 deletions(-) diff --git a/lib/src/dom/filter_effects.dart b/lib/src/dom/filter_effects.dart index 22e3e09b..3bb79501 100644 --- a/lib/src/dom/filter_effects.dart +++ b/lib/src/dom/filter_effects.dart @@ -87,7 +87,8 @@ extension type SVGFEColorMatrixElement._(JSObject _) } extension type SVGFEComponentTransferElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGFEComponentTransferElement] using the tag 'feComponentTransfer'. + /// Creates a(n) [SVGFEComponentTransferElement] using the tag + /// 'feComponentTransfer'. SVGFEComponentTransferElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -184,7 +185,8 @@ extension type SVGFECompositeElement._(JSObject _) } extension type SVGFEConvolveMatrixElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGFEConvolveMatrixElement] using the tag 'feConvolveMatrix'. + /// Creates a(n) [SVGFEConvolveMatrixElement] using the tag + /// 'feConvolveMatrix'. SVGFEConvolveMatrixElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -215,7 +217,8 @@ extension type SVGFEConvolveMatrixElement._(JSObject _) } extension type SVGFEDiffuseLightingElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGFEDiffuseLightingElement] using the tag 'feDiffuseLighting'. + /// Creates a(n) [SVGFEDiffuseLightingElement] using the tag + /// 'feDiffuseLighting'. SVGFEDiffuseLightingElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -278,7 +281,8 @@ extension type SVGFESpotLightElement._(JSObject _) } extension type SVGFEDisplacementMapElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGFEDisplacementMapElement] using the tag 'feDisplacementMap'. + /// Creates a(n) [SVGFEDisplacementMapElement] using the tag + /// 'feDisplacementMap'. SVGFEDisplacementMapElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -450,7 +454,8 @@ extension type SVGFEOffsetElement._(JSObject _) } extension type SVGFESpecularLightingElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGFESpecularLightingElement] using the tag 'feSpecularLighting'. + /// Creates a(n) [SVGFESpecularLightingElement] using the tag + /// 'feSpecularLighting'. SVGFESpecularLightingElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', diff --git a/lib/src/dom/svg_animations.dart b/lib/src/dom/svg_animations.dart index f046a215..a754ccfa 100644 --- a/lib/src/dom/svg_animations.dart +++ b/lib/src/dom/svg_animations.dart @@ -80,7 +80,8 @@ extension type SVGMPathElement._(JSObject _) implements SVGElement, JSObject { } extension type SVGAnimateTransformElement._(JSObject _) implements SVGAnimationElement, JSObject { - /// Creates a(n) [SVGAnimateTransformElement] using the tag 'animateTransform'. + /// Creates a(n) [SVGAnimateTransformElement] using the tag + /// 'animateTransform'. SVGAnimateTransformElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', diff --git a/tool/generator/translator.dart b/tool/generator/translator.dart index 8beadda8..07a32168 100644 --- a/tool/generator/translator.dart +++ b/tool/generator/translator.dart @@ -828,6 +828,30 @@ class Translator { readOnly: false), ]; + // Wraps a [doc] comment given a [leadingWhitespaceCount] for each line so + // that the comment doesn't exceed 80 characters. + // + // Dart format doesn't wrap comments, so we roll our own here. + String _wrapDocComment(String doc, [int leadingWhitespaceCount = 0]) { + final lineWidth = 80 - leadingWhitespaceCount; + final input = doc.split(' '); + final output = ['///']; + var charCount = 3; + for (final token in input) { + final length = token.length; + // 1 for the whitespace between tokens. + if (charCount != 3 && charCount + 1 + length > lineWidth) { + output[output.length - 1] += '\n'; + output.add('///'); + charCount = 3; + } else { + charCount += 1 + length; + } + output.add(token); + } + return output.join(' '); + } + // If [jsName] is an element type, creates a constructor for each tag that the // element interface corresponds to using either `createElement` or // `createElementNS`. @@ -842,8 +866,12 @@ class Translator { uri != null ? 'createElementNS' : 'createElement'; for (final tag in tags) { elementConstructors.add(code.Constructor((b) => b - ..docs.addAll( - ["/// Creates a(n) [$dartClassName] using the tag '$tag'."]) + ..docs.addAll([ + _wrapDocComment( + "Creates a(n) [$dartClassName] using the tag '$tag'.", + // Extension type members start with an indentation of 2 chars. + 2) + ]) // If there are multiple tags, use a named constructor. ..name = tags.length == 1 ? null : dartRename(tag) ..initializers.addAll([ From 19974be989832d0fd247c3f8fdad0a9d3c8d8b89 Mon Sep 17 00:00:00 2001 From: Srujan Gaddam Date: Mon, 26 Feb 2024 13:18:21 -0800 Subject: [PATCH 4/7] Undo version bump to 0.6.0 Unneeded as: - Since the implementation was always broken for these constructors, it shouldn't be a breaking change to remove them/fix them. - Deprecations no longer break Flutter. --- CHANGELOG.md | 2 +- pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2b6c928..f43ceb02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.6.0-wip +## 0.5.1-wip - Add [`TrustedTypes`](https://web.dev/trusted-types) members. - Add a constructor for each Element tag onto their respective Element diff --git a/pubspec.yaml b/pubspec.yaml index ae3f7532..7e3614da 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: web -version: 0.6.0-wip +version: 0.5.1-wip description: Lightweight browser API bindings built around JS static interop. repository: https://github.com/dart-lang/web From b8a847845688ad65cfb20aaa1dfaab22648f6750 Mon Sep 17 00:00:00 2001 From: Srujan Gaddam Date: Wed, 28 Feb 2024 15:35:59 -0800 Subject: [PATCH 5/7] Use formatting.dart instead of helper method --- tool/generator/formatting.dart | 10 ++++++---- tool/generator/translator.dart | 36 ++++++++-------------------------- 2 files changed, 14 insertions(+), 32 deletions(-) diff --git a/tool/generator/formatting.dart b/tool/generator/formatting.dart index ba72cd32..2e0d1636 100644 --- a/tool/generator/formatting.dart +++ b/tool/generator/formatting.dart @@ -2,9 +2,10 @@ // 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. -/// Given markdown formatted text and a width, return a line-wrapped dartdoc -/// comment. -List formatDocs(String data, int width) { +/// Given markdown formatted text [data] and a line [width], return a +/// line-wrapped dartdoc comment accounting for any [leadingWhitespace] the +/// comment should have. +List formatDocs(String data, int width, [int leadingWhitespace = 0]) { // TODO(devoncarew): Look at combining soft line breaks in the markdown in // order to better reflow the returned dartdoc comments (i.e., only have line // breaks for markdown paragraphs). @@ -12,6 +13,7 @@ List formatDocs(String data, int width) { final lines = data.split('\n'); final output = []; + width -= leadingWhitespace; width -= '/// '.length; var inCodeFence = false; @@ -50,7 +52,7 @@ List formatDocs(String data, int width) { /// Identify `[foo](bar)` and `[foo]` patterns. final RegExp _linksRegEx = RegExp(r'\[([\w `-]+?)\](\(\S+\))?'); -/// Wrap the given line to [width], breaking at whitespace. +/// Wrap the given [line] to [width], breaking at whitespace. Iterable _wrap(String line, int width) sync* { if (line.isEmpty) { yield line; diff --git a/tool/generator/translator.dart b/tool/generator/translator.dart index 4c3f791b..d3ede042 100644 --- a/tool/generator/translator.dart +++ b/tool/generator/translator.dart @@ -10,6 +10,7 @@ import 'package:path/path.dart' as p; import 'banned_names.dart'; import 'bcd.dart'; import 'doc_provider.dart'; +import 'formatting.dart'; import 'singletons.dart'; import 'type_aliases.dart'; import 'type_union.dart'; @@ -839,30 +840,6 @@ class Translator { readOnly: false), ]; - // Wraps a [doc] comment given a [leadingWhitespaceCount] for each line so - // that the comment doesn't exceed 80 characters. - // - // Dart format doesn't wrap comments, so we roll our own here. - String _wrapDocComment(String doc, [int leadingWhitespaceCount = 0]) { - final lineWidth = 80 - leadingWhitespaceCount; - final input = doc.split(' '); - final output = ['///']; - var charCount = 3; - for (final token in input) { - final length = token.length; - // 1 for the whitespace between tokens. - if (charCount != 3 && charCount + 1 + length > lineWidth) { - output[output.length - 1] += '\n'; - output.add('///'); - charCount = 3; - } else { - charCount += 1 + length; - } - output.add(token); - } - return output.join(' '); - } - // If [jsName] is an element type, creates a constructor for each tag that the // element interface corresponds to using either `createElement` or // `createElementNS`. @@ -878,10 +855,13 @@ class Translator { for (final tag in tags) { elementConstructors.add(code.Constructor((b) => b ..docs.addAll([ - _wrapDocComment( - "Creates a(n) [$dartClassName] using the tag '$tag'.", - // Extension type members start with an indentation of 2 chars. - 2) + formatDocs( + "Creates a(n) [$dartClassName] using the tag '$tag'.", + 80, + // Extension type members start with an indentation of 2 + // chars. + 2) + .join('\n') ]) // If there are multiple tags, use a named constructor. ..name = tags.length == 1 ? null : dartRename(tag) From 2e6194145134e2f1f998164e896ffd2ebcf072bc Mon Sep 17 00:00:00 2001 From: Srujan Gaddam Date: Wed, 28 Feb 2024 15:42:04 -0800 Subject: [PATCH 6/7] Handle articles in doc comment for element constructors --- lib/src/dom/css_masking.dart | 4 +- lib/src/dom/filter_effects.dart | 53 +++-- lib/src/dom/html.dart | 282 ++++++++++++------------ lib/src/dom/mathml_core.dart | 60 ++--- lib/src/dom/svg.dart | 60 ++--- lib/src/dom/svg_animations.dart | 11 +- tool/generator/translator.dart | 3 +- tool/generator/webref_elements_api.dart | 15 +- 8 files changed, 250 insertions(+), 238 deletions(-) diff --git a/lib/src/dom/css_masking.dart b/lib/src/dom/css_masking.dart index 87a433b5..82826801 100644 --- a/lib/src/dom/css_masking.dart +++ b/lib/src/dom/css_masking.dart @@ -20,7 +20,7 @@ import 'svg.dart'; /// elements, as well as methods to manipulate them. extension type SVGClipPathElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGClipPathElement] using the tag 'clipPath'. + /// Creates an [SVGClipPathElement] using the tag 'clipPath'. SVGClipPathElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -34,7 +34,7 @@ extension type SVGClipPathElement._(JSObject _) /// The **`SVGMaskElement`** interface provides access to the properties of /// elements, as well as methods to manipulate them. extension type SVGMaskElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGMaskElement] using the tag 'mask'. + /// Creates an [SVGMaskElement] using the tag 'mask'. SVGMaskElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', diff --git a/lib/src/dom/filter_effects.dart b/lib/src/dom/filter_effects.dart index d91482fe..dac019c4 100644 --- a/lib/src/dom/filter_effects.dart +++ b/lib/src/dom/filter_effects.dart @@ -19,7 +19,7 @@ import 'svg.dart'; /// The **`SVGFilterElement`** interface provides access to the properties of /// elements, as well as methods to manipulate them. extension type SVGFilterElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGFilterElement] using the tag 'filter'. + /// Creates an [SVGFilterElement] using the tag 'filter'. SVGFilterElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -37,7 +37,7 @@ extension type SVGFilterElement._(JSObject _) implements SVGElement, JSObject { /// The **`SVGFEBlendElement`** interface corresponds to the element. extension type SVGFEBlendElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGFEBlendElement] using the tag 'feBlend'. + /// Creates an [SVGFEBlendElement] using the tag 'feBlend'. SVGFEBlendElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -74,7 +74,7 @@ extension type SVGFEBlendElement._(JSObject _) implements SVGElement, JSObject { /// The **`SVGFEColorMatrixElement`** interface corresponds to the element. extension type SVGFEColorMatrixElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGFEColorMatrixElement] using the tag 'feColorMatrix'. + /// Creates an [SVGFEColorMatrixElement] using the tag 'feColorMatrix'. SVGFEColorMatrixElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -100,7 +100,7 @@ extension type SVGFEColorMatrixElement._(JSObject _) /// element. extension type SVGFEComponentTransferElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGFEComponentTransferElement] using the tag + /// Creates an [SVGFEComponentTransferElement] using the tag /// 'feComponentTransfer'. SVGFEComponentTransferElement() : _ = document.createElementNS( @@ -138,7 +138,7 @@ extension type SVGComponentTransferFunctionElement._(JSObject _) /// The **`SVGFEFuncRElement`** interface corresponds to the element. extension type SVGFEFuncRElement._(JSObject _) implements SVGComponentTransferFunctionElement, JSObject { - /// Creates a(n) [SVGFEFuncRElement] using the tag 'feFuncR'. + /// Creates an [SVGFEFuncRElement] using the tag 'feFuncR'. SVGFEFuncRElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -149,7 +149,7 @@ extension type SVGFEFuncRElement._(JSObject _) /// The **`SVGFEFuncGElement`** interface corresponds to the element. extension type SVGFEFuncGElement._(JSObject _) implements SVGComponentTransferFunctionElement, JSObject { - /// Creates a(n) [SVGFEFuncGElement] using the tag 'feFuncG'. + /// Creates an [SVGFEFuncGElement] using the tag 'feFuncG'. SVGFEFuncGElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -160,7 +160,7 @@ extension type SVGFEFuncGElement._(JSObject _) /// The **`SVGFEFuncBElement`** interface corresponds to the element. extension type SVGFEFuncBElement._(JSObject _) implements SVGComponentTransferFunctionElement, JSObject { - /// Creates a(n) [SVGFEFuncBElement] using the tag 'feFuncB'. + /// Creates an [SVGFEFuncBElement] using the tag 'feFuncB'. SVGFEFuncBElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -171,7 +171,7 @@ extension type SVGFEFuncBElement._(JSObject _) /// The **`SVGFEFuncAElement`** interface corresponds to the element. extension type SVGFEFuncAElement._(JSObject _) implements SVGComponentTransferFunctionElement, JSObject { - /// Creates a(n) [SVGFEFuncAElement] using the tag 'feFuncA'. + /// Creates an [SVGFEFuncAElement] using the tag 'feFuncA'. SVGFEFuncAElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -182,7 +182,7 @@ extension type SVGFEFuncAElement._(JSObject _) /// The **`SVGFECompositeElement`** interface corresponds to the element. extension type SVGFECompositeElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGFECompositeElement] using the tag 'feComposite'. + /// Creates an [SVGFECompositeElement] using the tag 'feComposite'. SVGFECompositeElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -213,8 +213,7 @@ extension type SVGFECompositeElement._(JSObject _) /// The **`SVGFEConvolveMatrixElement`** interface corresponds to the element. extension type SVGFEConvolveMatrixElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGFEConvolveMatrixElement] using the tag - /// 'feConvolveMatrix'. + /// Creates an [SVGFEConvolveMatrixElement] using the tag 'feConvolveMatrix'. SVGFEConvolveMatrixElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -247,7 +246,7 @@ extension type SVGFEConvolveMatrixElement._(JSObject _) /// The **`SVGFEDiffuseLightingElement`** interface corresponds to the element. extension type SVGFEDiffuseLightingElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGFEDiffuseLightingElement] using the tag + /// Creates an [SVGFEDiffuseLightingElement] using the tag /// 'feDiffuseLighting'. SVGFEDiffuseLightingElement() : _ = document.createElementNS( @@ -270,7 +269,7 @@ extension type SVGFEDiffuseLightingElement._(JSObject _) /// The **`SVGFEDistantLightElement`** interface corresponds to the element. extension type SVGFEDistantLightElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGFEDistantLightElement] using the tag 'feDistantLight'. + /// Creates an [SVGFEDistantLightElement] using the tag 'feDistantLight'. SVGFEDistantLightElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -284,7 +283,7 @@ extension type SVGFEDistantLightElement._(JSObject _) /// The **`SVGFEPointLightElement`** interface corresponds to the element. extension type SVGFEPointLightElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGFEPointLightElement] using the tag 'fePointLight'. + /// Creates an [SVGFEPointLightElement] using the tag 'fePointLight'. SVGFEPointLightElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -299,7 +298,7 @@ extension type SVGFEPointLightElement._(JSObject _) /// The **`SVGFESpotLightElement`** interface corresponds to the element. extension type SVGFESpotLightElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGFESpotLightElement] using the tag 'feSpotLight'. + /// Creates an [SVGFESpotLightElement] using the tag 'feSpotLight'. SVGFESpotLightElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -319,7 +318,7 @@ extension type SVGFESpotLightElement._(JSObject _) /// The **`SVGFEDisplacementMapElement`** interface corresponds to the element. extension type SVGFEDisplacementMapElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGFEDisplacementMapElement] using the tag + /// Creates an [SVGFEDisplacementMapElement] using the tag /// 'feDisplacementMap'. SVGFEDisplacementMapElement() : _ = document.createElementNS( @@ -347,7 +346,7 @@ extension type SVGFEDisplacementMapElement._(JSObject _) /// The **`SVGFEDropShadowElement`** interface corresponds to the element. extension type SVGFEDropShadowElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGFEDropShadowElement] using the tag 'feDropShadow'. + /// Creates an [SVGFEDropShadowElement] using the tag 'feDropShadow'. SVGFEDropShadowElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -372,7 +371,7 @@ extension type SVGFEDropShadowElement._(JSObject _) /// The **`SVGFEFloodElement`** interface corresponds to the element. extension type SVGFEFloodElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGFEFloodElement] using the tag 'feFlood'. + /// Creates an [SVGFEFloodElement] using the tag 'feFlood'. SVGFEFloodElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -389,7 +388,7 @@ extension type SVGFEFloodElement._(JSObject _) implements SVGElement, JSObject { /// The **`SVGFEGaussianBlurElement`** interface corresponds to the element. extension type SVGFEGaussianBlurElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGFEGaussianBlurElement] using the tag 'feGaussianBlur'. + /// Creates an [SVGFEGaussianBlurElement] using the tag 'feGaussianBlur'. SVGFEGaussianBlurElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -417,7 +416,7 @@ extension type SVGFEGaussianBlurElement._(JSObject _) /// The **`SVGFEImageElement`** interface corresponds to the element. extension type SVGFEImageElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGFEImageElement] using the tag 'feImage'. + /// Creates an [SVGFEImageElement] using the tag 'feImage'. SVGFEImageElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -436,7 +435,7 @@ extension type SVGFEImageElement._(JSObject _) implements SVGElement, JSObject { /// The **`SVGFEMergeElement`** interface corresponds to the element. extension type SVGFEMergeElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGFEMergeElement] using the tag 'feMerge'. + /// Creates an [SVGFEMergeElement] using the tag 'feMerge'. SVGFEMergeElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -453,7 +452,7 @@ extension type SVGFEMergeElement._(JSObject _) implements SVGElement, JSObject { /// The **`SVGFEMergeNodeElement`** interface corresponds to the element. extension type SVGFEMergeNodeElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGFEMergeNodeElement] using the tag 'feMergeNode'. + /// Creates an [SVGFEMergeNodeElement] using the tag 'feMergeNode'. SVGFEMergeNodeElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -466,7 +465,7 @@ extension type SVGFEMergeNodeElement._(JSObject _) /// The **`SVGFEMorphologyElement`** interface corresponds to the element. extension type SVGFEMorphologyElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGFEMorphologyElement] using the tag 'feMorphology'. + /// Creates an [SVGFEMorphologyElement] using the tag 'feMorphology'. SVGFEMorphologyElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -490,7 +489,7 @@ extension type SVGFEMorphologyElement._(JSObject _) /// The **`SVGFEOffsetElement`** interface corresponds to the element. extension type SVGFEOffsetElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGFEOffsetElement] using the tag 'feOffset'. + /// Creates an [SVGFEOffsetElement] using the tag 'feOffset'. SVGFEOffsetElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -511,7 +510,7 @@ extension type SVGFEOffsetElement._(JSObject _) /// element. extension type SVGFESpecularLightingElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGFESpecularLightingElement] using the tag + /// Creates an [SVGFESpecularLightingElement] using the tag /// 'feSpecularLighting'. SVGFESpecularLightingElement() : _ = document.createElementNS( @@ -534,7 +533,7 @@ extension type SVGFESpecularLightingElement._(JSObject _) /// The **`SVGFETileElement`** interface corresponds to the element. extension type SVGFETileElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGFETileElement] using the tag 'feTile'. + /// Creates an [SVGFETileElement] using the tag 'feTile'. SVGFETileElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -552,7 +551,7 @@ extension type SVGFETileElement._(JSObject _) implements SVGElement, JSObject { /// The **`SVGFETurbulenceElement`** interface corresponds to the element. extension type SVGFETurbulenceElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGFETurbulenceElement] using the tag 'feTurbulence'. + /// Creates an [SVGFETurbulenceElement] using the tag 'feTurbulence'. SVGFETurbulenceElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', diff --git a/lib/src/dom/html.dart b/lib/src/dom/html.dart index 7e66f348..71d36a71 100644 --- a/lib/src/dom/html.dart +++ b/lib/src/dom/html.dart @@ -199,160 +199,160 @@ extension type DOMStringList._(JSObject _) implements JSObject { /// elements directly implement this interface, while others implement it via an /// interface that inherits it. extension type HTMLElement._(JSObject _) implements Element, JSObject { - /// Creates a(n) [HTMLElement] using the tag 'article'. + /// Creates an [HTMLElement] using the tag 'article'. HTMLElement.article() : _ = document.createElement('article'); - /// Creates a(n) [HTMLElement] using the tag 'section'. + /// Creates an [HTMLElement] using the tag 'section'. HTMLElement.section() : _ = document.createElement('section'); - /// Creates a(n) [HTMLElement] using the tag 'nav'. + /// Creates an [HTMLElement] using the tag 'nav'. HTMLElement.nav() : _ = document.createElement('nav'); - /// Creates a(n) [HTMLElement] using the tag 'aside'. + /// Creates an [HTMLElement] using the tag 'aside'. HTMLElement.aside() : _ = document.createElement('aside'); - /// Creates a(n) [HTMLElement] using the tag 'hgroup'. + /// Creates an [HTMLElement] using the tag 'hgroup'. HTMLElement.hgroup() : _ = document.createElement('hgroup'); - /// Creates a(n) [HTMLElement] using the tag 'header'. + /// Creates an [HTMLElement] using the tag 'header'. HTMLElement.header() : _ = document.createElement('header'); - /// Creates a(n) [HTMLElement] using the tag 'footer'. + /// Creates an [HTMLElement] using the tag 'footer'. HTMLElement.footer() : _ = document.createElement('footer'); - /// Creates a(n) [HTMLElement] using the tag 'address'. + /// Creates an [HTMLElement] using the tag 'address'. HTMLElement.address() : _ = document.createElement('address'); - /// Creates a(n) [HTMLElement] using the tag 'dt'. + /// Creates an [HTMLElement] using the tag 'dt'. HTMLElement.dt() : _ = document.createElement('dt'); - /// Creates a(n) [HTMLElement] using the tag 'dd'. + /// Creates an [HTMLElement] using the tag 'dd'. HTMLElement.dd() : _ = document.createElement('dd'); - /// Creates a(n) [HTMLElement] using the tag 'figure'. + /// Creates an [HTMLElement] using the tag 'figure'. HTMLElement.figure() : _ = document.createElement('figure'); - /// Creates a(n) [HTMLElement] using the tag 'figcaption'. + /// Creates an [HTMLElement] using the tag 'figcaption'. HTMLElement.figcaption() : _ = document.createElement('figcaption'); - /// Creates a(n) [HTMLElement] using the tag 'main'. + /// Creates an [HTMLElement] using the tag 'main'. HTMLElement.main() : _ = document.createElement('main'); - /// Creates a(n) [HTMLElement] using the tag 'search'. + /// Creates an [HTMLElement] using the tag 'search'. HTMLElement.search() : _ = document.createElement('search'); - /// Creates a(n) [HTMLElement] using the tag 'em'. + /// Creates an [HTMLElement] using the tag 'em'. HTMLElement.em() : _ = document.createElement('em'); - /// Creates a(n) [HTMLElement] using the tag 'strong'. + /// Creates an [HTMLElement] using the tag 'strong'. HTMLElement.strong() : _ = document.createElement('strong'); - /// Creates a(n) [HTMLElement] using the tag 'small'. + /// Creates an [HTMLElement] using the tag 'small'. HTMLElement.small() : _ = document.createElement('small'); - /// Creates a(n) [HTMLElement] using the tag 's'. + /// Creates an [HTMLElement] using the tag 's'. HTMLElement.s() : _ = document.createElement('s'); - /// Creates a(n) [HTMLElement] using the tag 'cite'. + /// Creates an [HTMLElement] using the tag 'cite'. HTMLElement.cite() : _ = document.createElement('cite'); - /// Creates a(n) [HTMLElement] using the tag 'dfn'. + /// Creates an [HTMLElement] using the tag 'dfn'. HTMLElement.dfn() : _ = document.createElement('dfn'); - /// Creates a(n) [HTMLElement] using the tag 'abbr'. + /// Creates an [HTMLElement] using the tag 'abbr'. HTMLElement.abbr() : _ = document.createElement('abbr'); - /// Creates a(n) [HTMLElement] using the tag 'ruby'. + /// Creates an [HTMLElement] using the tag 'ruby'. HTMLElement.ruby() : _ = document.createElement('ruby'); - /// Creates a(n) [HTMLElement] using the tag 'rt'. + /// Creates an [HTMLElement] using the tag 'rt'. HTMLElement.rt() : _ = document.createElement('rt'); - /// Creates a(n) [HTMLElement] using the tag 'rp'. + /// Creates an [HTMLElement] using the tag 'rp'. HTMLElement.rp() : _ = document.createElement('rp'); - /// Creates a(n) [HTMLElement] using the tag 'code'. + /// Creates an [HTMLElement] using the tag 'code'. HTMLElement.code() : _ = document.createElement('code'); - /// Creates a(n) [HTMLElement] using the tag 'var'. + /// Creates an [HTMLElement] using the tag 'var'. HTMLElement.var_() : _ = document.createElement('var'); - /// Creates a(n) [HTMLElement] using the tag 'samp'. + /// Creates an [HTMLElement] using the tag 'samp'. HTMLElement.samp() : _ = document.createElement('samp'); - /// Creates a(n) [HTMLElement] using the tag 'kbd'. + /// Creates an [HTMLElement] using the tag 'kbd'. HTMLElement.kbd() : _ = document.createElement('kbd'); - /// Creates a(n) [HTMLElement] using the tag 'sub'. + /// Creates an [HTMLElement] using the tag 'sub'. HTMLElement.sub() : _ = document.createElement('sub'); - /// Creates a(n) [HTMLElement] using the tag 'sup'. + /// Creates an [HTMLElement] using the tag 'sup'. HTMLElement.sup() : _ = document.createElement('sup'); - /// Creates a(n) [HTMLElement] using the tag 'i'. + /// Creates an [HTMLElement] using the tag 'i'. HTMLElement.i() : _ = document.createElement('i'); - /// Creates a(n) [HTMLElement] using the tag 'b'. + /// Creates an [HTMLElement] using the tag 'b'. HTMLElement.b() : _ = document.createElement('b'); - /// Creates a(n) [HTMLElement] using the tag 'u'. + /// Creates an [HTMLElement] using the tag 'u'. HTMLElement.u() : _ = document.createElement('u'); - /// Creates a(n) [HTMLElement] using the tag 'mark'. + /// Creates an [HTMLElement] using the tag 'mark'. HTMLElement.mark() : _ = document.createElement('mark'); - /// Creates a(n) [HTMLElement] using the tag 'bdi'. + /// Creates an [HTMLElement] using the tag 'bdi'. HTMLElement.bdi() : _ = document.createElement('bdi'); - /// Creates a(n) [HTMLElement] using the tag 'bdo'. + /// Creates an [HTMLElement] using the tag 'bdo'. HTMLElement.bdo() : _ = document.createElement('bdo'); - /// Creates a(n) [HTMLElement] using the tag 'wbr'. + /// Creates an [HTMLElement] using the tag 'wbr'. HTMLElement.wbr() : _ = document.createElement('wbr'); - /// Creates a(n) [HTMLElement] using the tag 'summary'. + /// Creates an [HTMLElement] using the tag 'summary'. HTMLElement.summary() : _ = document.createElement('summary'); - /// Creates a(n) [HTMLElement] using the tag 'noscript'. + /// Creates an [HTMLElement] using the tag 'noscript'. HTMLElement.noscript() : _ = document.createElement('noscript'); - /// Creates a(n) [HTMLElement] using the tag 'acronym'. + /// Creates an [HTMLElement] using the tag 'acronym'. HTMLElement.acronym() : _ = document.createElement('acronym'); - /// Creates a(n) [HTMLElement] using the tag 'noframes'. + /// Creates an [HTMLElement] using the tag 'noframes'. HTMLElement.noframes() : _ = document.createElement('noframes'); - /// Creates a(n) [HTMLElement] using the tag 'menuitem'. + /// Creates an [HTMLElement] using the tag 'menuitem'. HTMLElement.menuitem() : _ = document.createElement('menuitem'); - /// Creates a(n) [HTMLElement] using the tag 'noembed'. + /// Creates an [HTMLElement] using the tag 'noembed'. HTMLElement.noembed() : _ = document.createElement('noembed'); - /// Creates a(n) [HTMLElement] using the tag 'plaintext'. + /// Creates an [HTMLElement] using the tag 'plaintext'. HTMLElement.plaintext() : _ = document.createElement('plaintext'); - /// Creates a(n) [HTMLElement] using the tag 'rb'. + /// Creates an [HTMLElement] using the tag 'rb'. HTMLElement.rb() : _ = document.createElement('rb'); - /// Creates a(n) [HTMLElement] using the tag 'rtc'. + /// Creates an [HTMLElement] using the tag 'rtc'. HTMLElement.rtc() : _ = document.createElement('rtc'); - /// Creates a(n) [HTMLElement] using the tag 'strike'. + /// Creates an [HTMLElement] using the tag 'strike'. HTMLElement.strike() : _ = document.createElement('strike'); - /// Creates a(n) [HTMLElement] using the tag 'basefont'. + /// Creates an [HTMLElement] using the tag 'basefont'. HTMLElement.basefont() : _ = document.createElement('basefont'); - /// Creates a(n) [HTMLElement] using the tag 'big'. + /// Creates an [HTMLElement] using the tag 'big'. HTMLElement.big() : _ = document.createElement('big'); - /// Creates a(n) [HTMLElement] using the tag 'center'. + /// Creates an [HTMLElement] using the tag 'center'. HTMLElement.center() : _ = document.createElement('center'); - /// Creates a(n) [HTMLElement] using the tag 'nobr'. + /// Creates an [HTMLElement] using the tag 'nobr'. HTMLElement.nobr() : _ = document.createElement('nobr'); - /// Creates a(n) [HTMLElement] using the tag 'tt'. + /// Creates an [HTMLElement] using the tag 'tt'. HTMLElement.tt() : _ = document.createElement('tt'); /// The **`HTMLElement.click()`** method simulates a mouse click on @@ -689,28 +689,28 @@ extension type HTMLElement._(JSObject _) implements Element, JSObject { /// additional properties or methods. extension type HTMLUnknownElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLUnknownElement] using the tag 'applet'. + /// Creates an [HTMLUnknownElement] using the tag 'applet'. HTMLUnknownElement.applet() : _ = document.createElement('applet'); - /// Creates a(n) [HTMLUnknownElement] using the tag 'bgsound'. + /// Creates an [HTMLUnknownElement] using the tag 'bgsound'. HTMLUnknownElement.bgsound() : _ = document.createElement('bgsound'); - /// Creates a(n) [HTMLUnknownElement] using the tag 'isindex'. + /// Creates an [HTMLUnknownElement] using the tag 'isindex'. HTMLUnknownElement.isindex() : _ = document.createElement('isindex'); - /// Creates a(n) [HTMLUnknownElement] using the tag 'keygen'. + /// Creates an [HTMLUnknownElement] using the tag 'keygen'. HTMLUnknownElement.keygen() : _ = document.createElement('keygen'); - /// Creates a(n) [HTMLUnknownElement] using the tag 'nextid'. + /// Creates an [HTMLUnknownElement] using the tag 'nextid'. HTMLUnknownElement.nextid() : _ = document.createElement('nextid'); - /// Creates a(n) [HTMLUnknownElement] using the tag 'blink'. + /// Creates an [HTMLUnknownElement] using the tag 'blink'. HTMLUnknownElement.blink() : _ = document.createElement('blink'); - /// Creates a(n) [HTMLUnknownElement] using the tag 'multicol'. + /// Creates an [HTMLUnknownElement] using the tag 'multicol'. HTMLUnknownElement.multicol() : _ = document.createElement('multicol'); - /// Creates a(n) [HTMLUnknownElement] using the tag 'spacer'. + /// Creates an [HTMLUnknownElement] using the tag 'spacer'. HTMLUnknownElement.spacer() : _ = document.createElement('spacer'); } @@ -725,7 +725,7 @@ extension type DOMStringMap._(JSObject _) implements JSObject {} /// You can retrieve the `HTMLHtmlElement` object for a given document by /// reading the value of the [document.documentElement] property. extension type HTMLHtmlElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLHtmlElement] using the tag 'html'. + /// Creates an [HTMLHtmlElement] using the tag 'html'. HTMLHtmlElement() : _ = document.createElement('html'); external set version(String value); @@ -736,7 +736,7 @@ extension type HTMLHtmlElement._(JSObject _) implements HTMLElement, JSObject { /// metadata, for a document. This object inherits all of the properties and /// methods described in the [HTMLElement] interface. extension type HTMLHeadElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLHeadElement] using the tag 'head'. + /// Creates an [HTMLHeadElement] using the tag 'head'. HTMLHeadElement() : _ = document.createElement('head'); } @@ -744,7 +744,7 @@ extension type HTMLHeadElement._(JSObject _) implements HTMLElement, JSObject { /// This element inherits all of the properties and methods of the [HTMLElement] /// interface. extension type HTMLTitleElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLTitleElement] using the tag 'title'. + /// Creates an [HTMLTitleElement] using the tag 'title'. HTMLTitleElement() : _ = document.createElement('title'); external set text(String value); @@ -755,7 +755,7 @@ extension type HTMLTitleElement._(JSObject _) implements HTMLElement, JSObject { /// This object inherits all of the properties and methods as described in the /// [HTMLElement] interface. extension type HTMLBaseElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLBaseElement] using the tag 'base'. + /// Creates an [HTMLBaseElement] using the tag 'base'. HTMLBaseElement() : _ = document.createElement('base'); external set href(String value); @@ -773,7 +773,7 @@ extension type HTMLBaseElement._(JSObject _) implements HTMLElement, JSObject { /// This object inherits all of the properties and methods of the [HTMLElement] /// interface. extension type HTMLLinkElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLLinkElement] using the tag 'link'. + /// Creates an [HTMLLinkElement] using the tag 'link'. HTMLLinkElement() : _ = document.createElement('link'); external set href(String value); @@ -820,7 +820,7 @@ extension type HTMLLinkElement._(JSObject _) implements HTMLElement, JSObject { /// This interface inherits all of the properties and methods described in the /// [HTMLElement] interface. extension type HTMLMetaElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLMetaElement] using the tag 'meta'. + /// Creates an [HTMLMetaElement] using the tag 'meta'. HTMLMetaElement() : _ = document.createElement('meta'); external set name(String value); @@ -844,7 +844,7 @@ extension type HTMLMetaElement._(JSObject _) implements HTMLElement, JSObject { /// for an overview of the objects used to manipulate specified CSS properties /// using the DOM. extension type HTMLStyleElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLStyleElement] using the tag 'style'. + /// Creates an [HTMLStyleElement] using the tag 'style'. HTMLStyleElement() : _ = document.createElement('style'); external set disabled(bool value); @@ -861,7 +861,7 @@ extension type HTMLStyleElement._(JSObject _) implements HTMLElement, JSObject { /// those inherited from the regular [HTMLElement] interface) for manipulating /// `body` elements. extension type HTMLBodyElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLBodyElement] using the tag 'body'. + /// Creates an [HTMLBodyElement] using the tag 'body'. HTMLBodyElement() : _ = document.createElement('body'); external set text(String value); @@ -922,22 +922,22 @@ extension type HTMLBodyElement._(JSObject _) implements HTMLElement, JSObject { /// and properties from the [HTMLElement] interface. extension type HTMLHeadingElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLHeadingElement] using the tag 'h1'. + /// Creates an [HTMLHeadingElement] using the tag 'h1'. HTMLHeadingElement.h1() : _ = document.createElement('h1'); - /// Creates a(n) [HTMLHeadingElement] using the tag 'h2'. + /// Creates an [HTMLHeadingElement] using the tag 'h2'. HTMLHeadingElement.h2() : _ = document.createElement('h2'); - /// Creates a(n) [HTMLHeadingElement] using the tag 'h3'. + /// Creates an [HTMLHeadingElement] using the tag 'h3'. HTMLHeadingElement.h3() : _ = document.createElement('h3'); - /// Creates a(n) [HTMLHeadingElement] using the tag 'h4'. + /// Creates an [HTMLHeadingElement] using the tag 'h4'. HTMLHeadingElement.h4() : _ = document.createElement('h4'); - /// Creates a(n) [HTMLHeadingElement] using the tag 'h5'. + /// Creates an [HTMLHeadingElement] using the tag 'h5'. HTMLHeadingElement.h5() : _ = document.createElement('h5'); - /// Creates a(n) [HTMLHeadingElement] using the tag 'h6'. + /// Creates an [HTMLHeadingElement] using the tag 'h6'. HTMLHeadingElement.h6() : _ = document.createElement('h6'); external set align(String value); @@ -949,7 +949,7 @@ extension type HTMLHeadingElement._(JSObject _) /// manipulating `p` elements. extension type HTMLParagraphElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLParagraphElement] using the tag 'p'. + /// Creates an [HTMLParagraphElement] using the tag 'p'. HTMLParagraphElement() : _ = document.createElement('p'); external set align(String value); @@ -960,7 +960,7 @@ extension type HTMLParagraphElement._(JSObject _) /// of the [HTMLElement] interface it also has available to it by inheritance) /// for manipulating `hr` elements. extension type HTMLHRElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLHRElement] using the tag 'hr'. + /// Creates an [HTMLHRElement] using the tag 'hr'. HTMLHRElement() : _ = document.createElement('hr'); external set align(String value); @@ -979,13 +979,13 @@ extension type HTMLHRElement._(JSObject _) implements HTMLElement, JSObject { /// (beyond those of the [HTMLElement] interface it also has available to it by /// inheritance) for manipulating a block of preformatted text (`pre`). extension type HTMLPreElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLPreElement] using the tag 'pre'. + /// Creates an [HTMLPreElement] using the tag 'pre'. HTMLPreElement.pre() : _ = document.createElement('pre'); - /// Creates a(n) [HTMLPreElement] using the tag 'listing'. + /// Creates an [HTMLPreElement] using the tag 'listing'. HTMLPreElement.listing() : _ = document.createElement('listing'); - /// Creates a(n) [HTMLPreElement] using the tag 'xmp'. + /// Creates an [HTMLPreElement] using the tag 'xmp'. HTMLPreElement.xmp() : _ = document.createElement('xmp'); external set width(int value); @@ -997,10 +997,10 @@ extension type HTMLPreElement._(JSObject _) implements HTMLElement, JSObject { /// inheritance) for manipulating quoting elements, like `blockquote` and `q`, /// but not the `cite` element. extension type HTMLQuoteElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLQuoteElement] using the tag 'blockquote'. + /// Creates an [HTMLQuoteElement] using the tag 'blockquote'. HTMLQuoteElement.blockquote() : _ = document.createElement('blockquote'); - /// Creates a(n) [HTMLQuoteElement] using the tag 'q'. + /// Creates an [HTMLQuoteElement] using the tag 'q'. HTMLQuoteElement.q() : _ = document.createElement('q'); external set cite(String value); @@ -1011,7 +1011,7 @@ extension type HTMLQuoteElement._(JSObject _) implements HTMLElement, JSObject { /// those defined on the regular [HTMLElement] interface it also has available /// to it by inheritance) for manipulating ordered list elements. extension type HTMLOListElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLOListElement] using the tag 'ol'. + /// Creates an [HTMLOListElement] using the tag 'ol'. HTMLOListElement() : _ = document.createElement('ol'); external set reversed(bool value); @@ -1028,7 +1028,7 @@ extension type HTMLOListElement._(JSObject _) implements HTMLElement, JSObject { /// those defined on the regular [HTMLElement] interface it also has available /// to it by inheritance) for manipulating unordered list (`ul`) elements. extension type HTMLUListElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLUListElement] using the tag 'ul'. + /// Creates an [HTMLUListElement] using the tag 'ul'. HTMLUListElement() : _ = document.createElement('ul'); external set compact(bool value); @@ -1042,7 +1042,7 @@ extension type HTMLUListElement._(JSObject _) implements HTMLElement, JSObject { /// element. /// `` is a semantic alternative to the `ul` element. extension type HTMLMenuElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLMenuElement] using the tag 'menu'. + /// Creates an [HTMLMenuElement] using the tag 'menu'. HTMLMenuElement() : _ = document.createElement('menu'); external set compact(bool value); @@ -1053,7 +1053,7 @@ extension type HTMLMenuElement._(JSObject _) implements HTMLElement, JSObject { /// (beyond those defined by regular [HTMLElement] interface it also has /// available to it by inheritance) for manipulating list elements. extension type HTMLLIElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLLIElement] using the tag 'li'. + /// Creates an [HTMLLIElement] using the tag 'li'. HTMLLIElement() : _ = document.createElement('li'); external set value(int value); @@ -1066,7 +1066,7 @@ extension type HTMLLIElement._(JSObject _) implements HTMLElement, JSObject { /// those of the regular [HTMLElement] interface it also has available to it by /// inheritance) for manipulating definition list (`dl`) elements. extension type HTMLDListElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLDListElement] using the tag 'dl'. + /// Creates an [HTMLDListElement] using the tag 'dl'. HTMLDListElement() : _ = document.createElement('dl'); external set compact(bool value); @@ -1077,7 +1077,7 @@ extension type HTMLDListElement._(JSObject _) implements HTMLElement, JSObject { /// regular [HTMLElement] interface it also has available to it by inheritance) /// for manipulating `div` elements. extension type HTMLDivElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLDivElement] using the tag 'div'. + /// Creates an [HTMLDivElement] using the tag 'div'. HTMLDivElement() : _ = document.createElement('div'); external set align(String value); @@ -1093,7 +1093,7 @@ extension type HTMLDivElement._(JSObject _) implements HTMLElement, JSObject { /// [`HTMLLinkElement`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement). extension type HTMLAnchorElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLAnchorElement] using the tag 'a'. + /// Creates an [HTMLAnchorElement] using the tag 'a'. HTMLAnchorElement() : _ = document.createElement('a'); external set target(String value); @@ -1150,7 +1150,7 @@ extension type HTMLAnchorElement._(JSObject _) /// regular [HTMLElement] interface it also has available to it by inheritance) /// for manipulating `data` elements. extension type HTMLDataElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLDataElement] using the tag 'data'. + /// Creates an [HTMLDataElement] using the tag 'data'. HTMLDataElement() : _ = document.createElement('data'); external set value(String value); @@ -1161,7 +1161,7 @@ extension type HTMLDataElement._(JSObject _) implements HTMLElement, JSObject { /// regular [HTMLElement] interface it also has available to it by inheritance) /// for manipulating `time` elements. extension type HTMLTimeElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLTimeElement] using the tag 'time'. + /// Creates an [HTMLTimeElement] using the tag 'time'. HTMLTimeElement() : _ = document.createElement('time'); external set dateTime(String value); @@ -1172,14 +1172,14 @@ extension type HTMLTimeElement._(JSObject _) implements HTMLElement, JSObject { /// from the [HTMLElement] interface, but without implementing any additional /// properties or methods. extension type HTMLSpanElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLSpanElement] using the tag 'span'. + /// Creates an [HTMLSpanElement] using the tag 'span'. HTMLSpanElement() : _ = document.createElement('span'); } /// The **`HTMLBRElement`** interface represents an HTML line break element /// (`br`). It inherits from [HTMLElement]. extension type HTMLBRElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLBRElement] using the tag 'br'. + /// Creates an [HTMLBRElement] using the tag 'br'. HTMLBRElement() : _ = document.createElement('br'); external set clear(String value); @@ -1191,10 +1191,10 @@ extension type HTMLBRElement._(JSObject _) implements HTMLElement, JSObject { /// they also have available to them by inheritance) for manipulating /// modification elements, that is `del` and `ins`. extension type HTMLModElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLModElement] using the tag 'ins'. + /// Creates an [HTMLModElement] using the tag 'ins'. HTMLModElement.ins() : _ = document.createElement('ins'); - /// Creates a(n) [HTMLModElement] using the tag 'del'. + /// Creates an [HTMLModElement] using the tag 'del'. HTMLModElement.del() : _ = document.createElement('del'); external set cite(String value); @@ -1207,7 +1207,7 @@ extension type HTMLModElement._(JSObject _) implements HTMLElement, JSObject { /// It doesn't implement specific properties or methods. extension type HTMLPictureElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLPictureElement] using the tag 'picture'. + /// Creates an [HTMLPictureElement] using the tag 'picture'. HTMLPictureElement() : _ = document.createElement('picture'); } @@ -1216,7 +1216,7 @@ extension type HTMLPictureElement._(JSObject _) /// inheritance) for manipulating `source` elements. extension type HTMLSourceElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLSourceElement] using the tag 'source'. + /// Creates an [HTMLSourceElement] using the tag 'source'. HTMLSourceElement() : _ = document.createElement('source'); external set src(String value); @@ -1238,7 +1238,7 @@ extension type HTMLSourceElement._(JSObject _) /// The **`HTMLImageElement`** interface represents an HTML `img` element, /// providing the properties and methods used to manipulate image elements. extension type HTMLImageElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLImageElement] using the tag 'img'. + /// Creates an [HTMLImageElement] using the tag 'img'. HTMLImageElement() : _ = document.createElement('img'); /// The **`decode()`** @@ -1309,7 +1309,7 @@ extension type HTMLImageElement._(JSObject _) implements HTMLElement, JSObject { /// frame elements. extension type HTMLIFrameElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLIFrameElement] using the tag 'iframe'. + /// Creates an [HTMLIFrameElement] using the tag 'iframe'. HTMLIFrameElement() : _ = document.createElement('iframe'); external Document? getSVGDocument(); @@ -1356,7 +1356,7 @@ extension type HTMLIFrameElement._(JSObject _) /// > in the standard. It does not address earlier, non-standardized version of /// > the interface. extension type HTMLEmbedElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLEmbedElement] using the tag 'embed'. + /// Creates an [HTMLEmbedElement] using the tag 'embed'. HTMLEmbedElement() : _ = document.createElement('embed'); external Document? getSVGDocument(); @@ -1380,7 +1380,7 @@ extension type HTMLEmbedElement._(JSObject _) implements HTMLElement, JSObject { /// `object` element, representing external resources. extension type HTMLObjectElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLObjectElement] using the tag 'object'. + /// Creates an [HTMLObjectElement] using the tag 'object'. HTMLObjectElement() : _ = document.createElement('object'); external Document? getSVGDocument(); @@ -1449,7 +1449,7 @@ extension type HTMLObjectElement._(JSObject _) /// need to support are covered. extension type HTMLVideoElement._(JSObject _) implements HTMLMediaElement, JSObject { - /// Creates a(n) [HTMLVideoElement] using the tag 'video'. + /// Creates an [HTMLVideoElement] using the tag 'video'. HTMLVideoElement() : _ = document.createElement('video'); /// The **[HTMLVideoElement]** method @@ -1478,7 +1478,7 @@ extension type HTMLVideoElement._(JSObject _) /// [HTMLMediaElement] interface. extension type HTMLAudioElement._(JSObject _) implements HTMLMediaElement, JSObject { - /// Creates a(n) [HTMLAudioElement] using the tag 'audio'. + /// Creates an [HTMLAudioElement] using the tag 'audio'. HTMLAudioElement() : _ = document.createElement('audio'); } @@ -1487,7 +1487,7 @@ extension type HTMLAudioElement._(JSObject _) /// specify a text track containing information such as closed captions or /// subtitles. extension type HTMLTrackElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLTrackElement] using the tag 'track'. + /// Creates an [HTMLTrackElement] using the tag 'track'. HTMLTrackElement() : _ = document.createElement('track'); external static int get NONE; @@ -1881,7 +1881,7 @@ extension type TrackEventInit._(JSObject _) implements EventInit, JSObject { /// available to it by inheritance) for manipulating the layout and presentation /// of map elements. extension type HTMLMapElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLMapElement] using the tag 'map'. + /// Creates an [HTMLMapElement] using the tag 'map'. HTMLMapElement() : _ = document.createElement('map'); external set name(String value); @@ -1894,7 +1894,7 @@ extension type HTMLMapElement._(JSObject _) implements HTMLElement, JSObject { /// available to it by inheritance) for manipulating the layout and presentation /// of `area` elements. extension type HTMLAreaElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLAreaElement] using the tag 'area'. + /// Creates an [HTMLAreaElement] using the tag 'area'. HTMLAreaElement() : _ = document.createElement('area'); external set alt(String value); @@ -1944,7 +1944,7 @@ extension type HTMLAreaElement._(JSObject _) implements HTMLElement, JSObject { /// it by inheritance) for manipulating the layout and presentation of tables in /// an HTML document. extension type HTMLTableElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLTableElement] using the tag 'table'. + /// Creates an [HTMLTableElement] using the tag 'table'. HTMLTableElement() : _ = document.createElement('table'); /// The **`HTMLTableElement.createCaption()`** method returns the @@ -2065,7 +2065,7 @@ extension type HTMLTableElement._(JSObject _) implements HTMLElement, JSObject { /// inheritance) for manipulating table `caption` elements. extension type HTMLTableCaptionElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLTableCaptionElement] using the tag 'caption'. + /// Creates an [HTMLTableCaptionElement] using the tag 'caption'. HTMLTableCaptionElement() : _ = document.createElement('caption'); external set align(String value); @@ -2076,10 +2076,10 @@ extension type HTMLTableCaptionElement._(JSObject _) /// single or grouped table column elements. extension type HTMLTableColElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLTableColElement] using the tag 'colgroup'. + /// Creates an [HTMLTableColElement] using the tag 'colgroup'. HTMLTableColElement.colgroup() : _ = document.createElement('colgroup'); - /// Creates a(n) [HTMLTableColElement] using the tag 'col'. + /// Creates an [HTMLTableColElement] using the tag 'col'. HTMLTableColElement.col() : _ = document.createElement('col'); external set span(int value); @@ -2103,13 +2103,13 @@ extension type HTMLTableColElement._(JSObject _) /// in an HTML table. extension type HTMLTableSectionElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLTableSectionElement] using the tag 'tbody'. + /// Creates an [HTMLTableSectionElement] using the tag 'tbody'. HTMLTableSectionElement.tbody() : _ = document.createElement('tbody'); - /// Creates a(n) [HTMLTableSectionElement] using the tag 'thead'. + /// Creates an [HTMLTableSectionElement] using the tag 'thead'. HTMLTableSectionElement.thead() : _ = document.createElement('thead'); - /// Creates a(n) [HTMLTableSectionElement] using the tag 'tfoot'. + /// Creates an [HTMLTableSectionElement] using the tag 'tfoot'. HTMLTableSectionElement.tfoot() : _ = document.createElement('tfoot'); external HTMLTableRowElement insertRow([int index]); @@ -2131,7 +2131,7 @@ extension type HTMLTableSectionElement._(JSObject _) /// table. extension type HTMLTableRowElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLTableRowElement] using the tag 'tr'. + /// Creates an [HTMLTableRowElement] using the tag 'tr'. HTMLTableRowElement() : _ = document.createElement('tr'); /// The **`HTMLTableRowElement.insertCell()`** method inserts a new @@ -2170,10 +2170,10 @@ extension type HTMLTableRowElement._(JSObject _) /// document. extension type HTMLTableCellElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLTableCellElement] using the tag 'td'. + /// Creates an [HTMLTableCellElement] using the tag 'td'. HTMLTableCellElement.td() : _ = document.createElement('td'); - /// Creates a(n) [HTMLTableCellElement] using the tag 'th'. + /// Creates an [HTMLTableCellElement] using the tag 'th'. HTMLTableCellElement.th() : _ = document.createElement('th'); external set colSpan(int value); @@ -2211,7 +2211,7 @@ extension type HTMLTableCellElement._(JSObject _) /// It allows access to—and, in some cases, modification of—aspects of the form, /// as well as access to its component elements. extension type HTMLFormElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLFormElement] using the tag 'form'. + /// Creates an [HTMLFormElement] using the tag 'form'. HTMLFormElement() : _ = document.createElement('form'); /// The **`HTMLFormElement.submit()`** method submits a given @@ -2299,7 +2299,7 @@ extension type HTMLFormElement._(JSObject _) implements HTMLElement, JSObject { /// `label` elements. It inherits methods and properties from the base /// [HTMLElement] interface. extension type HTMLLabelElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLLabelElement] using the tag 'label'. + /// Creates an [HTMLLabelElement] using the tag 'label'. HTMLLabelElement() : _ = document.createElement('label'); external HTMLFormElement? get form; @@ -2311,7 +2311,7 @@ extension type HTMLLabelElement._(JSObject _) implements HTMLElement, JSObject { /// The **`HTMLInputElement`** interface provides special properties and methods /// for manipulating the options, layout, and presentation of `input` elements. extension type HTMLInputElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLInputElement] using the tag 'input'. + /// Creates an [HTMLInputElement] using the tag 'input'. HTMLInputElement() : _ = document.createElement('input'); /// The **`HTMLInputElement.stepUp()`** method increments the value @@ -2725,7 +2725,7 @@ extension type HTMLInputElement._(JSObject _) implements HTMLElement, JSObject { /// inheritance) for manipulating `button` elements. extension type HTMLButtonElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLButtonElement] using the tag 'button'. + /// Creates an [HTMLButtonElement] using the tag 'button'. HTMLButtonElement() : _ = document.createElement('button'); external bool checkValidity(); @@ -2765,7 +2765,7 @@ extension type HTMLButtonElement._(JSObject _) /// elements via the [HTMLElement] interface. extension type HTMLSelectElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLSelectElement] using the tag 'select'. + /// Creates an [HTMLSelectElement] using the tag 'select'. HTMLSelectElement() : _ = document.createElement('select'); /// The **`HTMLSelectElement.item()`** method returns the @@ -2858,7 +2858,7 @@ extension type HTMLSelectElement._(JSObject _) /// inheritance) to manipulate `datalist` elements and their content. extension type HTMLDataListElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLDataListElement] using the tag 'datalist'. + /// Creates an [HTMLDataListElement] using the tag 'datalist'. HTMLDataListElement() : _ = document.createElement('datalist'); external HTMLCollection get options; @@ -2870,7 +2870,7 @@ extension type HTMLDataListElement._(JSObject _) /// presentation of `optgroup` elements. extension type HTMLOptGroupElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLOptGroupElement] using the tag 'optgroup'. + /// Creates an [HTMLOptGroupElement] using the tag 'optgroup'. HTMLOptGroupElement() : _ = document.createElement('optgroup'); external set disabled(bool value); @@ -2883,7 +2883,7 @@ extension type HTMLOptGroupElement._(JSObject _) /// inherits all properties and methods of the [HTMLElement] interface. extension type HTMLOptionElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLOptionElement] using the tag 'option'. + /// Creates an [HTMLOptionElement] using the tag 'option'. HTMLOptionElement() : _ = document.createElement('option'); external set disabled(bool value); @@ -2906,7 +2906,7 @@ extension type HTMLOptionElement._(JSObject _) /// methods for manipulating the layout and presentation of `textarea` elements. extension type HTMLTextAreaElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLTextAreaElement] using the tag 'textarea'. + /// Creates an [HTMLTextAreaElement] using the tag 'textarea'. HTMLTextAreaElement() : _ = document.createElement('textarea'); external bool checkValidity(); @@ -2972,7 +2972,7 @@ extension type HTMLTextAreaElement._(JSObject _) /// presentation of `output` elements. extension type HTMLOutputElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLOutputElement] using the tag 'output'. + /// Creates an [HTMLOutputElement] using the tag 'output'. HTMLOutputElement() : _ = document.createElement('output'); external bool checkValidity(); @@ -2999,7 +2999,7 @@ extension type HTMLOutputElement._(JSObject _) /// `progress` elements. extension type HTMLProgressElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLProgressElement] using the tag 'progress'. + /// Creates an [HTMLProgressElement] using the tag 'progress'. HTMLProgressElement() : _ = document.createElement('progress'); external set value(num value); @@ -3015,7 +3015,7 @@ extension type HTMLProgressElement._(JSObject _) /// interface they also have available to them by inheritance) for manipulating /// the layout and presentation of `meter` elements. extension type HTMLMeterElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLMeterElement] using the tag 'meter'. + /// Creates an [HTMLMeterElement] using the tag 'meter'. HTMLMeterElement() : _ = document.createElement('meter'); external set value(num value); @@ -3039,7 +3039,7 @@ extension type HTMLMeterElement._(JSObject _) implements HTMLElement, JSObject { /// `fieldset` elements. extension type HTMLFieldSetElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLFieldSetElement] using the tag 'fieldset'. + /// Creates an [HTMLFieldSetElement] using the tag 'fieldset'. HTMLFieldSetElement() : _ = document.createElement('fieldset'); external bool checkValidity(); @@ -3062,7 +3062,7 @@ extension type HTMLFieldSetElement._(JSObject _) /// [HTMLElement] interface. extension type HTMLLegendElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLLegendElement] using the tag 'legend'. + /// Creates an [HTMLLegendElement] using the tag 'legend'. HTMLLegendElement() : _ = document.createElement('legend'); external HTMLFormElement? get form; @@ -3136,7 +3136,7 @@ extension type FormDataEventInit._(JSObject _) implements EventInit, JSObject { /// inheritance) for manipulating `details` elements. extension type HTMLDetailsElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLDetailsElement] using the tag 'details'. + /// Creates an [HTMLDetailsElement] using the tag 'details'. HTMLDetailsElement() : _ = document.createElement('details'); external set name(String value); @@ -3150,7 +3150,7 @@ extension type HTMLDetailsElement._(JSObject _) /// interface. extension type HTMLDialogElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLDialogElement] using the tag 'dialog'. + /// Creates an [HTMLDialogElement] using the tag 'dialog'. HTMLDialogElement() : _ = document.createElement('dialog'); /// The **`show()`** method of the [HTMLDialogElement] @@ -3192,7 +3192,7 @@ extension type HTMLDialogElement._(JSObject _) /// [Window/load_event] event. extension type HTMLScriptElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLScriptElement] using the tag 'script'. + /// Creates an [HTMLScriptElement] using the tag 'script'. HTMLScriptElement() : _ = document.createElement('script'); external static bool supports(String type); @@ -3229,7 +3229,7 @@ extension type HTMLScriptElement._(JSObject _) /// HTML `template` element. extension type HTMLTemplateElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLTemplateElement] using the tag 'template'. + /// Creates an [HTMLTemplateElement] using the tag 'template'. HTMLTemplateElement() : _ = document.createElement('template'); external DocumentFragment get content; @@ -3243,7 +3243,7 @@ extension type HTMLTemplateElement._(JSObject _) /// [Shadow DOM API](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM) /// enables access to the name and assigned nodes of an HTML `slot` element. extension type HTMLSlotElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLSlotElement] using the tag 'slot'. + /// Creates an [HTMLSlotElement] using the tag 'slot'. HTMLSlotElement() : _ = document.createElement('slot'); /// The **`assignedNodes()`** method of the [HTMLSlotElement] interface @@ -3292,7 +3292,7 @@ extension type AssignedNodesOptions._(JSObject _) implements JSObject { /// the [HTMLElement] interface. extension type HTMLCanvasElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLCanvasElement] using the tag 'canvas'. + /// Creates an [HTMLCanvasElement] using the tag 'canvas'. HTMLCanvasElement() : _ = document.createElement('canvas'); /// The @@ -7343,7 +7343,7 @@ extension type StorageEventInit._(JSObject _) implements EventInit, JSObject { /// It inherits properties and methods from the [HTMLElement] interface. extension type HTMLMarqueeElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLMarqueeElement] using the tag 'marquee'. + /// Creates an [HTMLMarqueeElement] using the tag 'marquee'. HTMLMarqueeElement() : _ = document.createElement('marquee'); external void start(); @@ -7377,7 +7377,7 @@ extension type HTMLMarqueeElement._(JSObject _) /// manipulating `frameset` elements. extension type HTMLFrameSetElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLFrameSetElement] using the tag 'frameset'. + /// Creates an [HTMLFrameSetElement] using the tag 'frameset'. HTMLFrameSetElement() : _ = document.createElement('frameset'); external set cols(String value); @@ -7424,7 +7424,7 @@ extension type HTMLFrameSetElement._(JSObject _) external EventHandler get onunload; } extension type HTMLFrameElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLFrameElement] using the tag 'frame'. + /// Creates an [HTMLFrameElement] using the tag 'frame'. HTMLFrameElement() : _ = document.createElement('frame'); external set name(String value); @@ -7448,7 +7448,7 @@ extension type HTMLFrameElement._(JSObject _) implements HTMLElement, JSObject { } extension type HTMLDirectoryElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLDirectoryElement] using the tag 'dir'. + /// Creates an [HTMLDirectoryElement] using the tag 'dir'. HTMLDirectoryElement() : _ = document.createElement('dir'); external set compact(bool value); @@ -7459,7 +7459,7 @@ extension type HTMLDirectoryElement._(JSObject _) /// element. The HTML Font Element `font` defines the font size, font face and /// color of text. extension type HTMLFontElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLFontElement] using the tag 'font'. + /// Creates an [HTMLFontElement] using the tag 'font'. HTMLFontElement() : _ = document.createElement('font'); external set color(String value); @@ -7475,7 +7475,7 @@ extension type HTMLFontElement._(JSObject _) implements HTMLElement, JSObject { /// manipulating `param` elements, representing a pair of a key and a value that /// acts as a parameter for an `object` element. extension type HTMLParamElement._(JSObject _) implements HTMLElement, JSObject { - /// Creates a(n) [HTMLParamElement] using the tag 'param'. + /// Creates an [HTMLParamElement] using the tag 'param'. HTMLParamElement() : _ = document.createElement('param'); external set name(String value); diff --git a/lib/src/dom/mathml_core.dart b/lib/src/dom/mathml_core.dart index 3a468853..ca3f6566 100644 --- a/lib/src/dom/mathml_core.dart +++ b/lib/src/dom/mathml_core.dart @@ -21,210 +21,210 @@ import 'html.dart'; /// The **`MathMLElement`** interface represents any /// [MathML](https://developer.mozilla.org/en-US/docs/Web/MathML) element. extension type MathMLElement._(JSObject _) implements Element, JSObject { - /// Creates a(n) [MathMLElement] using the tag 'math'. + /// Creates a [MathMLElement] using the tag 'math'. MathMLElement.math() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', 'math', ); - /// Creates a(n) [MathMLElement] using the tag 'mtext'. + /// Creates a [MathMLElement] using the tag 'mtext'. MathMLElement.mtext() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', 'mtext', ); - /// Creates a(n) [MathMLElement] using the tag 'mi'. + /// Creates a [MathMLElement] using the tag 'mi'. MathMLElement.mi() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', 'mi', ); - /// Creates a(n) [MathMLElement] using the tag 'mn'. + /// Creates a [MathMLElement] using the tag 'mn'. MathMLElement.mn() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', 'mn', ); - /// Creates a(n) [MathMLElement] using the tag 'mo'. + /// Creates a [MathMLElement] using the tag 'mo'. MathMLElement.mo() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', 'mo', ); - /// Creates a(n) [MathMLElement] using the tag 'mspace'. + /// Creates a [MathMLElement] using the tag 'mspace'. MathMLElement.mspace() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', 'mspace', ); - /// Creates a(n) [MathMLElement] using the tag 'ms'. + /// Creates a [MathMLElement] using the tag 'ms'. MathMLElement.ms() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', 'ms', ); - /// Creates a(n) [MathMLElement] using the tag 'mrow'. + /// Creates a [MathMLElement] using the tag 'mrow'. MathMLElement.mrow() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', 'mrow', ); - /// Creates a(n) [MathMLElement] using the tag 'mfrac'. + /// Creates a [MathMLElement] using the tag 'mfrac'. MathMLElement.mfrac() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', 'mfrac', ); - /// Creates a(n) [MathMLElement] using the tag 'msqrt'. + /// Creates a [MathMLElement] using the tag 'msqrt'. MathMLElement.msqrt() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', 'msqrt', ); - /// Creates a(n) [MathMLElement] using the tag 'mroot'. + /// Creates a [MathMLElement] using the tag 'mroot'. MathMLElement.mroot() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', 'mroot', ); - /// Creates a(n) [MathMLElement] using the tag 'mstyle'. + /// Creates a [MathMLElement] using the tag 'mstyle'. MathMLElement.mstyle() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', 'mstyle', ); - /// Creates a(n) [MathMLElement] using the tag 'merror'. + /// Creates a [MathMLElement] using the tag 'merror'. MathMLElement.merror() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', 'merror', ); - /// Creates a(n) [MathMLElement] using the tag 'mpadded'. + /// Creates a [MathMLElement] using the tag 'mpadded'. MathMLElement.mpadded() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', 'mpadded', ); - /// Creates a(n) [MathMLElement] using the tag 'mphantom'. + /// Creates a [MathMLElement] using the tag 'mphantom'. MathMLElement.mphantom() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', 'mphantom', ); - /// Creates a(n) [MathMLElement] using the tag 'msub'. + /// Creates a [MathMLElement] using the tag 'msub'. MathMLElement.msub() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', 'msub', ); - /// Creates a(n) [MathMLElement] using the tag 'msup'. + /// Creates a [MathMLElement] using the tag 'msup'. MathMLElement.msup() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', 'msup', ); - /// Creates a(n) [MathMLElement] using the tag 'msubsup'. + /// Creates a [MathMLElement] using the tag 'msubsup'. MathMLElement.msubsup() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', 'msubsup', ); - /// Creates a(n) [MathMLElement] using the tag 'munder'. + /// Creates a [MathMLElement] using the tag 'munder'. MathMLElement.munder() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', 'munder', ); - /// Creates a(n) [MathMLElement] using the tag 'mover'. + /// Creates a [MathMLElement] using the tag 'mover'. MathMLElement.mover() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', 'mover', ); - /// Creates a(n) [MathMLElement] using the tag 'munderover'. + /// Creates a [MathMLElement] using the tag 'munderover'. MathMLElement.munderover() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', 'munderover', ); - /// Creates a(n) [MathMLElement] using the tag 'mmultiscripts'. + /// Creates a [MathMLElement] using the tag 'mmultiscripts'. MathMLElement.mmultiscripts() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', 'mmultiscripts', ); - /// Creates a(n) [MathMLElement] using the tag 'mprescripts'. + /// Creates a [MathMLElement] using the tag 'mprescripts'. MathMLElement.mprescripts() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', 'mprescripts', ); - /// Creates a(n) [MathMLElement] using the tag 'mtable'. + /// Creates a [MathMLElement] using the tag 'mtable'. MathMLElement.mtable() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', 'mtable', ); - /// Creates a(n) [MathMLElement] using the tag 'mtr'. + /// Creates a [MathMLElement] using the tag 'mtr'. MathMLElement.mtr() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', 'mtr', ); - /// Creates a(n) [MathMLElement] using the tag 'mtd'. + /// Creates a [MathMLElement] using the tag 'mtd'. MathMLElement.mtd() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', 'mtd', ); - /// Creates a(n) [MathMLElement] using the tag 'maction'. + /// Creates a [MathMLElement] using the tag 'maction'. MathMLElement.maction() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', 'maction', ); - /// Creates a(n) [MathMLElement] using the tag 'semantics'. + /// Creates a [MathMLElement] using the tag 'semantics'. MathMLElement.semantics() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', 'semantics', ); - /// Creates a(n) [MathMLElement] using the tag 'annotation'. + /// Creates a [MathMLElement] using the tag 'annotation'. MathMLElement.annotation() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', 'annotation', ); - /// Creates a(n) [MathMLElement] using the tag 'annotation-xml'. + /// Creates a [MathMLElement] using the tag 'annotation-xml'. MathMLElement.annotation_xml() : _ = document.createElementNS( 'http://www.w3.org/1998/Math/MathML', diff --git a/lib/src/dom/svg.dart b/lib/src/dom/svg.dart index 5fa7e01c..d2dadc18 100644 --- a/lib/src/dom/svg.dart +++ b/lib/src/dom/svg.dart @@ -581,7 +581,7 @@ extension type SVGUnitTypes._(JSObject _) implements JSObject { /// devices. extension type SVGSVGElement._(JSObject _) implements SVGGraphicsElement, JSObject { - /// Creates a(n) [SVGSVGElement] using the tag 'svg'. + /// Creates an [SVGSVGElement] using the tag 'svg'. SVGSVGElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -675,7 +675,7 @@ extension type SVGSVGElement._(JSObject _) /// The **`SVGGElement`** interface corresponds to the element. extension type SVGGElement._(JSObject _) implements SVGGraphicsElement, JSObject { - /// Creates a(n) [SVGGElement] using the tag 'g'. + /// Creates an [SVGGElement] using the tag 'g'. SVGGElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -686,7 +686,7 @@ extension type SVGGElement._(JSObject _) /// The **`SVGDefsElement`** interface corresponds to the element. extension type SVGDefsElement._(JSObject _) implements SVGGraphicsElement, JSObject { - /// Creates a(n) [SVGDefsElement] using the tag 'defs'. + /// Creates an [SVGDefsElement] using the tag 'defs'. SVGDefsElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -696,7 +696,7 @@ extension type SVGDefsElement._(JSObject _) /// The **`SVGDescElement`** interface corresponds to the element. extension type SVGDescElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGDescElement] using the tag 'desc'. + /// Creates an [SVGDescElement] using the tag 'desc'. SVGDescElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -707,7 +707,7 @@ extension type SVGDescElement._(JSObject _) implements SVGElement, JSObject { /// The **`SVGMetadataElement`** interface corresponds to the element. extension type SVGMetadataElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGMetadataElement] using the tag 'metadata'. + /// Creates an [SVGMetadataElement] using the tag 'metadata'. SVGMetadataElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -717,7 +717,7 @@ extension type SVGMetadataElement._(JSObject _) /// The **`SVGTitleElement`** interface corresponds to the element. extension type SVGTitleElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGTitleElement] using the tag 'title'. + /// Creates an [SVGTitleElement] using the tag 'title'. SVGTitleElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -728,7 +728,7 @@ extension type SVGTitleElement._(JSObject _) implements SVGElement, JSObject { /// The **`SVGSymbolElement`** interface corresponds to the element. extension type SVGSymbolElement._(JSObject _) implements SVGGraphicsElement, JSObject { - /// Creates a(n) [SVGSymbolElement] using the tag 'symbol'. + /// Creates an [SVGSymbolElement] using the tag 'symbol'. SVGSymbolElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -742,7 +742,7 @@ extension type SVGSymbolElement._(JSObject _) /// extension type SVGUseElement._(JSObject _) implements SVGGraphicsElement, JSObject { - /// Creates a(n) [SVGUseElement] using the tag 'use'. + /// Creates an [SVGUseElement] using the tag 'use'. SVGUseElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -771,7 +771,7 @@ extension type ShadowAnimation._(JSObject _) implements Animation, JSObject { /// The **`SVGSwitchElement`** interface corresponds to the element. extension type SVGSwitchElement._(JSObject _) implements SVGGraphicsElement, JSObject { - /// Creates a(n) [SVGSwitchElement] using the tag 'switch'. + /// Creates an [SVGSwitchElement] using the tag 'switch'. SVGSwitchElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -781,7 +781,7 @@ extension type SVGSwitchElement._(JSObject _) /// The **`SVGStyleElement`** interface corresponds to the SVG element. extension type SVGStyleElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGStyleElement] using the tag 'style'. + /// Creates an [SVGStyleElement] using the tag 'style'. SVGStyleElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -891,7 +891,7 @@ extension type SVGAnimatedPreserveAspectRatio._(JSObject _) /// > [SVGGeometryElement]. extension type SVGPathElement._(JSObject _) implements SVGGeometryElement, JSObject { - /// Creates a(n) [SVGPathElement] using the tag 'path'. + /// Creates an [SVGPathElement] using the tag 'path'. SVGPathElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -903,7 +903,7 @@ extension type SVGPathElement._(JSObject _) /// elements, as well as methods to manipulate them. extension type SVGRectElement._(JSObject _) implements SVGGeometryElement, JSObject { - /// Creates a(n) [SVGRectElement] using the tag 'rect'. + /// Creates an [SVGRectElement] using the tag 'rect'. SVGRectElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -921,7 +921,7 @@ extension type SVGRectElement._(JSObject _) /// The **`SVGCircleElement`** interface is an interface for the element. extension type SVGCircleElement._(JSObject _) implements SVGGeometryElement, JSObject { - /// Creates a(n) [SVGCircleElement] using the tag 'circle'. + /// Creates an [SVGCircleElement] using the tag 'circle'. SVGCircleElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -937,7 +937,7 @@ extension type SVGCircleElement._(JSObject _) /// elements. extension type SVGEllipseElement._(JSObject _) implements SVGGeometryElement, JSObject { - /// Creates a(n) [SVGEllipseElement] using the tag 'ellipse'. + /// Creates an [SVGEllipseElement] using the tag 'ellipse'. SVGEllipseElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -954,7 +954,7 @@ extension type SVGEllipseElement._(JSObject _) /// elements, as well as methods to manipulate them. extension type SVGLineElement._(JSObject _) implements SVGGeometryElement, JSObject { - /// Creates a(n) [SVGLineElement] using the tag 'line'. + /// Creates an [SVGLineElement] using the tag 'line'. SVGLineElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -1013,7 +1013,7 @@ extension type SVGPointList._(JSObject _) implements JSObject { /// elements, as well as methods to manipulate them. extension type SVGPolylineElement._(JSObject _) implements SVGGeometryElement, JSObject { - /// Creates a(n) [SVGPolylineElement] using the tag 'polyline'. + /// Creates an [SVGPolylineElement] using the tag 'polyline'. SVGPolylineElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -1028,7 +1028,7 @@ extension type SVGPolylineElement._(JSObject _) /// elements, as well as methods to manipulate them. extension type SVGPolygonElement._(JSObject _) implements SVGGeometryElement, JSObject { - /// Creates a(n) [SVGPolygonElement] using the tag 'polygon'. + /// Creates an [SVGPolygonElement] using the tag 'polygon'. SVGPolygonElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -1082,7 +1082,7 @@ extension type SVGTextPositioningElement._(JSObject _) /// The **`SVGTextElement`** interface corresponds to the elements. extension type SVGTextElement._(JSObject _) implements SVGTextPositioningElement, JSObject { - /// Creates a(n) [SVGTextElement] using the tag 'text'. + /// Creates an [SVGTextElement] using the tag 'text'. SVGTextElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -1093,7 +1093,7 @@ extension type SVGTextElement._(JSObject _) /// The **`SVGTSpanElement`** interface represents a element. extension type SVGTSpanElement._(JSObject _) implements SVGTextPositioningElement, JSObject { - /// Creates a(n) [SVGTSpanElement] using the tag 'tspan'. + /// Creates an [SVGTSpanElement] using the tag 'tspan'. SVGTSpanElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -1104,7 +1104,7 @@ extension type SVGTSpanElement._(JSObject _) /// The **`SVGTextPathElement`** interface corresponds to the element. extension type SVGTextPathElement._(JSObject _) implements SVGTextContentElement, JSObject { - /// Creates a(n) [SVGTextPathElement] using the tag 'textPath'. + /// Creates an [SVGTextPathElement] using the tag 'textPath'. SVGTextPathElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -1126,7 +1126,7 @@ extension type SVGTextPathElement._(JSObject _) /// The **`SVGImageElement`** interface corresponds to the element. extension type SVGImageElement._(JSObject _) implements SVGGraphicsElement, JSObject { - /// Creates a(n) [SVGImageElement] using the tag 'image'. + /// Creates an [SVGImageElement] using the tag 'image'. SVGImageElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -1147,7 +1147,7 @@ extension type SVGImageElement._(JSObject _) /// properties of elements, as well as methods to manipulate them. extension type SVGForeignObjectElement._(JSObject _) implements SVGGraphicsElement, JSObject { - /// Creates a(n) [SVGForeignObjectElement] using the tag 'foreignObject'. + /// Creates an [SVGForeignObjectElement] using the tag 'foreignObject'. SVGForeignObjectElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -1167,7 +1167,7 @@ extension type SVGForeignObjectElement._(JSObject _) /// The following properties and methods all return, or act on the attributes of /// the element represented by `SVGMarkerElement`. extension type SVGMarkerElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGMarkerElement] using the tag 'marker'. + /// Creates an [SVGMarkerElement] using the tag 'marker'. SVGMarkerElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -1219,7 +1219,7 @@ extension type SVGGradientElement._(JSObject _) /// The **`SVGLinearGradientElement`** interface corresponds to the element. extension type SVGLinearGradientElement._(JSObject _) implements SVGGradientElement, JSObject { - /// Creates a(n) [SVGLinearGradientElement] using the tag 'linearGradient'. + /// Creates an [SVGLinearGradientElement] using the tag 'linearGradient'. SVGLinearGradientElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -1235,7 +1235,7 @@ extension type SVGLinearGradientElement._(JSObject _) /// The **`SVGRadialGradientElement`** interface corresponds to the element. extension type SVGRadialGradientElement._(JSObject _) implements SVGGradientElement, JSObject { - /// Creates a(n) [SVGRadialGradientElement] using the tag 'radialGradient'. + /// Creates an [SVGRadialGradientElement] using the tag 'radialGradient'. SVGRadialGradientElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -1252,7 +1252,7 @@ extension type SVGRadialGradientElement._(JSObject _) /// The **`SVGStopElement`** interface corresponds to the element. extension type SVGStopElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGStopElement] using the tag 'stop'. + /// Creates an [SVGStopElement] using the tag 'stop'. SVGStopElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -1264,7 +1264,7 @@ extension type SVGStopElement._(JSObject _) implements SVGElement, JSObject { /// The **`SVGPatternElement`** interface corresponds to the element. extension type SVGPatternElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGPatternElement] using the tag 'pattern'. + /// Creates an [SVGPatternElement] using the tag 'pattern'. SVGPatternElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -1285,7 +1285,7 @@ extension type SVGPatternElement._(JSObject _) implements SVGElement, JSObject { /// The **`SVGScriptElement`** interface corresponds to the SVG element. extension type SVGScriptElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGScriptElement] using the tag 'script'. + /// Creates an [SVGScriptElement] using the tag 'script'. SVGScriptElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -1303,7 +1303,7 @@ extension type SVGScriptElement._(JSObject _) implements SVGElement, JSObject { /// element, as well as methods to manipulate them. extension type SVGAElement._(JSObject _) implements SVGGraphicsElement, JSObject { - /// Creates a(n) [SVGAElement] using the tag 'a'. + /// Creates an [SVGAElement] using the tag 'a'. SVGAElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -1351,7 +1351,7 @@ extension type SVGAElement._(JSObject _) /// The **`SVGViewElement`** interface provides access to the properties of /// elements, as well as methods to manipulate them. extension type SVGViewElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGViewElement] using the tag 'view'. + /// Creates an [SVGViewElement] using the tag 'view'. SVGViewElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', diff --git a/lib/src/dom/svg_animations.dart b/lib/src/dom/svg_animations.dart index 783c10f1..e53e5083 100644 --- a/lib/src/dom/svg_animations.dart +++ b/lib/src/dom/svg_animations.dart @@ -58,7 +58,7 @@ extension type SVGAnimationElement._(JSObject _) /// The **`SVGAnimateElement`** interface corresponds to the element. extension type SVGAnimateElement._(JSObject _) implements SVGAnimationElement, JSObject { - /// Creates a(n) [SVGAnimateElement] using the tag 'animate'. + /// Creates an [SVGAnimateElement] using the tag 'animate'. SVGAnimateElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -69,7 +69,7 @@ extension type SVGAnimateElement._(JSObject _) /// The **`SVGSetElement`** interface corresponds to the element. extension type SVGSetElement._(JSObject _) implements SVGAnimationElement, JSObject { - /// Creates a(n) [SVGSetElement] using the tag 'set'. + /// Creates an [SVGSetElement] using the tag 'set'. SVGSetElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -80,7 +80,7 @@ extension type SVGSetElement._(JSObject _) /// The **`SVGAnimateMotionElement`** interface corresponds to the element. extension type SVGAnimateMotionElement._(JSObject _) implements SVGAnimationElement, JSObject { - /// Creates a(n) [SVGAnimateMotionElement] using the tag 'animateMotion'. + /// Creates an [SVGAnimateMotionElement] using the tag 'animateMotion'. SVGAnimateMotionElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -90,7 +90,7 @@ extension type SVGAnimateMotionElement._(JSObject _) /// The **`SVGMPathElement`** interface corresponds to the element. extension type SVGMPathElement._(JSObject _) implements SVGElement, JSObject { - /// Creates a(n) [SVGMPathElement] using the tag 'mpath'. + /// Creates an [SVGMPathElement] using the tag 'mpath'. SVGMPathElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', @@ -103,8 +103,7 @@ extension type SVGMPathElement._(JSObject _) implements SVGElement, JSObject { /// The `SVGAnimateTransformElement` interface corresponds to the element. extension type SVGAnimateTransformElement._(JSObject _) implements SVGAnimationElement, JSObject { - /// Creates a(n) [SVGAnimateTransformElement] using the tag - /// 'animateTransform'. + /// Creates an [SVGAnimateTransformElement] using the tag 'animateTransform'. SVGAnimateTransformElement() : _ = document.createElementNS( 'http://www.w3.org/2000/svg', diff --git a/tool/generator/translator.dart b/tool/generator/translator.dart index d3ede042..0c27bd3f 100644 --- a/tool/generator/translator.dart +++ b/tool/generator/translator.dart @@ -853,10 +853,11 @@ class Translator { final createElementMethod = uri != null ? 'createElementNS' : 'createElement'; for (final tag in tags) { + final article = singularArticleForElement(dartClassName); elementConstructors.add(code.Constructor((b) => b ..docs.addAll([ formatDocs( - "Creates a(n) [$dartClassName] using the tag '$tag'.", + "Creates $article [$dartClassName] using the tag '$tag'.", 80, // Extension type members start with an indentation of 2 // chars. diff --git a/tool/generator/webref_elements_api.dart b/tool/generator/webref_elements_api.dart index 1101cbcc..73587178 100644 --- a/tool/generator/webref_elements_api.dart +++ b/tool/generator/webref_elements_api.dart @@ -9,7 +9,7 @@ import 'dart:js_interop'; const _svgNamespaceURI = 'http://www.w3.org/2000/svg'; const _mathMLNamespaceURI = 'http://www.w3.org/1998/Math/MathML'; -// Gets the URI needed to create an element of type [elementInterface]. +/// Gets the URI needed to create an element of type [elementInterface]. String? uriForElement(String elementInterface) { if (elementInterface.startsWith('SVG')) return _svgNamespaceURI; if (elementInterface.startsWith('MathML')) return _mathMLNamespaceURI; @@ -18,6 +18,19 @@ String? uriForElement(String elementInterface) { return null; } +// TODO(srujzs): Generalize this. It's a bit difficult as it requires knowing +// what sound a word begins with rather than just if it starts with a vowel or +// not. +/// Determines whether [elementInterface] should use the article 'a' or 'an'. +String singularArticleForElement(String elementInterface) { + if (elementInterface.startsWith('HTML') || + elementInterface.startsWith('SVG')) { + return 'an'; + } + assert(elementInterface.startsWith('MathML')); + return 'a'; +} + @JS() external WebRefElements get elements; From da0c9fe6c2ffe3265d63cc5c88854b53fc36f02f Mon Sep 17 00:00:00 2001 From: Srujan Gaddam Date: Wed, 28 Feb 2024 15:45:26 -0800 Subject: [PATCH 7/7] Add element constructor test Did not get added in a previous commit. --- test/element_constructor_test.dart | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 test/element_constructor_test.dart diff --git a/test/element_constructor_test.dart b/test/element_constructor_test.dart new file mode 100644 index 00000000..8a502097 --- /dev/null +++ b/test/element_constructor_test.dart @@ -0,0 +1,29 @@ +// Copyright (c) 2024, 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. + +@TestOn('browser') +library; + +import 'package:test/test.dart'; +import 'package:web/web.dart'; + +void main() { + test('Element constructors create the expected element', () { + const html = 'http://www.w3.org/1999/xhtml'; + const svg = 'http://www.w3.org/2000/svg'; + const mathML = 'http://www.w3.org/1998/Math/MathML'; + final area = HTMLAreaElement(); + expect(area.tagName, 'AREA'); + expect(area.namespaceURI, html); + final footer = HTMLElement.footer(); + expect(footer.tagName, 'FOOTER'); + expect(footer.namespaceURI, html); + final mpath = SVGMPathElement(); + expect(mpath.tagName, 'mpath'); + expect(mpath.namespaceURI, svg); + final annotation = MathMLElement.annotation(); + expect(annotation.tagName, 'annotation'); + expect(annotation.namespaceURI, mathML); + }); +}