Repository navigation
v3.1.0
-
sdk: ^3.13.0
-
$asyncContent: removedfinalfrom parameters (a compile error with the Dart 3.13 language version). -
Adopted Dart 3.8–3.13 language features (flagged by
lints6):- Null-aware collection elements and map values (
?x,'k': ?v) in element constructors,$taghelpers
($a,$img,$label,$button,$td,$th) andDOMElement.allEventHandlers. - Super parameters in
DIVElement,INPUTElement,SELECTElement,OPTIONElement,TEXTAREAElementand the
table elements (TABLEElement,CAPTIONElement,THEADElement,TBODYElement,TFOOTElement,TRowElement,
THElement,TDElement). CSSEntry._: private named parameterthis._comment(Dart 3.12).- Explicit types for
DOMNode({content}),DOMElement.apply,createTableContent,$band
DSXObjectType.forObject.
- Null-aware collection elements and map values (
-
DOMHtmlBrowserWeb/DOMGeneratorWebImpl:- Use
Object?.isA<T>()(Dart 3.12) instead ofasJSAny.isA<T>().
- Use
-
DOMTreeMap:- Fix (
dart2wasm):getElementDOMTreeMap(and soDOMHtml.toDOMElement) missed generated nodes reached
through a different JS wrapper (e.g.element.firstChild). The element association was anExpandokeyed by
the Dart wrapper; it's now aDOMWeakStore, keyed by JS identity (a JSWeakMap) on the web.
- Fix (
-
DOMNode/DOMElementfixes:apply/applyWhere(classes:): add to theclassattribute (used to create aclassesattribute).equals: compares attributes and content by value (equal elements used to never match).- Content given as a
List<DOMNode>subtype is copied: the caller's list is no longer mutated, and adding text to
aList<DOMElement>content no longer throws. insertAtof a single parsed node now sets itsparent.DOMNode({content}): fixedLateInitializationError(_commentedwasn't initialized); a bareDOMNodeno longer
indents its content.DOMElement.buildHTML: commented elements are omitted, as documented and asDOMNode.buildHTMLand the
generators already did (e.g.$br(amount: 0)renders'').
-
Tables:
- Empty
TBODYElement/THEADElement/TFOOTElementno longer render a phantom<tr><td></td></tr>. - A
TDElementin a header row is converted toth(it was nested as<th><td>), and aTHElementin a body row
is kept (it was nested as<td><th>).
- Empty
-
DOMAction.parseParameters: fixedArgumentErrorfor actions with 2+ parameters (e.g.addClass(a, b)). -
DSX:
DSX.varArgs: fixed the 10th argument being replaced by the literal10.DSXResolver.setResolvedValue: fixed the resolved value (e.g. of a future DSX) being cleared when the previous
element wasn't in the DOM.
-
toIntlMessageResolver: adynamic Function()resolver converts its result withparseString(it threw a
TypeErrorfor non-Stringresults). -
DOMGenerator:buildElement: named elements use thecontextpassed togenerate(), falling back todomContext.generateWithRoot/generateFromHTML: fixed a null-check crash when generating into an unmappedparentwithout
adomParent.
-
CSS:
- Comments of
color,width,height,border,opacity,display,backgroundandbackground-color
entries are no longer dropped. CSSMax/CSSMin.compute(): work when all arguments are plain numbers (e.g.max(1, 3, 2)→3).CSSColorName: keeps its alpha (hasAlphaisfalsefor opaque names,truefortransparent).- Background
repeat-x/repeat-yare no longer parsed asrepeat.
- Comments of
-
DOMTemplate:copy()of condition blocks keeps their{{?:x}}/{{?!x}}/{{?}}else branches.- A
{{?!x}}block no longer renders inside the preceding if-block's content. DOMTemplateBlockElseNot.toString()emits a valid{{?!x}}…block (templates with else-not blocks round-trip).
-
Now based on
web_utils1.1.0 andjs_interop_utils1.1.0, which bring:Node.clear()/clearNodes()fixed for non-Elementnodes (used by the web runtimeclear).isA-basedasJSAny/asJSObjectand typed lists.toJSproducing JS typed arrays.
-
Dependencies:
- web_utils: ^1.1.0
- js_interop_utils: ^1.1.0
- html: ^0.15.7
- lints: ^6.1.0
- test: ^1.32.0
- dependency_validator: ^5.1.0
- coverage: ^1.15.1
-
Tests:
- Added
test/dom_builder_web_integration_test.dart: real browser DOM through thepackage:webgenerator (events,
runtime, tree map, actions,DOMAsync, templates, DSX). - Added
test/dom_builder_elements_test.dartandtest/dom_builder_node_test.dart: elements, helpers, attributes,
tables. (dom_builder_node_test.dartisn't compiled withdart2wasm: it triggers a dart2wasm compiler crash,
still present in 3.13.5: dart-lang/sdk#64428.) - Added
test/dom_builder_dsx_css_generator_test.dart: DSX, CSS, generators, templates, context and actions.
- Added