dom_builder 3.2.0
dom_builder: ^3.2.0 copied to clipboard
Generate and manipulate DOM elements (virtual or real), DSX (like JSX) and HTML declarations (Web and Native support).
3.2.0 #
-
Fix: a false boolean attribute set as a property turned it on.
resolveAttributeValueresolves a false boolean attribute tonull(no attribute), whichsetAttributetakes as a bare (true) attribute for the ones set as properties: everyselected="false"option (also$option(selected: false)) was selected, so a<select>showed its last option;hidden="false",multiple="false"andinert="false"turned those on too.DOMGenerator.setAttributesnow sets each resolved value with the newsetResolvedAttribute.resolveAttributeValueandsetResolvedAttributetake 2 required named defaults for an attribute without a value:booleanDefault(a boolean attribute: on or off) andvalueDefault(any other: that value, or removed whennull);setAttributespassesfalseandnull. A false boolean attribute resolves tonull(off). NewDOMGenerator.resolveAttributeDefaultsreturns an attribute's value or its default.booleanDefaultholds for every boolean attribute (checked,disabled… too), not only the ones set as properties.setAttributekeepsnullas a bare attribute (true). The web generator'ssetElementAttributetakesbooleanDefaulttoo (defaulttrue)._parseAttributeBoolValuetakes thenullvalue as a nameddefaultValue(web anddart:htmlgenerators).- Breaking for a class extending
DOMGeneratordirectly:setResolvedAttributeis abstract, and must be implemented (a fallback tosetAttributewould turn every false boolean attribute on); a caller or override ofresolveAttributeValuemust pass or take the 2 new required parameters. The package's generators (web,dart:html, delegate, dummy, none) implement them; subclasses of them are unaffected. - A
nullselectedormultipleon an element without that property now removes the attribute (it threw).
-
Fix: one rule for every boolean attribute value,
DOMAttribute.parseBooleanValue: on fortrue, bare,"", the attribute's own name (checked="checked",selected="selected": XHTML form, any case) andon/yes/1; off otherwise ("false","off","no","0": dom_builder reads boolean values, and templates rely on it). Used byDOMAttribute.from,setValueon an existing attribute,resolveAttributeValue(template values too) and the generators'setAttribute/setResolvedAttribute. Before, each read them its own way:checked="checked"and the other own-name forms were off;- a boolean attribute with a template value (
checked="{{:on}}true{{?}}false{{/}}",disabled="{{d}}") was not a boolean:"false"was set aschecked="false"/disabled="false", on in a browser; "false"viasetResolvedAttribute/setAttributeturnedchecked/disabledon, while""or the own name turnedselected/hiddenoff;setAttribute('checked', 'checked')on an element that already had it turned it off.
-
Fix: the generators set a boolean attribute both as the attribute (present when on, removed when off: the element's default state) and, where it stops following it, as the property (
option.selected,input.checked,media.muted).selectedwas only a property, sooption[selected]matched nothing and a form reset selected the first option;checkedwas only an attribute, so a re-render didn't change a checkbox the user had toggled.setAttributetakesnullas a bare attribute (on) for every boolean attribute (it removedchecked/disabled). -
Fix:
hidden="until-found"(hidden, but found by find-in-page and fragment navigation) is kept as the value: it was read as a boolean, false, so the element was shown.DOMAttribute.booleanAttributeKeywordlists such keywords. -
Fix: an empty value is a value:
data-x="", a valuelessdata-xandvalue=""are kept ([data-x]selectors,dataset.x == ""); they were dropped from the HTML and the DOM.DOMAttributeValueStringkeeps''apart fromnull(no value), andDOMElement.buildHTMLwritesname="". Behaviour change:DOMAttribute.from('title', '')now buildstitle=""(it built nothing); an emptyclassorstyleis still left out.DOMElement.hasAttributeValueis true for an empty value too (onlynull, absent or a false boolean attribute, is false), as its doc said ("if attribute exists").- Regression tests (
dom_builder_web_regression_test.dart).
- Regression tests (
-
Fix: templates (
DOMTemplateVariable):- A
Setin the context is checked for membership ({{:tags.vip}}), givingtrueorfalse: it was converted to aListfirst and indexed, so its membership branch never ran. - A
Function(Object?)value is called with any context: it also matchedFunction(Map?), checked first, which cast the context toMap?and threw for a non-Mapone. AFunction(Map?)getsnullfor a non-Mapcontext. - A
Set(or any otherIterable) value works as a condition and a loop ({{:tags}},{{*:tags}}): it threw.
- A
-
Fix: an empty string value equals
''(and notnull):DOMAttributeValueString('').equalsAttributeValue('')was false. -
Tests for the boolean attributes (
checked,hidden,disabled,selected,multiple,inert,autoplay,controls,muted):dom_builder_boolean_attributes_test.dart(VM):DOMAttributeparsing, HTML output (a false one is left out), templates,resolveAttributeValue, andsetAttributessetting every resolved value withsetResolvedAttribute(also throughDOMGeneratorDelegateandDOMGeneratorDummy).dom_builder_web_boolean_attributes_test.dart(browser): each one on its element's property,"true", bare,"false"and absent, from parsed HTML and$tagattributes;selectedoptions (parsed,$option, a multiple select, a template's language select);setAttribute,setResolvedAttribute(on and off,booleanDefault) andsetElementAttribute.
-
Coverage tests (VM):
dom_builder_base_coverage_test.dart,dom_builder_css_coverage_test.dart,dom_builder_template_coverage_test.dart,dom_builder_helpers_attribute_coverage_test.dartanddom_builder_generator_coverage_test.dart(generator, runtime, tree map): VM line coverage ~85% -> 97.4%. Suspected bugs found are reproduced as skipped tests (skip: 'Bug: …'). -
README: Codecov badge.
3.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,$bandDSXObjectType.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 aTypeErrorfor 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-colorentries 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: https://github.com/dart-lang/sdk/issues/64428.) - Added
test/dom_builder_dsx_css_generator_test.dart: DSX, CSS, generators, templates, context and actions.
- Added
3.0.10 #
-
DOMGeneratorWebImpl:addExternalElementToElement: fixedNoSuchMethodErrorwith aListof nodes (theasJSAnyextension was called on adynamicelement).
-
DOMNodeRuntimeWebImpl/DOMNodeRuntimeDartHTMLImpl:clearClasses: fixed removing the element's children instead of its classes.
-
DOMActionExecutor:call: fixedremoveclass/removeclassesbeing dispatched tocallAddClassinstead ofcallRemoveClass.
-
Element constructors (
DIVElement,INPUTElement,SELECTElement,OPTIONElement,TEXTAREAElementand the table elements): use super parameters (use_super_parameterslint). -
Added
test/dom_builder_web_regression_test.dart.
3.0.9 #
DOMGeneratorWebImpl:createDOMEvent: fixed argument passed toDOMEventconstructor fromeventTargettowebEvent.
3.0.8 #
-
DOMNode:- Added method
hasFutureElement({bool recursive = false})to check if the node contains anyFutureelement.- If
recursiveisfalse, only direct children are checked. - If
recursiveistrue, the entire subtree is traversed using an explicit stack in left-to-right DFS order.
- If
- Added method
-
ExternalElementNode:- Added private field
_isFutureElementto track ifexternalElementis aFuture. - Overridden
hasFutureElementto returnisFutureElement. - Added getter
isFutureElementto indicate ifexternalElementis aFuture.
- Added private field
-
dom_builder_helpers.dart:- Added
$bfunction to create abnode. - Added
$hfunction to create heading nodes (h1,h2,h3, etc.) dynamically.
- Added
3.0.7 #
-
DOMContext:copy: fixed copying of_domGeneratorfield by assigning_domGeneratorinstead ofdomGenerator.resolveViewportCSSLength: added local variableviewportto avoid repeated null checks._computeViewportCSSLength: changed parameterviewportfrom nullable to non-nullable and removed redundant null assertions.
-
DOMGeneratorWebImpl:- Fixed incorrect variable usage in
addExternalElementToElementloop by replacingexternalElement.asJSAnywithe.asJSAny.
- Fixed incorrect variable usage in
-
dom_builder_dsx.dart:_dsxJoinStrings:- updated parameter type to
List<Object?>. - fixed
list.remove(i)tolist.removeAt(i)to correctly remove element by index.
- updated parameter type to
-
dom_builder_template.dart:DOMTemplateVariable:- Improved index bounds check to ensure
idxis non-negative before accessingcontextlist elements.
- Improved index bounds check to ensure
3.0.6 #
-
DOMElement:- Added method
containsAttributeto check for attribute existence.
- Added method
-
DOMGeneratorWebImpl:- Optimized
setAttributesto batch attribute setting for non-special attributes. - Added
_setElementAttributeSpecialto handle special attributes (selected,multiple,hidden,inert,id,class,style) with direct property manipulation. - Updated event listener registration to use weak references to
DOMElementto avoid retaining stale references. - Improved event listener callbacks to retrieve the actual event target node.
- Added helper methods
_setElementAttribute.
- Optimized
-
DOMTreeMap:- Replaced
WeakKeyMapwithLazyWeakKeyMapfor_elementsSubscriptionsto improve subscription management. - Used
LazyWeakReferenceManagerByTypefor weak reference management. - Simplified disposal of event handlers by directly closing streams instead of using finalizers.
- Removed
ExpandoWithFinalizerusage for event handler disposal. - Improved internal weak reference handling and subscription cleanup.
- Replaced
-
Dependencies:
- Updated
web_utilsfrom ^1.0.21 to ^1.0.23. - Updated
js_interop_utilsfrom ^1.0.9 to ^1.0.11. - Updated
swiss_knifefrom ^3.3.9 to ^3.3.14.
- Updated
3.0.5 #
-
DOMTreeMap:- Rollback:
- Replaced
_elementToDOMNodeMaptype fromDualWeakMaptoDualMap. - Updated usage of
_elementToDOMNodeMapmethods to non-weak variants (get,containsKey). - Removed call to
_elementToDOMNodeMap?.purge()inpurge()method.
- Replaced
- Rollback:
-
Dependencies:
- Updated
swiss_knifedependency from^3.3.7to^3.3.9.
- Updated
3.0.4 #
DOMGenerator:- Added method
isMappableto check if aDOMNodecan be mapped by aDOMTreeMapwith a given context. - Updated all calls to
DOMTreeMap.mapandmapTreeto passgenerator: thisandcontextparameters. - Updated
buildand related methods to passgeneratorandcontextwhen mapping nodes.
- Added method
DOMGeneratorDelegateandDOMGeneratorDummy:- Implemented
isMappable.
- Implemented
DOMTreeMap:- Updated
mapandmapTreemethods to accept optionalgeneratorandcontextparameters. mapmethod now callsgenerator.isMappableto decide whether to perform mapping; skips mapping if not mappable.
- Updated
DOMTreeMapDummy:- Updated overridden
mapandmapTreemethods to accept new parameters.
- Updated overridden
3.0.3 #
-
DOMElement:- Added method
allEventHandlersto return a snapshot list of all initialized event handlers. - Renamed
closeAllEventListenerstocloseAllEventHandlersand updated documentation accordingly.
- Added method
-
DSX:- Replaced
WeakKeyMapwithExpandofor internal mappings to improve memory management. - Fixed key lookups by removing unnecessary casts and using direct keys.
- Replaced
-
DOMTreeMap:- Changed
_elementsDOMTreeMapto useExpando<WeakReference<DOMTreeMap>>for better lifecycle handling. - Improved
mapmethod to avoid redundant mappings and update treeMap references correctly. - Updated
isMappedElementto usecontainsKeyNoPurgefor accurate presence checks. - Removed
domElementsEventListenersparameter fromcancelAllSubscriptions. - Added
closeDOMElementsEventHandlersmethod to close all event handlers on DOM elements. - Added private
_disposeDOMElementsEventHandlersmethod usingExpandoWithFinalizerto schedule closing event handlers asynchronously. - Updated
disposemethod to optionally dispose event handlers with a newdisposeEventHandlersparameter. - Updated
DOMTreeMapDummyto implement new methods and parameters accordingly.
- Changed
-
Dependencies:
- Updated
swiss_knifedependency from^3.3.5to^3.3.7.
- Updated
3.0.2 #
DOMGenerator:- Refactored
setAttributesto use new helper methodresolveAttributeValuefor attribute value resolution. - Added
resolveAttributeValuemethod to handle attribute value computation with support forpreserveClass,preserveStyle, boolean attributes, and source resolution.
- Refactored
DOMGeneratorDelegate:- Added override for
resolveAttributeValuedelegating to internaldomGenerator.
- Added override for
DOMGeneratorDummy:- Added stub override for
resolveAttributeValuereturningnull.
- Added stub override for
DOMGeneratorWebImpl:- Changed
setAttributemethod tosetAttributesacceptingDOMElement,Node, andDOMTreeMapwith optionalpreserveClassandpreserveStyleflags. - Added
setAttributeoverride accepting single attribute name and value. - Introduced private helper
setElementAttributeto set attributes onElementwith special handling for boolean and common attributes (selected,multiple,hidden,inert,id,class,style). - Replaced deprecated
appendcalls withappendChildfor DOM node insertion.
- Changed
DOMNodeRuntimeWebImpl:- Replaced
element?.attributes.put(name, value)withelement?.setAttribute(name, value). - Replaced
element?.append(child)withelement?.appendChild(child).
- Replaced
3.0.1 #
-
DOMElement:- Added getter
hasAnyEventListenerto check if any event callback is attached. - Added method
closeAllEventListenersto asynchronously close and remove all attached event listeners.
- Added getter
-
DOMTreeMap:- Added method documentation:
mapTree,mapSubscriptions,elementsWithSubscriptions,getSubscriptions,cancelSubscriptions,cancelAllSubscriptions.
- Added method
domElementsWithEventListenerto return all mappedDOMElements with event listeners. - Updated cancelAllSubscriptions to optionally cancel element subscriptions and/or close DOM event listeners attached to elements.
- Added method documentation:
-
DOMTreeMapDummy:- Updated
cancelAllSubscriptionssignature to matchDOMTreeMapwith optional parameters for subscription and event listener cancellation.
- Updated
3.0.0 #
DOMGenerator:createDOMMouseEventandcreateDOMEventmethods:- Added optional parameters
domTargetandtarget.
- Added optional parameters
DOMGeneratorDelegate:- Updated
createDOMMouseEventandcreateDOMEventto forward new parametersdomTargetandtarget.
- Updated
DOMGeneratorDummy:- Updated
createDOMMouseEventandcreateDOMEventsignatures to include optionaldomTargetandtargetparameters.
- Updated
DOMGeneratorDartHTMLImpl:registerEventListeners:- Pass
domTargetandtargetwhen callingcreateDOMMouseEventandcreateDOMEvent.
- Pass
createDOMMouseEventandcreateDOMEvent:- Use
targetparameter if provided; otherwise, use event's target. - Use
domTargetparameter if provided; otherwise, map event target to DOM node.
- Use
DOMGeneratorWebImpl:registerEventListeners:- Pass
domTargetandtargetwhen callingcreateDOMMouseEventandcreateDOMEvent.
- Pass
createDOMMouseEventandcreateDOMEvent:- Use
targetparameter if provided; otherwise, use event's target. - Use
domTargetparameter if provided; otherwise, map event target to DOM node. - Adjusted parameter order and usage for
DOMMouseEventandDOMEventconstructors.
- Use
3.0.0-beta.11 #
-
DSX:- Added
DSXObjectTypeenum to classify DSX objects (function, future, generic). - Changed internal DSX storage to use
WeakKeyMapandWeakReferencefor better memory management. - Added lifecycle management support with
DSXLifecycleManagerinterface and integration inDSXandDSXResolver. - Added
DSXResolutionclass to control DSX resolution behavior and lifecycle manager usage. - Updated
DSXResolverto support lifecycle management and improved resolved value handling. - Improved
DSXequality and disposal logic.
- Added
-
DOMAttribute:- Updated
buildHTMLand related methods to useDSXResolutioninstead of a booleanresolveDSX. - Added support for DSX lifecycle management in attribute value resolution.
- Updated
-
DOMNodeand subclasses (TextNode,TemplateNode,DOMElement,ExternalElementNode):- Updated
buildHTMLmethods to acceptDSXResolutionparameter instead of booleanresolveDSX. DOMElement:- Added
_resolvedDSXEventAttributesfield and methods to resolve DSX event attributes. - Added
resolvedDSXs()method to iterate resolved DSX objects. - Updated HTML building methods to use
DSXResolution. - Added
resolveDSX()method to resolve DSX attributes. - Integrated DSX lifecycle management for resolved DSX event attributes.
- Added
ExternalElementNode:- Updated
buildHTMLto acceptDSXResolution.
- Updated
- Updated
-
DOMTemplateand subclasses:- Replaced boolean
resolveDSXparameters withDSXResolutionfor DSX resolution control. - Updated
copymethods to acceptDSXResolution. - Updated
buildmethods to propagateDSXResolution. - Updated
DOMTemplateVariableto evaluate and resolve values withDSXResolution. - Updated conditional blocks (
DOMTemplateBlockIf,DOMTemplateBlockIfCmp,DOMTemplateBlockNot, etc.) to evaluate withDSXResolution. - Updated string conversion and copy logic to respect DSX resolution.
- Replaced boolean
-
DOMGenerator:- Updated
buildTemplateto useDSXResolution.lifecycleManagerwhen building templates.
- Updated
-
DOMGeneratorWebImpl:- Replaced event listener subscriptions with
addEventListenerTypedcalls. - Removed unused subscription list and mapping.
- Replaced event listener subscriptions with
-
DOMTreeMap:- Implemented
DSXLifecycleManagerinterface. - Added DSX lifecycle management methods:
manageDSX,disposeDSX,disposeManagedDSXs,isManagedDSX. - Added
manageDOMElementDSXsto manage DSX objects inDOMElement. - Added
queryElementandqueryElementAsHTMLmethods for querying and rendering elements. - Updated mapping to store weak references and manage DSX lifecycle.
- Added
cancelAllSubscriptionsmethod. - Added
disposemethod to clean up mappings and managed DSXs.- added optional parameters
cancelSubscriptionsanddisposeDSXsto control whether subscriptions are canceled and DSXs are disposed during disposal.
- added optional parameters
- Updated
purgeto remove disposed DSXs. - Added
toStringoverride for debugging.
- Implemented
-
DOMTreeMapDummy:- Implemented
DSXLifecycleManagerinterface with no-op methods.
- Implemented
-
pubspec.yaml:- Updated
web_utilsdependency from^1.0.20to^1.0.21. - swiss_knife: ^3.3.4 -> ^3.3.5
- Updated
3.0.0-beta.10 #
DOMTreeMap:- Added private field
_purgeCountand public getterpurgeCount. purge():- Updated
purgemethod to increment_purgeCount - Fix: removed null assignments to
_elementToDOMNodeMapand_elementsSubscriptions(breaksDOMNode.runtimeNode).
- Updated
- Added private field
3.0.0-beta.9 #
-
DOMNode:buildDOM: added parameterstreeMapandsetTreeMapRoot, passed toDOMGenerator.generate.- Added
nodesViewgetter returning an unmodifiable list of children nodes.
-
DOMGenerator:getElementNodes: added named parameterasView.- Added caching of a generic
DOMTreeMapDummyinstance. - Added
treeMapandsetTreeMapRootparameters togenerate,resolveElements,toElements,addExternalElementToElement, and related methods. - Updated
attachFutureElementto passtreeMapandcontexttoresolveElements. - Added
cancelEventSubscriptionsmethod with default implementation returningfalse. - Updated
resolveActionAttributeto fix event stream assignment for non-form elements. - Updated
DOMGeneratorDelegateto forward new parameters andcancelEventSubscriptions. - Updated
DOMGeneratorDummyto implement new method signatures and addcancelEventSubscriptionsreturningfalse. - Updated
DOMGeneratorDartHTMLImplandDOMGeneratorWebImpl:- Added
treeMapandcontextparameters toaddExternalElementToElement. - Refactored
registerEventListenersto collect subscriptions and map them intreeMap. - Added
cancelEventSubscriptionsimplementation to cancel all mapped subscriptions asynchronously. - Fixed type checks and casts in
addExternalElementToElement. - Added missing event listeners for
onError.
- Added
-
DOMTreeMap:- Replaced internal maps with
DualWeakMapfor element-to-DOMNode mapping. - Added subscription management with
WeakKeyMapand automatic purge handling. - Added methods
mapSubscriptions,getSubscriptions,cancelSubscriptions, andelementsWithSubscriptions. - Updated mapping methods to use new map structure.
- Added
purgemethod to clear internal maps. - Updated
getMappedElementandmatchesMappingto use new map. - Updated
isMappedDOMNodeto use new map. - Updated
mapTreeto maintain mapping consistency.
- Replaced internal maps with
-
DOMNodeRuntime:- Updated
replaceByto passtreeMapandsetTreeMapRoottotoElements.
- Updated
-
DSX:- Replaced
ExpandowithDualWeakMapfor internal mappings. - Added static
purgemethod to clean unused entries. - Updated
checkmethod to remove mappings properly. - Updated generic type constraints to
T extends Object. - Updated
dsxextension onFutureOr<T?>to handle null safety and typing. - Updated
DSXResolvergeneric constraint toT extends Object. - Updated
$dsxCallto assert non-null return. - Updated
DSXTypegeneric constraint toT extends Object.
- Replaced
-
pubspec.yaml:- Updated
swiss_knifedependency from^3.3.3to^3.3.4. - web_utils: ^1.0.20
- Updated
3.0.0-beta.8 #
-
DOMAttribute:- Added
appendTo. - Optimize string building/concatenation.
- Added
-
DOMElementbuildHTML: Optimize string building/concatenation.
-
DOMGenerator:- Added
createSVGElement.
- Added
-
DOMGeneratorWebImpl: implementcreateSVGElement.
3.0.0-beta.7 #
-
DOMNodeRuntime:getAttribute: fix, usegetAttributeValue.
-
web_utils: ^1.0.19
3.0.0-beta.6 #
- web_utils: ^1.0.18
3.0.0-beta.5 #
-
DOMGenerator:_parseExternalElement:- Improve element resolution.
- Allow unresolved Object as
toString.
toElements: optimize and allow unresolved Object astoString.- Added
resolveElements. - Added
wrapElements.
-
web_utils: ^1.0.16
-
js_interop_utils: ^1.0.9
-
html: ^0.15.6
-
swiss_knife: ^3.3.3
-
test: ^1.26.3
-
dependency_validator: ^4.1.3
-
coverage: ^1.15.0
3.0.0-beta.4 #
DOMGeneratorWebImpl:- Optimize
setAttributefor common attributes (avoid call toElement.setAttribute).
- Optimize
3.0.0-beta.3 #
-
DOMGenerator:- Added
equalsNodes(avoids using identical with JSObject and inconsistencies in Wasm).
- Added
-
DOMTreeMap:- Fix
matchesMapping: use_domNodeToElementMapinstead of_elementToDOMNodeMap.
- Fix
-
web_utils: ^1.0.9
-
js_interop_utils: ^1.0.6
-
swiss_knife: ^3.3.0
-
web: ^1.1.1
3.0.0-beta.2 #
- web_utils: ^1.0.6
3.0.0-beta.1 #
-
DOMGenerator:Tnow extendsObject(non-nullable):DOMGenerator<T extends Object>
-
DOMNode:defaultDomGenerator: change toDOMGenerator.web().
-
DOMGeneratorDartHTMLUnsupportedrenamed toDOMGeneratorUnsupportedas a genericDOMGeneratorunsupported class. -
New library
dom_builder_web.dart.- New
DOMGeneratorWebandDOMHtmlBrowserWeb. - Added
DOMGenerator.webandDOMGenerator.setDefaultDomGeneratorToWeb. - Change from
dart:htmltopackage:web/web.dart. - Change to
dart:js_interop.
- New
-
Deprecate
DOMGenerator.dartHTML,DOMGeneratorDartHTMLandDOMGeneratorDartHTMLImpl. -
Deprecate library
dom_builder_dart_html.dart. -
CI: test with
dart2jsanddart2wasm(on Chrome). -
sdk: '>=3.6.0 <4.0.0'
-
web: ^1.1.0
-
web_utils: ^1.0.5
-
js_interop_utils: ^1.0.5
-
collection: ^1.19.0
-
lints: ^5.1.1
-
test: ^1.25.15
2.2.9 #
DOMGeneratorDartHTMLImpl:- Optimize
setAttributefor common attributes (avoid call toElement.setAttribute).
- Optimize
2.2.8 #
-
sdk: '>=3.6.0 <4.0.0'
-
swiss_knife: ^3.3.0
-
collection: ^1.19.0
-
lints: ^5.1.1
-
test: ^1.25.15
2.2.7 #
-
Improve null-safe code.
-
DOMGenerator:- Added
isChildOfElement. buildElement: callsetAttributesbeforeaddChildToElement, to avoid DOM state update.
- Added
-
DOMGeneratorDartHTMLImpl:- Optimize
addChildToElementandremoveChildFromElement.
- Optimize
-
sdk: '>=3.4.0 <4.0.0'
-
html: ^0.15.5
-
swiss_knife: ^3.2.3
-
collection: ^1.18.0
-
lints: ^4.0.0
-
test: ^1.25.14
-
dependency_validator: ^4.1.2
-
coverage: ^1.11.1
2.2.6 #
-
DOMElement: addedvalidator. -
Change
whereNotNull()tononNulls. -
swiss_knife: ^3.2.1
-
test: ^1.25.8
-
coverage: ^1.9.0
2.2.5 #
-
DOMHtmlBrowser:- Optimize
parse.
- Optimize
-
DOMNode:- Added
parseStringandparseStringNodes.
- Added
-
$html: optimize usingDOMNode.parseStringNodes.
2.2.4 #
-
$p: added parametercontent. -
Added
$emsp. -
Optimized
$nbsp. -
Optimized
_parseStringNodesand_parseListNodes.
2.2.3 #
-
Added
possiblyWithHTMLTagandpossiblyWithHTMLEntity. -
possiblyWithHTML: also check for HTML entities. -
DOMGenerator.buildTemplate: fix resolution of entries with an HTML entity but without an HTML tag. -
swiss_knife: ^3.2.0
-
test: ^1.25.5
-
coverage: ^1.8.0
2.2.2 #
- Added
DOMTreeMap.getElementDOMTreeMap.
2.2.1 #
-
DOMHtmlBrowser:- Fix
toDOMElementforcheckbox.
- Fix
-
New
CHECKBOXElement. -
$checkbox: added parameterchecked. -
WithValue:- Changed from interface to mixin.
- Added
valueAsBool,valueAsInt,valueAsDouble,valueAsNum.
-
dependency_validator: ^3.2.3
2.2.0 #
-
DOMEvent:- Change field
targetfromDOMElementtoDOMNodeto allowExternalElementNodeas target or any otherDOMNodeimplementation.
- Change field
-
Dart CI: update and optimize jobs.
-
sdk: '>=3.0.0 <4.0.0'
-
html: ^0.15.4
-
collection: ^1.18.0
-
lints: ^2.1.1
-
test: ^1.24.6
2.1.9 #
- Fix
onKeyDownhandling and building.
2.1.8 #
- Optimize:
DOMAttribute.from:- Check
DOMTemplate.possiblyATemplatebefore callDOMTemplate.parse.
- Check
DOMTemplate:possiblyATemplateand_parse: check for minimal template length.
DOMNode:from,parseNodesand_parseNode: optimizeIterablenodes resolution._addListToContentand__insertListToContent: Avoid input list copy.
DOMElement:- Field
tag:- Changed to NOT null.
- Always lower-case.
- Field
- html: ^0.15.3
2.1.7 #
- Added
CSSFunction(extendsCSSValues):- New
CSSValues:CSSMaxandCSSMin. CSSCalcnow extendsCSSFunction.
- New
- swiss_knife: ^3.1.5
2.1.6 #
- Fix
createTableCells.
2.1.5 #
DOMAction: implement==andhashCode.DOMGenerator:resolveActionAttribute: ensure thateventStream.listenis singleton.
- swiss_knife: ^3.1.4
2.1.4 #
DOMHtmlBrowser:toDOMElement: resolveinputvalueas attribute.
DOMElementconstructor:- Optimize tag resolution.
2.1.3 #
DOMNode:buildHTML: added parameterbuildTemplates = false.
TemplateNode:buildHTML:- respect
buildTemplatesparameter. - pass
domContexttobuildcalls.
- respect
- html: ^0.15.2
- swiss_knife: ^3.1.3
- lints: ^2.0.1
- test: ^1.23.1
- coverage: ^1.6.3
2.1.2 #
$button: Addednameanddisabled.$input,$checkbox,$radiobutton,$select,$option: Addeddisabled.INPUTElement,TEXTAREAElement,SELECTElement,OPTIONElement: Addeddisabled.- collection: ^1.17.0
2.1.1 #
- Added element events for
onKeyPress,onKeyDownandonKeyUp.
2.1.0 #
- Added helpers
$ul,$ol,$li. - Better handling of content as
Iterable(auto converted toList, to avoid re-iteration). - Updated list of self-closing tags:
area,base,br,embed,hr,img,input,link,meta,param,source,track,wbr.
- sdk: '>=2.15.0 <3.0.0'
- dependency_validator: ^3.2.2
- coverage: ^1.5.0
2.0.10 #
CSS:- Added
putIfAbsentandputAllIfAbsent. - Ensure that number values when converted to
Stringwon't end in unnecessary.0. CSSColorRGBA: ensure that when alpha is1.0it will generatergb(notrgba) with only 3 elements.
- Added
$table:- Parameters
thsStyle,trsStyleandtdsStylewon't override a CSS style already defined in the table elements.
- Parameters
- GitHub CI:
- Remove use of Dart container.
- Fix coverage command for dart 2.17+
- swiss_knife: ^3.1.1
- collection: ^1.16.0
- lints: ^2.0.0
2.0.9 #
- Dart
2.16:- Organize imports.
- Fix new lints.
- sdk: '>=2.13.0 <3.0.0'
- Added helper
$radiobutton. - Tag
video:- Allow boolean attributes: 'autoplay', 'controls' and 'muted'.
2.0.8 #
dom_builder_html_browser.dart: reuseDomParserinstance.
2.0.7 #
- Added
DOMHtml, a portable HTML handler and parser.- When compiling to the browser uses
dart:html.
- When compiling to the browser uses
- Fix
OPTIONElement.toOptions: - Migrated from package
pedantictolints. - Using Dart
coverage. - lints: ^1.0.1
- coverage: ^1.0.3
2.0.6 #
- Allow built of
DOMTemplatewithout resolveDSXentries. DOMNodeRuntime:- added
remapparameter toreplaceBy. - Improved documentation.
- added
- Improved test coverage.
- swiss_knife: ^3.0.8
- test: ^1.17.10
2.0.5 #
- Added
DOMTreeMap.queryElement. - Fix resolution of attributes with templates in some scenarios.
- Added code coverage.
2.0.4 #
- Templates now can also generate a
DOMNodeand not only texts/String. DSX:- Allow DOM elements.
- Allow observation of mapped
DSX.
- Fix
hiddenparameter, to not be defined whennull(default wasfalsenow isnull).
2.0.3 #
- Implemented
DSXsupport, similar toJSX.- Templates also accepts
DSXreferences, including functions/lambdas.
- Templates also accepts
2.0.2 #
- Null Safety adjustments.
- swiss_knife: ^3.0.6
2.0.1 #
- Null Safety adjustments.
- swiss_knife: ^3.0.5
2.0.0 #
- Dart 2.12.0:
- Sound null safety compatibility.
- Update CI dart commands.
- sdk: '>=2.12.0 <3.0.0'
- html: ^0.15.0
- swiss_knife: ^3.0.1
- pedantic: ^1.11.0
- test: ^1.16.5
1.0.26 #
- Improved
booleanattributes: 'selected', 'multiple', 'inert'. - Help
$divCenteredContent: addedstyleandclass. - New helper:
$checkbox. - Ensure that all element classes and helpers
have the global attribute
hidden. - swiss_knife: ^2.5.26
1.0.25 #
DOMElement: added event handleronLoadandonError.DOMTemplate: added support to{{intl:key}}.- swiss_knife: ^2.5.25
1.0.24 #
- Added support to content as
Future.- When a
Futureis completed, the result will be inserted in the generated DOM tree.
- When a
- Added
DOMAsyncfor async nodes.- With support for
loadingcontent, that will be replaced by result of async content.
- With support for
- Added interfaces
AsDOMElementandAsDOMNode. - Added
$selectand$optionhelpers.
1.0.23 #
- Table:
- Added support to table caption.
- Added
colspanandrowspanto helpers. - Added
thsStyleandtdsStyleto$tablehelper.
DOMTemplate:- Added
tryParseandpossiblyATemplate. - Now
TextNodewith a template code is mapped toTemplateNode. toString()now re-builds the template text code.- Improved tests.
- Added
1.0.22 #
DOMTemplate:- added
localecall action. - Added multiple actions using
;delimiter. - Added variable comparison.
- added
DOMElement: addedonChangeevents.- swiss_knife: ^2.5.18
1.0.21 #
DOMTemplate:- Added support to
{{.}}syntax. - Better resolution of variables.
- Added support to
1.0.20 #
DOMTemplate: support to template syntax, using{{...}}blocks.- Added
DOMActionandDOMActionExecutor, that can perform operations overDOMElementbased into a simple syntax. DOMNode:- Added
selectWithAllClass,selectWithAnyClass,selectByTag. - Added
containsAllClassesandcontainsAnyClass.
- Added
CSSColor: addedinversegetter.
1.0.19 #
- Added
CSSNumber. - Added
CSSBackground. CSS:- Added support to parse comments.
- Added support to CSS
backgroundandopacity.
CSSColorName: support for nametransparent.CSSBorder: improve parsing.DOMNode:- Added
onGenerateevent. - Added
containsNode. - Added
rootgetter.
- Added
- Added helper
$img. - Added helper
$divCenteredContent: A div that centers vertically and horizontally content. - Fix
DOMElement.buildHTMLfor self-closing tags. - Improved
DOMElement.possibleAttributes. DOMGenerator: addedrevertElementAttributes.DOMContext: AddedresolveCSSURLandcssURLResolver.
1.0.18 #
- Added option to generate XHTML.
- Added
resolveSource, to translate anysrcorhrefattribute. - Added
DOMGeneratorDelegate. - Fix
CSSLength, to parse double. - swiss_knife: ^2.5.14
- pedantic: ^1.9.2
- test: ^1.15.4
- test_coverage: ^0.4.3
1.0.17 #
DOMNodeRuntime: Can manipulate CSS/style.- Added
DOMContextandViewportforDOMGenerator. CSS: now is capable to convert viewport units to pixel units, based into [DOMContext] and [Viewport].- Better
CSSLength,CSSBorder,CSSColorRGB,CSSColorHEXandCSSURLparsing. - swiss_knife: ^2.5.12
1.0.16 #
- Added
CSS.parseList. - Added new base class
DOMAttributeValueCollection. - Improved
DOMGenerator.revert. - Fix typo.
1.0.15 #
DOMGenerator: Newrevertfeature.DOMGenerator:registerElementGeneratornow receives a classElementGenerator, that implementsgenerateandrevert.DOMGenerator: AddedgetElementTagandgetElementAttributes.- DOMAttribute fix: Avoid adicional space to HTML tags when
DOMAttribute.buildHTML()generates an empty string (usually false boolean attributes).
1.0.14 #
- Many improvements into CSS support.
- Added
CSSURL,CSSColorName,CSSGeneric,CSSCalc. - Added abstract class DOMAttributeValue for:
DOMAttributeValueBoolean,DOMAttributeValueString,DOMAttributeValueList,DOMAttributeValueSet,DOMAttributeValueCSS. DOMNode.buildDOMnow accepts aT parentparameter.- swiss_knife: ^2.5.8
1.0.13 #
- More
CSSsupport:CSSBorder. - Preserve CSS entries order.
- dartfmt.
1.0.12 #
- Added initial
CSSsupport.
1.0.11 #
DOMElement: fixabsorbNode.- Removed helper
$node - dartfmt.
1.0.10 #
DOMElement: addedisCompatibleForMerge.DOMGenerator: addedignoreAttributeEquivalence.DOMTreeMap: added:matchesMapping.DOMTreeMap: fixedduplicateByDOMNode,mergeNearNodes.DOMNodeRuntime: fixedmergeNode,isPreviousNode,isNextNode.- Fix
$brforamount=0.
1.0.9 #
- dartfmt.
1.0.8 #
- Added
DOMTreeMap: can be used to map aDOMNodeto a generated node. - Added
DOMNodeRuntimeandDOMNode.runtimeto manipulate and access the actual generated node from the virtual node. - Added
onClickandDOMEvent. - Added
DOMNode.copy. - Added node operations:
moveUp,moveUpNode,moveDown,moveDownNode,duplicate,duplicateNode,clearNodes,delete,deleteNode. - Added:
absorbNode,merge. - Added:
isInSameParent,isPreviousNode,isNextNode,isConsecutiveNode,isConsecutiveNode. - Added:
isStringElement,isWhiteSpace. - refactor
DOMAttribute: set values. - Added:
DOMElement.addClass. buildHTML: prioritize attributes: id, class and style. Also shows boolean attributes at end of tag.buildHTML: Char \xa0 is replaced to to rollback conversion.- External element function: now accepts non argument version.
- Optimize call to
asNodeSelector. - Added tests.
- Added
test_coverage. - swiss_knife: ^2.5.5
1.0.7 #
- Added helpers for
headerandfooter. - dartfmt
1.0.6 #
- dartfmt.
1.0.5 #
- Added API Documentation.
- dartfmt.
- swiss_knife: ^2.5.2
1.0.4 #
- Fix README example and new examples.
- Fix 'dartdoc' issues.
1.0.3 #
- Better handling of selectors formats: .class, #id, tag
- Table support.
- Fix build HTML with ident.
- Element helpers: $input, $textarea, $button, $label, $p, $br, $hr, $table, $thead, $tfoot, $tbody, $tr, $td, $th, $$divInline.
1.0.2 #
- Added support for external elements.
1.0.1 #
- Add generic DOMGenerator and support for dart:html.
1.0.0 #
- Initial version, created by Stagehand