#[repr(C)]pub struct Dom {
pub root: NodeData,
pub children: DomVec,
pub css: CssVec,
pub estimated_total_children: usize,
}Expand description
The document model, similar to HTML. This is a create-only structure, you don’t actually read anything back from it. It’s designed for ease of construction.
This is the “slow” tree-based DOM. For bulk construction (XML parsing),
use FastDom which builds flat arenas directly and skips the tree→arena conversion.
Fields§
§root: NodeDataThe data for the root node of this DOM (or sub-DOM).
children: DomVecThe children of this DOM node.
css: CssVecOrdered list of CSS stylesheets to apply to this DOM subtree. Stylesheets are applied in push order during the single deferred cascade pass. Later entries override earlier ones (higher cascade priority).
estimated_total_children: usizeImplementations§
Source§impl Dom
impl Dom
Sourcepub fn create_node(node_type: NodeType) -> Self
pub fn create_node(node_type: NodeType) -> Self
Creates an empty DOM with a give NodeType. Note: This is a const fn and
doesn’t allocate, it only allocates once you add at least one child node.
pub fn create_from_data(node_data: NodeData) -> Self
Sourcepub const fn create_html() -> Self
pub const fn create_html() -> Self
Creates the root HTML element.
Accessibility: The <html> element is the root of an HTML document and should have a
lang attribute.
Sourcepub const fn create_head() -> Self
pub const fn create_head() -> Self
Creates the document head element.
Accessibility: The <head> contains metadata. Use <title> for page titles.
pub const fn create_body() -> Self
Sourcepub const fn create_div() -> Self
pub const fn create_div() -> Self
Creates a generic block-level container.
Accessibility: Prefer semantic elements like <article>, <section>, <nav> when
applicable.
Sourcepub const fn create_article() -> Self
pub const fn create_article() -> Self
Creates an article element.
Accessibility: Represents self-contained content that could be distributed independently. Screen readers can navigate by articles. Consider adding aria-label for multiple articles.
Sourcepub const fn create_section() -> Self
pub const fn create_section() -> Self
Creates a section element.
Accessibility: Represents a thematic grouping of content with a heading. Should typically have a heading (h1-h6) as a child. Consider aria-labelledby.
Creates a navigation element.
Accessibility: Represents navigation links. Screen readers can jump to navigation. Use aria-label to distinguish multiple nav elements (e.g., “Main navigation”, “Footer links”).
Sourcepub const fn create_aside() -> Self
pub const fn create_aside() -> Self
Creates an aside element.
Accessibility: Represents content tangentially related to main content (sidebars, callouts). Screen readers announce this as complementary content.
Sourcepub const fn create_header() -> Self
pub const fn create_header() -> Self
Creates a header element.
Accessibility: Represents introductory content or navigational aids. Can be used for page headers or section headers.
Creates a footer element.
Accessibility: Represents footer for nearest section or page. Typically contains copyright, author info, or related links.
Sourcepub const fn create_main() -> Self
pub const fn create_main() -> Self
Creates a main content element.
Accessibility: Represents the dominant content. There should be only ONE main per page. Screen readers can jump directly to main content. Do not nest inside article/aside/footer/header/nav.
Sourcepub const fn create_figure() -> Self
pub const fn create_figure() -> Self
Creates a figure element.
Accessibility: Represents self-contained content like diagrams, photos, code listings.
Use with <figcaption> to provide a caption. Screen readers associate caption with figure.
Sourcepub const fn create_figcaption() -> Self
pub const fn create_figcaption() -> Self
Creates a figure caption element.
Accessibility: Provides a caption for <figure>. Screen readers announce this as the
figure description.
Sourcepub const fn create_details_no_a11y() -> Self
pub const fn create_details_no_a11y() -> Self
Creates a details disclosure element without accessibility information.
Prefer Dom::create_details so that screen readers announce the
disclosure widget’s purpose.
Sourcepub fn create_details(aria: SmallAriaInfo) -> Self
pub fn create_details(aria: SmallAriaInfo) -> Self
Creates a details disclosure element with accessibility information.
Accessibility: Creates a disclosure widget. Screen readers announce expanded/collapsed
state. Must contain a <summary> element. Keyboard accessible by default.
Use Dom::create_details_no_a11y only as a deliberate escape hatch.
Sourcepub const fn create_summary_no_a11y() -> Self
pub const fn create_summary_no_a11y() -> Self
Creates an empty summary element for details without accessibility information.
Prefer Dom::create_summary so that screen readers can announce the
disclosure heading.
Sourcepub fn create_summary(aria: SmallAriaInfo) -> Self
pub fn create_summary(aria: SmallAriaInfo) -> Self
Creates an empty summary element for details with accessibility information.
Accessibility: The visible heading/label for <details>.
Must be the first child of details. Keyboard accessible (Enter/Space to toggle).
Use Dom::create_summary_no_a11y only as a deliberate escape hatch.
Sourcepub fn create_summary_with_text_no_a11y<S: Into<AzString>>(text: S) -> Self
pub fn create_summary_with_text_no_a11y<S: Into<AzString>>(text: S) -> Self
Creates a summary element with text without accessibility information.
Prefer Dom::create_summary_with_text so that screen readers
announce the disclosure heading.
Sourcepub fn create_summary_with_text<S: Into<AzString>>(
text: S,
aria: SmallAriaInfo,
) -> Self
pub fn create_summary_with_text<S: Into<AzString>>( text: S, aria: SmallAriaInfo, ) -> Self
Creates a summary element with text and accessibility information for details.
Accessibility: The visible heading/label for <details>.
Must be the first child of details. Keyboard accessible (Enter/Space to toggle).
Use Dom::create_summary_with_text_no_a11y only as a deliberate escape hatch.
Sourcepub const fn create_dialog_no_a11y() -> Self
pub const fn create_dialog_no_a11y() -> Self
Creates a dialog element without accessibility information.
Prefer Dom::create_dialog so that the dialog’s purpose, modality,
and described-by relationship are surfaced to assistive technologies.
Sourcepub fn create_dialog(aria: DialogAriaInfo) -> Self
pub fn create_dialog(aria: DialogAriaInfo) -> Self
Creates a dialog element with accessibility information.
Accessibility: Represents a modal or non-modal dialog. When opened as modal, focus is trapped. Use aria-label or aria-labelledby. Escape key should close modal dialogs.
Use Dom::create_dialog_no_a11y only as a deliberate escape hatch.
pub const fn create_br() -> Self
pub fn create_text<S: Into<AzString>>(value: S) -> Self
pub fn create_image(image: ImageRef) -> Self
Sourcepub fn create_icon<S: Into<AzString>>(icon_name: S) -> Self
pub fn create_icon<S: Into<AzString>>(icon_name: S) -> Self
Creates an icon node with the given icon name.
The icon name should match names from the icon provider (e.g., “home”, “settings”, “search”).
Icons are resolved to actual content (font glyph, image, etc.) during StyledDom creation
based on the configured IconProvider.
§Example
Dom::create_icon("home")
.with_class("nav-icon")pub fn create_virtual_view( data: RefAny, callback: impl Into<VirtualViewCallback>, ) -> Self
Sourcepub fn create_geolocation_probe(config: GeolocationProbeConfig) -> Self
pub fn create_geolocation_probe(config: GeolocationProbeConfig) -> Self
Creates an invisible NodeType::GeolocationProbe node that
signals “this subtree needs the user’s location”. Lays out as
zero-size and is skipped in the display list - the framework
scans for it at end-of-layout and starts / stops the native
CLLocationManager / LocationManager / geoclue
subscription. See SUPER_PLAN_2.md section 1.5.
Sourcepub const fn create_p() -> Self
pub const fn create_p() -> Self
Creates a paragraph element.
Accessibility: Paragraphs provide semantic structure for screen readers.
Sourcepub const fn create_h1() -> Self
pub const fn create_h1() -> Self
Creates an empty heading level 1 element.
Accessibility: Use h1 for the main page title. There should typically be only one h1
per page.
Sourcepub fn create_h1_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_h1_with_text<S: Into<AzString>>(text: S) -> Self
Creates a heading level 1 element with text.
Accessibility: Use h1 for the main page title. There should typically be only one h1
per page.
Parameters:
text: Heading text
Sourcepub const fn create_h2() -> Self
pub const fn create_h2() -> Self
Creates an empty heading level 2 element.
Accessibility: Use h2 for major section headings under h1.
Sourcepub fn create_h2_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_h2_with_text<S: Into<AzString>>(text: S) -> Self
Creates a heading level 2 element with text.
Accessibility: Use h2 for major section headings under h1.
Parameters:
text: Heading text
Sourcepub const fn create_h3() -> Self
pub const fn create_h3() -> Self
Creates an empty heading level 3 element.
Accessibility: Use h3 for subsections under h2.
Sourcepub fn create_h3_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_h3_with_text<S: Into<AzString>>(text: S) -> Self
Creates a heading level 3 element with text.
Accessibility: Use h3 for subsections under h2.
Parameters:
text: Heading text
Sourcepub fn create_h4_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_h4_with_text<S: Into<AzString>>(text: S) -> Self
Creates a heading level 4 element with text.
Parameters:
text: Heading text
Sourcepub fn create_h5_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_h5_with_text<S: Into<AzString>>(text: S) -> Self
Creates a heading level 5 element with text.
Parameters:
text: Heading text
Sourcepub fn create_h6_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_h6_with_text<S: Into<AzString>>(text: S) -> Self
Creates a heading level 6 element with text.
Parameters:
text: Heading text
Sourcepub const fn create_span() -> Self
pub const fn create_span() -> Self
Creates an empty generic inline container (span).
Accessibility: Prefer semantic elements like strong, em, code, etc. when
applicable.
Sourcepub fn create_span_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_span_with_text<S: Into<AzString>>(text: S) -> Self
Creates a generic inline container (span) with text.
Accessibility: Prefer semantic elements like strong, em, code, etc. when
applicable.
Parameters:
text: Span content
Sourcepub const fn create_strong() -> Self
pub const fn create_strong() -> Self
Creates an empty strong importance element.
Accessibility: Use strong instead of b for semantic meaning.
Sourcepub fn create_strong_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_strong_with_text<S: Into<AzString>>(text: S) -> Self
Creates a strongly emphasized text element with text (strong importance).
Accessibility: Use strong instead of b for semantic meaning. Screen readers can
convey the importance. Use for text that has strong importance, seriousness, or urgency.
Parameters:
text: Text to emphasize
Sourcepub const fn create_em() -> Self
pub const fn create_em() -> Self
Creates an empty emphasis element (stress emphasis).
Accessibility: Use em instead of i for semantic meaning.
Sourcepub fn create_em_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_em_with_text<S: Into<AzString>>(text: S) -> Self
Creates an emphasized text element with text (stress emphasis).
Accessibility: Use em instead of i for semantic meaning. Screen readers can
convey the emphasis. Use for text that has stress emphasis.
Parameters:
text: Text to emphasize
Sourcepub fn create_code() -> Self
pub fn create_code() -> Self
Creates an empty code element.
Accessibility: Represents a fragment of computer code.
Sourcepub fn create_code_with_text<S: Into<AzString>>(code: S) -> Self
pub fn create_code_with_text<S: Into<AzString>>(code: S) -> Self
Creates a code/computer code element with text.
Accessibility: Represents a fragment of computer code. Screen readers can identify this as code content.
Parameters:
code: Code content
Sourcepub fn create_pre() -> Self
pub fn create_pre() -> Self
Creates an empty preformatted text element.
Accessibility: Preserves whitespace and line breaks.
Sourcepub fn create_pre_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_pre_with_text<S: Into<AzString>>(text: S) -> Self
Creates a preformatted text element with text.
Accessibility: Preserves whitespace and line breaks. Useful for code blocks or ASCII art. Screen readers will read the content as-is.
Parameters:
text: Preformatted content
Sourcepub fn create_blockquote() -> Self
pub fn create_blockquote() -> Self
Creates an empty blockquote element.
Accessibility: Represents a section quoted from another source.
Sourcepub fn create_blockquote_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_blockquote_with_text<S: Into<AzString>>(text: S) -> Self
Creates a blockquote element with text.
Accessibility: Represents a section quoted from another source. Screen readers
can identify quoted content. Consider adding a cite attribute.
Parameters:
text: Quote content
Sourcepub fn create_cite() -> Self
pub fn create_cite() -> Self
Creates an empty citation element.
Accessibility: Represents a reference to a creative work.
Sourcepub fn create_cite_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_cite_with_text<S: Into<AzString>>(text: S) -> Self
Creates a citation element with text.
Accessibility: Represents a reference to a creative work. Screen readers can identify citations.
Parameters:
text: Citation text
Sourcepub fn create_abbr() -> Self
pub fn create_abbr() -> Self
Creates an empty abbreviation element.
Accessibility: Represents an abbreviation or acronym. Use with a title attribute
to provide the full expansion for screen readers.
Sourcepub fn create_abbr_with_title(abbr_text: AzString, title: AzString) -> Self
pub fn create_abbr_with_title(abbr_text: AzString, title: AzString) -> Self
Creates an abbreviation element with abbreviated text and a title expansion.
Accessibility: Represents an abbreviation or acronym. The title attribute
provides the full expansion for screen readers.
Parameters:
abbr_text: Abbreviated texttitle: Full expansion
Sourcepub fn create_kbd() -> Self
pub fn create_kbd() -> Self
Creates an empty keyboard input element.
Accessibility: Represents keyboard input or key combinations.
Sourcepub fn create_kbd_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_kbd_with_text<S: Into<AzString>>(text: S) -> Self
Creates a keyboard input element with text.
Accessibility: Represents keyboard input or key combinations. Screen readers can identify keyboard instructions.
Parameters:
text: Keyboard instruction
Sourcepub fn create_samp() -> Self
pub fn create_samp() -> Self
Creates an empty sample output element.
Accessibility: Represents sample output from a program or computing system.
Sourcepub fn create_samp_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_samp_with_text<S: Into<AzString>>(text: S) -> Self
Creates a sample output element with text.
Accessibility: Represents sample output from a program or computing system.
Parameters:
text: Sample text
Sourcepub fn create_var() -> Self
pub fn create_var() -> Self
Creates an empty variable element.
Accessibility: Represents a variable in mathematical expressions or programming.
Sourcepub fn create_var_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_var_with_text<S: Into<AzString>>(text: S) -> Self
Creates a variable element with text.
Accessibility: Represents a variable in mathematical expressions or programming.
Parameters:
text: Variable name
Sourcepub fn create_sub() -> Self
pub fn create_sub() -> Self
Creates an empty subscript element.
Sourcepub fn create_sub_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_sub_with_text<S: Into<AzString>>(text: S) -> Self
Creates a subscript element with text.
Accessibility: Screen readers may announce subscript formatting.
Parameters:
text: Subscript content
Sourcepub fn create_sup() -> Self
pub fn create_sup() -> Self
Creates an empty superscript element.
Sourcepub fn create_sup_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_sup_with_text<S: Into<AzString>>(text: S) -> Self
Creates a superscript element with text.
Accessibility: Screen readers may announce superscript formatting.
Parameters:
text: Superscript content
Sourcepub fn create_u_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_u_with_text<S: Into<AzString>>(text: S) -> Self
Creates an underline text element with text.
Accessibility: Screen readers typically don’t announce underline formatting.
Use semantic elements when possible (e.g., <em> for emphasis).
Sourcepub fn create_s_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_s_with_text<S: Into<AzString>>(text: S) -> Self
Creates a strikethrough text element with text.
Accessibility: Represents text that is no longer accurate or relevant.
Consider using <del> for deleted content with datetime attribute.
Sourcepub fn create_mark() -> Self
pub fn create_mark() -> Self
Creates an empty mark element.
Sourcepub fn create_mark_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_mark_with_text<S: Into<AzString>>(text: S) -> Self
Creates a marked/highlighted text element with text.
Accessibility: Represents text marked for reference or notation purposes. Screen readers may announce this as “highlighted”.
Sourcepub fn create_del() -> Self
pub fn create_del() -> Self
Creates an empty deleted text element.
Sourcepub fn create_del_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_del_with_text<S: Into<AzString>>(text: S) -> Self
Creates a deleted text element with text.
Accessibility: Represents deleted content in document edits.
Use with datetime and cite attributes for edit tracking.
Sourcepub fn create_ins() -> Self
pub fn create_ins() -> Self
Creates an empty inserted text element.
Sourcepub fn create_ins_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_ins_with_text<S: Into<AzString>>(text: S) -> Self
Creates an inserted text element with text.
Accessibility: Represents inserted content in document edits.
Use with datetime and cite attributes for edit tracking.
Sourcepub fn create_dfn() -> Self
pub fn create_dfn() -> Self
Creates an empty definition element.
Sourcepub fn create_dfn_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_dfn_with_text<S: Into<AzString>>(text: S) -> Self
Creates a definition element with text.
Accessibility: Represents the defining instance of a term.
Often used within a definition list or with <abbr>.
Sourcepub fn create_time(text: AzString, datetime: OptionString) -> Self
pub fn create_time(text: AzString, datetime: OptionString) -> Self
Creates a time element.
Accessibility: Represents a specific time or date.
Use datetime attribute for machine-readable format.
Parameters:
text: Human-readable time/datedatetime: Optional machine-readable datetime
Sourcepub fn create_bdo() -> Self
pub fn create_bdo() -> Self
Creates an empty bi-directional override element.
Accessibility: Overrides text direction. Use dir attribute (ltr/rtl).
Sourcepub fn create_bdo_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_bdo_with_text<S: Into<AzString>>(text: S) -> Self
Creates a bi-directional override element with text.
Accessibility: Overrides text direction. Use dir attribute (ltr/rtl).
Sourcepub fn create_b() -> Self
pub fn create_b() -> Self
Creates an empty bold element.
Accessibility: Prefer <strong> for semantic emphasis. <b> is purely stylistic.
Sourcepub fn create_b_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_b_with_text<S: Into<AzString>>(text: S) -> Self
Creates a bold element with text.
Accessibility: Prefer <strong> for semantic emphasis. <b> is purely stylistic.
Parameters:
text: Bold text content
Sourcepub fn create_i() -> Self
pub fn create_i() -> Self
Creates an empty italic element.
Accessibility: Prefer <em> for stress emphasis. <i> is purely stylistic.
Sourcepub fn create_i_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_i_with_text<S: Into<AzString>>(text: S) -> Self
Creates an italic element with text.
Accessibility: Prefer <em> for stress emphasis. <i> is purely stylistic.
Parameters:
text: Italic text content
Sourcepub fn create_small() -> Self
pub fn create_small() -> Self
Creates an empty small text element.
Accessibility: Represents side-comments and small print like copyright/legal text.
Sourcepub fn create_small_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_small_with_text<S: Into<AzString>>(text: S) -> Self
Creates a small text element with text.
Parameters:
text: Small text content
Sourcepub fn create_big() -> Self
pub fn create_big() -> Self
Creates an empty <big> element.
Note: Deprecated in HTML5. Prefer CSS font-size.
Sourcepub fn create_big_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_big_with_text<S: Into<AzString>>(text: S) -> Self
Creates a <big> element with text.
Note: Deprecated in HTML5. Prefer CSS font-size.
Sourcepub fn create_bdi() -> Self
pub fn create_bdi() -> Self
Creates an empty bi-directional isolate element.
Accessibility: Used to isolate text whose direction is unknown, keeping it from affecting surrounding bidi layout.
Sourcepub fn create_bdi_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_bdi_with_text<S: Into<AzString>>(text: S) -> Self
Creates a bi-directional isolate element with text.
Accessibility: Used to isolate text whose direction is unknown, keeping it from affecting surrounding bidi layout.
Sourcepub fn create_wbr() -> Self
pub fn create_wbr() -> Self
Creates an empty word break opportunity element.
Note: <wbr> is a self-closing element that suggests a line-break opportunity.
It does not take text content.
Sourcepub fn create_ruby() -> Self
pub fn create_ruby() -> Self
Creates an empty ruby annotation element.
Accessibility: Used for East Asian typography to provide
pronunciation/translation annotations. Wraps <rt>/<rp> children.
Sourcepub fn create_rt() -> Self
pub fn create_rt() -> Self
Creates an empty ruby text element.
Accessibility: Pronunciation/translation annotation inside <ruby>.
Sourcepub fn create_rt_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_rt_with_text<S: Into<AzString>>(text: S) -> Self
Creates a ruby text element with text.
Parameters:
text: Ruby annotation content
Sourcepub fn create_rtc() -> Self
pub fn create_rtc() -> Self
Creates an empty ruby text container element.
Accessibility: Container for ruby text annotations.
Sourcepub fn create_rp() -> Self
pub fn create_rp() -> Self
Creates an empty ruby fallback parenthesis element.
Accessibility: Provides parentheses around <rt> for browsers without ruby support.
Sourcepub fn create_rp_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_rp_with_text<S: Into<AzString>>(text: S) -> Self
Creates a ruby fallback parenthesis element with text.
Parameters:
text: Parenthesis text (typically “(” or “)”)
Sourcepub fn create_data(value: AzString) -> Self
pub fn create_data(value: AzString) -> Self
Creates a <data> element binding a machine-readable value to its content.
Parameters:
value: Machine-readable value for thevalueattribute.
Sourcepub fn create_data_with_text(value: AzString, text: AzString) -> Self
pub fn create_data_with_text(value: AzString, text: AzString) -> Self
Creates a <data> element with both a machine-readable value and visible text.
Parameters:
value: Machine-readable value for thevalueattribute.text: Human-readable text content.
Sourcepub fn create_dir() -> Self
pub fn create_dir() -> Self
Creates an empty directory list element.
Note: Deprecated in HTML5. Use <ul> instead.
Sourcepub fn create_svg() -> Self
pub fn create_svg() -> Self
Creates an empty SVG container element.
Accessibility: Provide aria-label or <title> child for assistive tech.
Sourcepub fn create_a_no_a11y(href: AzString, label: OptionString) -> Self
pub fn create_a_no_a11y(href: AzString, label: OptionString) -> Self
Creates an anchor/hyperlink element without accessibility information.
Prefer Dom::create_a so that screen readers get a meaningful label.
Parameters:
href: Link destination URLlabel: Link text (passNonefor image-only links with alt text)
Creates a button element without accessibility information.
Prefer Dom::create_button so that the element has a meaningful accessible
name for screen readers.
Parameters:
text: Button label text
Sourcepub fn create_label_no_a11y(for_id: AzString, text: AzString) -> Self
pub fn create_label_no_a11y(for_id: AzString, text: AzString) -> Self
Creates a label element for form controls without accessibility information.
Prefer Dom::create_label so that screen readers get a descriptive label.
Parameters:
for_id: ID of the associated form controltext: Label text
Sourcepub fn create_input_no_a11y(
input_type: AzString,
name: AzString,
label: AzString,
) -> Self
pub fn create_input_no_a11y( input_type: AzString, name: AzString, label: AzString, ) -> Self
Creates an input element without accessibility information.
Prefer Dom::create_input so that screen readers get a descriptive label
beyond the HTML aria-label attribute.
Parameters:
input_type: Input type (text, password, email, etc.)name: Form field namelabel: Accessibility label (required)
Sourcepub fn create_textarea_no_a11y(name: AzString, label: AzString) -> Self
pub fn create_textarea_no_a11y(name: AzString, label: AzString) -> Self
Creates a textarea element without accessibility information.
Prefer Dom::create_textarea so that screen readers get an accurate
description of the control.
Parameters:
name: Form field namelabel: Accessibility label (required)
Sourcepub fn create_select_no_a11y(name: AzString, label: AzString) -> Self
pub fn create_select_no_a11y(name: AzString, label: AzString) -> Self
Creates a select dropdown element without accessibility information.
Prefer Dom::create_select so that screen readers announce the control
appropriately.
Parameters:
name: Form field namelabel: Accessibility label (required)
Sourcepub fn create_option_no_a11y(value: AzString, text: AzString) -> Self
pub fn create_option_no_a11y(value: AzString, text: AzString) -> Self
Creates an option element for select dropdowns.
Parameters:
value: Option valuetext: Display text
Sourcepub fn create_option(
value: AzString,
text: AzString,
aria: SmallAriaInfo,
) -> Self
pub fn create_option( value: AzString, text: AzString, aria: SmallAriaInfo, ) -> Self
Creates an option element for select dropdowns with accessibility information.
Parameters:
value: Option valuetext: Display textaria: Accessibility information (description, etc.)
Use Dom::create_option_no_a11y only as a deliberate escape hatch.
Sourcepub fn create_ul() -> Self
pub fn create_ul() -> Self
Creates an unordered list element.
Accessibility: Screen readers announce lists and item counts, helping users understand content structure.
Sourcepub fn create_ol() -> Self
pub fn create_ol() -> Self
Creates an ordered list element.
Accessibility: Screen readers announce lists and item counts, helping users understand content structure and numbering.
Sourcepub fn create_li() -> Self
pub fn create_li() -> Self
Creates a list item element.
Accessibility: Must be a child of ul, ol, or menu. Screen readers announce
list item position (e.g., “2 of 5”).
Sourcepub fn create_table_no_a11y() -> Self
pub fn create_table_no_a11y() -> Self
Creates a table element without accessibility information.
Prefer Dom::create_table so that screen readers can announce the table’s
purpose alongside its caption.
Sourcepub fn create_caption() -> Self
pub fn create_caption() -> Self
Creates a table caption element.
Accessibility: Describes the purpose of the table. Screen readers announce this first.
Sourcepub fn create_thead() -> Self
pub fn create_thead() -> Self
Creates a table header element.
Accessibility: Groups header rows. Screen readers can navigate table structure.
Sourcepub fn create_tbody() -> Self
pub fn create_tbody() -> Self
Creates a table body element.
Accessibility: Groups body rows. Screen readers can navigate table structure.
Sourcepub fn create_tfoot() -> Self
pub fn create_tfoot() -> Self
Creates a table footer element.
Accessibility: Groups footer rows. Screen readers can navigate table structure.
Sourcepub fn create_th() -> Self
pub fn create_th() -> Self
Creates a table header cell element.
Accessibility: Use scope attribute (“col” or “row”) to associate headers with
data cells. Screen readers use this to announce cell context.
Sourcepub fn create_form_no_a11y() -> Self
pub fn create_form_no_a11y() -> Self
Creates a form element without accessibility information.
Prefer Dom::create_form so that screen readers can announce the form’s purpose.
Sourcepub fn create_form(aria: SmallAriaInfo) -> Self
pub fn create_form(aria: SmallAriaInfo) -> Self
Creates a form element with accessibility information.
Accessibility: Group related form controls with fieldset and legend.
Provide clear labels for all inputs. Consider aria-describedby for instructions.
Use Dom::create_form_no_a11y only as a deliberate escape hatch.
Sourcepub fn create_fieldset_no_a11y() -> Self
pub fn create_fieldset_no_a11y() -> Self
Creates a fieldset element for grouping form controls without accessibility info.
Prefer Dom::create_fieldset so that screen readers can announce the group’s purpose.
Sourcepub fn create_fieldset(aria: SmallAriaInfo) -> Self
pub fn create_fieldset(aria: SmallAriaInfo) -> Self
Creates a fieldset element with accessibility information.
Accessibility: Groups related form controls. Always include a legend as the
first child to describe the group. Screen readers announce the legend when entering
the fieldset.
Use Dom::create_fieldset_no_a11y only as a deliberate escape hatch.
Sourcepub fn create_legend_no_a11y() -> Self
pub fn create_legend_no_a11y() -> Self
Creates a legend element without accessibility information.
Prefer Dom::create_legend so that the legend’s accessible name is explicit.
Sourcepub fn create_legend(aria: SmallAriaInfo) -> Self
pub fn create_legend(aria: SmallAriaInfo) -> Self
Creates a legend element with accessibility information.
Accessibility: Describes the purpose of a fieldset. Must be the first child of a fieldset. Screen readers announce this when entering the fieldset.
Use Dom::create_legend_no_a11y only as a deliberate escape hatch.
Sourcepub fn create_hr() -> Self
pub fn create_hr() -> Self
Creates a horizontal rule element.
Accessibility: Represents a thematic break. Screen readers may announce this as a separator. Consider using CSS borders for purely decorative lines.
Sourcepub const fn create_address() -> Self
pub const fn create_address() -> Self
Creates an address element.
Accessibility: Represents contact information. Screen readers identify this as address content.
Sourcepub const fn create_dl() -> Self
pub const fn create_dl() -> Self
Creates a definition list element.
Accessibility: Screen readers announce definition lists and their structure.
Sourcepub const fn create_dt() -> Self
pub const fn create_dt() -> Self
Creates a definition term element.
Accessibility: Must be a child of dl. Represents the term being defined.
Sourcepub const fn create_dd() -> Self
pub const fn create_dd() -> Self
Creates a definition description element.
Accessibility: Must be a child of dl. Provides the definition for the term.
Sourcepub const fn create_colgroup() -> Self
pub const fn create_colgroup() -> Self
Creates a table column group element.
Sourcepub fn create_col(span: i32) -> Self
pub fn create_col(span: i32) -> Self
Creates a table column element.
Sourcepub fn create_optgroup_no_a11y(label: AzString) -> Self
pub fn create_optgroup_no_a11y(label: AzString) -> Self
Creates an optgroup element for grouping select options without accessibility info.
Prefer Dom::create_optgroup so that screen readers can announce the group’s purpose.
Parameters:
label: Label for the option group
Sourcepub fn create_optgroup(label: AzString, aria: SmallAriaInfo) -> Self
pub fn create_optgroup(label: AzString, aria: SmallAriaInfo) -> Self
Creates an optgroup element for grouping select options with accessibility information.
Parameters:
label: Label for the option group (visible)aria: Additional accessibility information (description, etc.)
Use Dom::create_optgroup_no_a11y only as a deliberate escape hatch.
Sourcepub const fn create_q() -> Self
pub const fn create_q() -> Self
Creates a quotation element.
Accessibility: Represents an inline quotation.
Sourcepub const fn create_acronym() -> Self
pub const fn create_acronym() -> Self
Creates an empty acronym element.
Note: Deprecated in HTML5. Consider using create_abbr() instead.
Sourcepub fn create_acronym_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_acronym_with_text<S: Into<AzString>>(text: S) -> Self
Creates an acronym element with text.
Note: Deprecated in HTML5. Consider using create_abbr_with_title() instead.
Creates a menu element without accessibility information.
Prefer Dom::create_menu so that the menu’s purpose is announced.
Creates a menu element with accessibility information.
Accessibility: Represents a list of commands. Similar to <ul> but semantic for
toolbars/menus.
Use Dom::create_menu_no_a11y only as a deliberate escape hatch.
Creates an empty menu item element without accessibility information.
Prefer Dom::create_menuitem so that the menu item’s purpose is announced.
Creates an empty menu item element with accessibility information.
Accessibility: Represents a command in a menu. Use with appropriate role/aria attributes.
Use Dom::create_menuitem_no_a11y only as a deliberate escape hatch.
Creates a menu item element with text but without accessibility information.
Prefer Dom::create_menuitem_with_text so that screen readers get a
distinct accessible name in addition to the visible text.
Creates a menu item element with text and accessibility information.
Accessibility: Represents a command in a menu. Use with appropriate role/aria attributes.
Use Dom::create_menuitem_with_text_no_a11y only as a deliberate escape hatch.
Sourcepub const fn create_output_no_a11y() -> Self
pub const fn create_output_no_a11y() -> Self
Creates an output element without accessibility information.
Prefer Dom::create_output so that screen readers can announce the
computed value’s purpose.
Sourcepub fn create_output(aria: SmallAriaInfo) -> Self
pub fn create_output(aria: SmallAriaInfo) -> Self
Creates an output element with accessibility information.
Accessibility: Represents the result of a calculation or user action.
Use for attribute to associate with input elements. Screen readers announce updates.
Use Dom::create_output_no_a11y only as a deliberate escape hatch.
Sourcepub fn create_progress_no_a11y(value: f32, max: f32) -> Self
pub fn create_progress_no_a11y(value: f32, max: f32) -> Self
Creates a progress indicator element without accessibility information.
Prefer Dom::create_progress so that the task being measured is announced.
Parameters:
value: Current progress valuemax: Maximum value
Sourcepub fn create_progress(aria: ProgressAriaInfo) -> Self
pub fn create_progress(aria: ProgressAriaInfo) -> Self
Creates a progress indicator element with accessibility information.
Accessibility: Represents task progress. Screen readers announce progress
percentage. The aria value carries the label, current value, max, and an
indeterminate flag for spinners with no known endpoint.
Use Dom::create_progress_no_a11y only as a deliberate escape hatch.
Sourcepub fn create_meter_no_a11y(value: f32, min: f32, max: f32) -> Self
pub fn create_meter_no_a11y(value: f32, min: f32, max: f32) -> Self
Creates a meter gauge element without accessibility information.
Prefer Dom::create_meter so that the measurement’s purpose is announced.
Parameters:
value: Current meter valuemin: Minimum valuemax: Maximum value
Sourcepub fn create_meter(aria: MeterAriaInfo) -> Self
pub fn create_meter(aria: MeterAriaInfo) -> Self
Creates a meter gauge element with accessibility information.
Accessibility: Represents a scalar measurement within a known range.
Screen readers announce the measurement. The aria value carries the
label plus value/min/max/low/high/optimum metadata.
Use Dom::create_meter_no_a11y only as a deliberate escape hatch.
Sourcepub const fn create_datalist_no_a11y() -> Self
pub const fn create_datalist_no_a11y() -> Self
Creates a datalist element without accessibility information.
Prefer Dom::create_datalist so that the suggestion list’s purpose is announced.
Sourcepub fn create_datalist(aria: SmallAriaInfo) -> Self
pub fn create_datalist(aria: SmallAriaInfo) -> Self
Creates a datalist element with accessibility information.
Accessibility: Provides autocomplete options for inputs.
Associate with input using list attribute. Screen readers announce available options.
Use Dom::create_datalist_no_a11y only as a deliberate escape hatch.
Sourcepub const fn create_canvas_no_a11y() -> Self
pub const fn create_canvas_no_a11y() -> Self
Creates a canvas element for graphics without accessibility information.
Prefer Dom::create_canvas so that the canvas’s purpose is announced; canvas
content is otherwise opaque to assistive technologies.
Sourcepub fn create_canvas(aria: SmallAriaInfo) -> Self
pub fn create_canvas(aria: SmallAriaInfo) -> Self
Creates a canvas element for graphics with accessibility information.
Accessibility: Canvas content is not accessible by default. Always provide fallback content as children and/or detailed aria-label. Consider using SVG for accessible graphics when possible.
Use Dom::create_canvas_no_a11y only as a deliberate escape hatch.
Sourcepub const fn create_object() -> Self
pub const fn create_object() -> Self
Creates an object element for embedded content.
Accessibility: Provide fallback content as children. Use aria-label to describe content.
Sourcepub fn create_param(name: AzString, value: AzString) -> Self
pub fn create_param(name: AzString, value: AzString) -> Self
Creates a param element for object parameters.
Parameters:
name: Parameter namevalue: Parameter value
Sourcepub const fn create_embed() -> Self
pub const fn create_embed() -> Self
Creates an embed element.
Accessibility: Provide alternative content or link. Use aria-label to describe embedded content.
Sourcepub const fn create_audio_no_a11y() -> Self
pub const fn create_audio_no_a11y() -> Self
Creates an audio element without accessibility information.
Prefer Dom::create_audio so that screen readers announce the audio’s purpose.
Sourcepub fn create_audio(aria: SmallAriaInfo) -> Self
pub fn create_audio(aria: SmallAriaInfo) -> Self
Creates an audio element with accessibility information.
Accessibility: Always provide controls. Use <track> for captions/subtitles.
Provide fallback text for unsupported browsers.
Use Dom::create_audio_no_a11y only as a deliberate escape hatch.
Sourcepub const fn create_video_no_a11y() -> Self
pub const fn create_video_no_a11y() -> Self
Creates a video element without accessibility information.
Prefer Dom::create_video so that screen readers announce the video’s purpose.
Sourcepub fn create_video(aria: SmallAriaInfo) -> Self
pub fn create_video(aria: SmallAriaInfo) -> Self
Creates a video element with accessibility information.
Accessibility: Always provide controls. Use <track> for
captions/subtitles/descriptions. Provide fallback text. Consider providing transcript.
Use Dom::create_video_no_a11y only as a deliberate escape hatch.
Sourcepub fn create_source(src: AzString, media_type: AzString) -> Self
pub fn create_source(src: AzString, media_type: AzString) -> Self
Creates a source element for media.
Parameters:
src: Media source URLmedia_type: MIME type (e.g., “video/mp4”, “audio/ogg”)
Sourcepub fn create_track(src: AzString, kind: AzString) -> Self
pub fn create_track(src: AzString, kind: AzString) -> Self
Creates a track element for media captions/subtitles.
Accessibility: Essential for deaf/hard-of-hearing users and non-native speakers.
Use kind (subtitles/captions/descriptions), srclang, and label attributes.
Parameters:
src: Track file URL (WebVTTformat)kind: Track kind (“subtitles”, “captions”, “descriptions”, “chapters”, “metadata”)
Sourcepub const fn create_map() -> Self
pub const fn create_map() -> Self
Creates a map element for image maps.
Accessibility: Provide text alternatives. Ensure all areas have alt text.
Sourcepub const fn create_area_no_a11y() -> Self
pub const fn create_area_no_a11y() -> Self
Creates an area element for image map regions without accessibility information.
Prefer Dom::create_area so that screen readers can announce the region’s purpose.
Sourcepub fn create_area(aria: SmallAriaInfo) -> Self
pub fn create_area(aria: SmallAriaInfo) -> Self
Creates an area element for image map regions with accessibility information.
Accessibility: Always provide alt text describing the region/link purpose.
Keyboard users should be able to navigate areas.
Use Dom::create_area_no_a11y only as a deliberate escape hatch.
Sourcepub fn create_title() -> Self
pub fn create_title() -> Self
Creates an empty title element for document title.
Accessibility: Required for all pages. Screen readers announce this first.
Sourcepub fn create_title_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_title_with_text<S: Into<AzString>>(text: S) -> Self
Creates a title element for document title with text.
Accessibility: Required for all pages. Screen readers announce this first. Should be unique and descriptive. Keep under 60 characters.
Sourcepub const fn create_meta() -> Self
pub const fn create_meta() -> Self
Creates a meta element.
Accessibility: Use for charset, viewport, description. Crucial for proper text display.
Sourcepub const fn create_link() -> Self
pub const fn create_link() -> Self
Creates a link element for external resources.
Accessibility: Use for stylesheets, icons, alternate versions.
Provide meaningful title attribute for alternate stylesheets.
Sourcepub const fn create_script() -> Self
pub const fn create_script() -> Self
Creates a script element.
Accessibility: Ensure scripted content is accessible. Provide noscript fallbacks for critical functionality.
Sourcepub const fn create_style() -> Self
pub const fn create_style() -> Self
Creates an empty style element for embedded CSS.
Note: In Azul, use .with_css() instead for styling.
This creates a <style> HTML element for embedded stylesheets.
Sourcepub fn create_style_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_style_with_text<S: Into<AzString>>(text: S) -> Self
Creates a style element for embedded CSS with the given stylesheet text.
Note: In Azul, use .with_css() instead for styling.
This creates a <style> HTML element for embedded stylesheets.
Sourcepub fn create_base(href: AzString) -> Self
pub fn create_base(href: AzString) -> Self
Creates a base element for document base URL.
Parameters:
href: Base URL for relative URLs in the document
Sourcepub fn create_th_with_scope(scope: AzString, text: AzString) -> Self
pub fn create_th_with_scope(scope: AzString, text: AzString) -> Self
Creates a table header cell with scope.
Parameters:
scope: “col”, “row”, “colgroup”, or “rowgroup”text: Header text
Accessibility: The scope attribute is crucial for associating headers with data cells.
Sourcepub fn create_td_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_td_with_text<S: Into<AzString>>(text: S) -> Self
Creates a table data cell with text.
Parameters:
text: Cell content
Sourcepub fn create_th_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_th_with_text<S: Into<AzString>>(text: S) -> Self
Creates a table header cell with text.
Parameters:
text: Header text
Sourcepub fn create_li_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_li_with_text<S: Into<AzString>>(text: S) -> Self
Creates a list item with text.
Parameters:
text: List item content
Sourcepub fn create_p_with_text<S: Into<AzString>>(text: S) -> Self
pub fn create_p_with_text<S: Into<AzString>>(text: S) -> Self
Creates a paragraph with text.
Parameters:
text: Paragraph content
Creates a button with text content and accessibility information.
Use Dom::create_button_no_a11y to skip the accessibility information.
Parameters:
text: The visible button textaria: Accessibility information (role, description, etc.)
Sourcepub fn create_a<S1: Into<AzString>, S2: Into<AzString>>(
href: S1,
text: S2,
aria: SmallAriaInfo,
) -> Self
pub fn create_a<S1: Into<AzString>, S2: Into<AzString>>( href: S1, text: S2, aria: SmallAriaInfo, ) -> Self
Creates a link (anchor) with href, text, and accessibility information.
Use Dom::create_a_no_a11y to skip the accessibility information (e.g. for
image-only links whose accessible name comes from an <img alt>).
Parameters:
href: The link destinationtext: The visible link textaria: Accessibility information (expanded description, etc.)
Sourcepub fn create_input<S1: Into<AzString>, S2: Into<AzString>, S3: Into<AzString>>(
input_type: S1,
name: S2,
label: S3,
aria: SmallAriaInfo,
) -> Self
pub fn create_input<S1: Into<AzString>, S2: Into<AzString>, S3: Into<AzString>>( input_type: S1, name: S2, label: S3, aria: SmallAriaInfo, ) -> Self
Creates an input element with type, name, and accessibility information.
Use Dom::create_input_no_a11y to skip the accessibility information.
Parameters:
input_type: The input type (text, password, email, etc.)name: The form field namelabel: Base accessibility labelaria: Additional accessibility information (description, etc.)
Sourcepub fn create_textarea<S1: Into<AzString>, S2: Into<AzString>>(
name: S1,
label: S2,
aria: SmallAriaInfo,
) -> Self
pub fn create_textarea<S1: Into<AzString>, S2: Into<AzString>>( name: S1, label: S2, aria: SmallAriaInfo, ) -> Self
Creates a textarea with name and accessibility information.
Use Dom::create_textarea_no_a11y to skip the accessibility information.
Parameters:
name: The form field namelabel: Base accessibility labelaria: Additional accessibility information (description, etc.)
Sourcepub fn create_select<S1: Into<AzString>, S2: Into<AzString>>(
name: S1,
label: S2,
aria: SmallAriaInfo,
) -> Self
pub fn create_select<S1: Into<AzString>, S2: Into<AzString>>( name: S1, label: S2, aria: SmallAriaInfo, ) -> Self
Creates a select dropdown with name and accessibility information.
Use Dom::create_select_no_a11y to skip the accessibility information.
Parameters:
name: The form field namelabel: Base accessibility labelaria: Additional accessibility information (description, etc.)
Sourcepub fn create_table<S: Into<AzString>>(caption: S, aria: SmallAriaInfo) -> Self
pub fn create_table<S: Into<AzString>>(caption: S, aria: SmallAriaInfo) -> Self
Creates a table with caption and accessibility information.
Use Dom::create_table_no_a11y to skip the caption and accessibility
information.
Parameters:
caption: Table caption (visible title)aria: Accessibility information describing table purpose
Sourcepub fn create_label<S1: Into<AzString>, S2: Into<AzString>>(
for_id: S1,
text: S2,
aria: SmallAriaInfo,
) -> Self
pub fn create_label<S1: Into<AzString>, S2: Into<AzString>>( for_id: S1, text: S2, aria: SmallAriaInfo, ) -> Self
Creates a label for a form control with additional accessibility information.
Use Dom::create_label_no_a11y to skip the accessibility information.
Parameters:
for_id: The ID of the associated form controltext: The visible label textaria: Additional accessibility information (description, etc.)
Sourcepub fn from_xml<S: AsRef<str>>(xml_str: S) -> Self
pub fn from_xml<S: AsRef<str>>(xml_str: S) -> Self
Parse XML/XHTML string into a DOM (fallback without xml feature)
pub const fn swap_with_default(&mut self) -> Self
Sourcepub fn recompute_estimated_total_children(&self) -> usize
pub fn recompute_estimated_total_children(&self) -> usize
AUDIT: recompute the authoritative descendant count (1 per descendant)
from children, without mutating anything. Used by the debug-only
consistency assertions in the builder methods so a stale
estimated_total_children (from direct children mutation) is caught in
tests before it can under-allocate the arena in
convert_dom_into_compact_dom.
pub fn add_child(&mut self, child: Self)
pub fn set_children(&mut self, children: DomVec)
pub fn copy_except_for_root(&mut self) -> Self
pub const fn node_count(&self) -> usize
Sourcepub fn add_component_css(&mut self, css: Css)
pub fn add_component_css(&mut self, css: Css)
Push a parsed Css onto this Dom subtree’s .css list (the
@scope-like mechanism that with_css(&str) also feeds — a string
parses to a Css and lands here). The cascade selector-matches every
entry against the subtree; later pushes win at equal specificity.
This is the low-level Css-struct entry point; prefer with_css(&str).
Sourcepub fn set_component_css(&mut self, css: CssVec)
pub fn set_component_css(&mut self, css: CssVec)
Replace the subtree’s entire component-level CSS list with the
provided one. Use add_component_css / with_component_css for
stacking; this is the wholesale-replace form.
pub fn with_children(self, children: DomVec) -> Self
pub fn with_child(self, child: Self) -> Self
pub fn with_node_type(self, node_type: NodeType) -> Self
pub fn with_id(self, id: AzString) -> Self
pub fn with_class(self, class: AzString) -> Self
pub fn with_callback<C: Into<CoreCallback>>( self, event: EventFilter, data: RefAny, callback: C, ) -> Self
Sourcepub fn with_css_property(self, prop: CssPropertyWithConditions) -> Self
pub fn with_css_property(self, prop: CssPropertyWithConditions) -> Self
Add a CSS property with optional conditions (hover, focus, active, etc.)
Sourcepub fn add_css_property(&mut self, prop: CssPropertyWithConditions)
pub fn add_css_property(&mut self, prop: CssPropertyWithConditions)
Add a CSS property with optional conditions (hover, focus, active, etc.)
pub fn add_class(&mut self, class: AzString)
pub fn add_callback<C: Into<CoreCallback>>( &mut self, event: EventFilter, data: RefAny, callback: C, )
pub const fn set_tab_index(&mut self, tab_index: TabIndex)
pub const fn set_contenteditable(&mut self, contenteditable: bool)
pub const fn with_tab_index(self, tab_index: TabIndex) -> Self
pub const fn with_contenteditable(self, contenteditable: bool) -> Self
pub fn with_dataset(self, data: OptionRefAny) -> Self
pub fn with_ids_and_classes(self, ids_and_classes: IdOrClassVec) -> Self
Sourcepub fn with_attribute(self, attr: AttributeType) -> Self
pub fn with_attribute(self, attr: AttributeType) -> Self
Adds an attribute to this DOM element.
Sourcepub fn with_attributes(self, attributes: AttributeTypeVec) -> Self
pub fn with_attributes(self, attributes: AttributeTypeVec) -> Self
Adds multiple attributes to this DOM element.
pub fn with_callbacks(self, callbacks: CoreCallbackDataVec) -> Self
Sourcepub fn with_css_props(self, css_props: CssPropertyWithConditionsVec) -> Self
pub fn with_css_props(self, css_props: CssPropertyWithConditionsVec) -> Self
Legacy: builder-form for the flat property+conditions list. Each entry
becomes a single-declaration rule at rule_priority::INLINE.
Sourcepub fn with_style(self, style: Css) -> Self
pub fn with_style(self, style: Css) -> Self
Builder-form for setting the inline Css directly.
Sourcepub fn with_key<K: Hash>(self, key: K) -> Self
pub fn with_key<K: Hash>(self, key: K) -> Self
Assigns a stable key to the root node of this DOM for reconciliation.
This is crucial for performance and correct state preservation when lists of items change order or items are inserted/removed.
§Example
Dom::create_div()
.with_key("user-avatar-123");Sourcepub fn with_merge_callback<C: Into<DatasetMergeCallback>>(
self,
callback: C,
) -> Self
pub fn with_merge_callback<C: Into<DatasetMergeCallback>>( self, callback: C, ) -> Self
Registers a callback to merge dataset state from the previous frame.
This is used for components that maintain heavy internal state (video players, WebGL contexts, network connections) that should not be destroyed and recreated on every render frame.
The callback receives both datasets as RefAny (cheap shallow clones) and
returns the RefAny that should be used for the new node.
Sourcepub fn set_css(&mut self, style: &str)
pub fn set_css(&mut self, style: &str)
Parse and set CSS styles with full selector support.
This is the unified API for setting inline CSS on a DOM node. It supports:
- Simple properties:
color: red; font-size: 14px; - Pseudo-selectors:
:hover { background: blue; } - @-rules:
@os linux { font-size: 14px; } - Nesting:
@os linux { font-size: 14px; :hover { color: red; }}
§Examples
// Simple inline styles
Dom::create_div().with_css("color: red; font-size: 14px;");
// With hover and active states
Dom::create_div().with_css("
color: blue;
:hover { color: red; }
:active { color: green; }
");
// OS-specific with nested hover
Dom::create_div().with_css("
font-size: 12px;
@os linux { font-size: 14px; :hover { color: red; }}
@os windows { font-size: 13px; }
");Sets the context menu for the root node
Sets the menu bar for the root node
pub fn with_clip_mask(self, clip_mask: ImageMask) -> Self
pub fn with_svg_clip_path(self, clip: SvgMultiPolygon) -> Self
pub fn with_svg_data(self, data: SvgNodeData) -> Self
pub fn with_accessibility_info( self, accessibility_info: AccessibilityInfo, ) -> Self
pub fn fixup_children_estimated(&mut self) -> usize
Trait Implementations§
Source§impl Default for Dom
An empty <body> DOM. Used as the safe fallback return value when a layout
callback cannot produce a DOM (e.g. a foreign-language binding’s trampoline
raised, or an app-data downcast failed). StyledDom is the post-cascade
CSSOM; layout callbacks return an un-cascaded Dom, so an empty body is the
natural “nothing to show” default.
impl Default for Dom
An empty <body> DOM. Used as the safe fallback return value when a layout
callback cannot produce a DOM (e.g. a foreign-language binding’s trampoline
raised, or an app-data downcast failed). StyledDom is the post-cascade
CSSOM; layout callbacks return an un-cascaded Dom, so an empty body is the
natural “nothing to show” default.
impl Eq for Dom
Source§impl Extend<Dom> for DomVec
impl Extend<Dom> for DomVec
Source§fn extend<T: IntoIterator<Item = Dom>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Dom>>(&mut self, iter: T)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)