Skip to main content

Dom

Struct Dom 

Source
#[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: NodeData

The data for the root node of this DOM (or sub-DOM).

§children: DomVec

The children of this DOM node.

§css: CssVec

Ordered 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: usize

Implementations§

Source§

impl Dom

Source

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.

Source

pub fn create_from_data(node_data: NodeData) -> Self

Source

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.

Source

pub const fn create_head() -> Self

Creates the document head element.

Accessibility: The <head> contains metadata. Use <title> for page titles.

Source

pub const fn create_body() -> Self

Source

pub const fn create_div() -> Self

Creates a generic block-level container.

Accessibility: Prefer semantic elements like <article>, <section>, <nav> when applicable.

Source

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.

Source

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.

Source

pub const fn create_nav() -> Self

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”).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub const fn create_br() -> Self

Source

pub fn create_text<S: Into<AzString>>(value: S) -> Self

Source

pub fn create_image(image: ImageRef) -> Self

Source

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")
Source

pub fn create_virtual_view( data: RefAny, callback: impl Into<VirtualViewCallback>, ) -> Self

Source

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.

Source

pub const fn create_p() -> Self

Creates a paragraph element.

Accessibility: Paragraphs provide semantic structure for screen readers.

Source

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.

Source

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
Source

pub const fn create_h2() -> Self

Creates an empty heading level 2 element.

Accessibility: Use h2 for major section headings under h1.

Source

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
Source

pub const fn create_h3() -> Self

Creates an empty heading level 3 element.

Accessibility: Use h3 for subsections under h2.

Source

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
Source

pub const fn create_h4() -> Self

Creates an empty heading level 4 element.

Source

pub fn create_h4_with_text<S: Into<AzString>>(text: S) -> Self

Creates a heading level 4 element with text.

Parameters:

  • text: Heading text
Source

pub const fn create_h5() -> Self

Creates an empty heading level 5 element.

Source

pub fn create_h5_with_text<S: Into<AzString>>(text: S) -> Self

Creates a heading level 5 element with text.

Parameters:

  • text: Heading text
Source

pub const fn create_h6() -> Self

Creates an empty heading level 6 element.

Source

pub fn create_h6_with_text<S: Into<AzString>>(text: S) -> Self

Creates a heading level 6 element with text.

Parameters:

  • text: Heading text
Source

pub const fn create_span() -> Self

Creates an empty generic inline container (span).

Accessibility: Prefer semantic elements like strong, em, code, etc. when applicable.

Source

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
Source

pub const fn create_strong() -> Self

Creates an empty strong importance element.

Accessibility: Use strong instead of b for semantic meaning.

Source

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
Source

pub const fn create_em() -> Self

Creates an empty emphasis element (stress emphasis).

Accessibility: Use em instead of i for semantic meaning.

Source

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
Source

pub fn create_code() -> Self

Creates an empty code element.

Accessibility: Represents a fragment of computer code.

Source

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
Source

pub fn create_pre() -> Self

Creates an empty preformatted text element.

Accessibility: Preserves whitespace and line breaks.

Source

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
Source

pub fn create_blockquote() -> Self

Creates an empty blockquote element.

Accessibility: Represents a section quoted from another source.

Source

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
Source

pub fn create_cite() -> Self

Creates an empty citation element.

Accessibility: Represents a reference to a creative work.

Source

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
Source

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.

Source

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 text
  • title: Full expansion
Source

pub fn create_kbd() -> Self

Creates an empty keyboard input element.

Accessibility: Represents keyboard input or key combinations.

Source

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
Source

pub fn create_samp() -> Self

Creates an empty sample output element.

Accessibility: Represents sample output from a program or computing system.

Source

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
Source

pub fn create_var() -> Self

Creates an empty variable element.

Accessibility: Represents a variable in mathematical expressions or programming.

Source

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
Source

pub fn create_sub() -> Self

Creates an empty subscript element.

Source

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
Source

pub fn create_sup() -> Self

Creates an empty superscript element.

Source

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
Source

pub fn create_u() -> Self

Creates an empty underline element.

Source

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).

Source

pub fn create_s() -> Self

Creates an empty strikethrough element.

Source

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.

Source

pub fn create_mark() -> Self

Creates an empty mark element.

Source

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”.

Source

pub fn create_del() -> Self

Creates an empty deleted text element.

Source

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.

Source

pub fn create_ins() -> Self

Creates an empty inserted text element.

Source

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.

Source

pub fn create_dfn() -> Self

Creates an empty definition element.

Source

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>.

Source

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/date
  • datetime: Optional machine-readable datetime
Source

pub fn create_bdo() -> Self

Creates an empty bi-directional override element.

Accessibility: Overrides text direction. Use dir attribute (ltr/rtl).

Source

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).

Source

pub fn create_b() -> Self

Creates an empty bold element.

Accessibility: Prefer <strong> for semantic emphasis. <b> is purely stylistic.

Source

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
Source

pub fn create_i() -> Self

Creates an empty italic element.

Accessibility: Prefer <em> for stress emphasis. <i> is purely stylistic.

Source

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
Source

pub fn create_small() -> Self

Creates an empty small text element.

Accessibility: Represents side-comments and small print like copyright/legal text.

Source

pub fn create_small_with_text<S: Into<AzString>>(text: S) -> Self

Creates a small text element with text.

Parameters:

  • text: Small text content
Source

pub fn create_big() -> Self

Creates an empty <big> element.

Note: Deprecated in HTML5. Prefer CSS font-size.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn create_rt() -> Self

Creates an empty ruby text element.

Accessibility: Pronunciation/translation annotation inside <ruby>.

Source

pub fn create_rt_with_text<S: Into<AzString>>(text: S) -> Self

Creates a ruby text element with text.

Parameters:

  • text: Ruby annotation content
Source

pub fn create_rtc() -> Self

Creates an empty ruby text container element.

Accessibility: Container for ruby text annotations.

Source

pub fn create_rp() -> Self

Creates an empty ruby fallback parenthesis element.

Accessibility: Provides parentheses around <rt> for browsers without ruby support.

Source

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 “)”)
Source

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 the value attribute.
Source

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 the value attribute.
  • text: Human-readable text content.
Source

pub fn create_dir() -> Self

Creates an empty directory list element.

Note: Deprecated in HTML5. Use <ul> instead.

Source

pub fn create_svg() -> Self

Creates an empty SVG container element.

Accessibility: Provide aria-label or <title> child for assistive tech.

Source

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 URL
  • label: Link text (pass None for image-only links with alt text)
Source

pub fn create_button_no_a11y(text: AzString) -> Self

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
Source

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 control
  • text: Label text
Source

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 name
  • label: Accessibility label (required)
Source

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 name
  • label: Accessibility label (required)
Source

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 name
  • label: Accessibility label (required)
Source

pub fn create_option_no_a11y(value: AzString, text: AzString) -> Self

Creates an option element for select dropdowns.

Parameters:

  • value: Option value
  • text: Display text
Source

pub fn create_option( value: AzString, text: AzString, aria: SmallAriaInfo, ) -> Self

Creates an option element for select dropdowns with accessibility information.

Parameters:

  • value: Option value
  • text: Display text
  • aria: Accessibility information (description, etc.)

Use Dom::create_option_no_a11y only as a deliberate escape hatch.

Source

pub fn create_ul() -> Self

Creates an unordered list element.

Accessibility: Screen readers announce lists and item counts, helping users understand content structure.

Source

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.

Source

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”).

Source

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.

Source

pub fn create_caption() -> Self

Creates a table caption element.

Accessibility: Describes the purpose of the table. Screen readers announce this first.

Source

pub fn create_thead() -> Self

Creates a table header element.

Accessibility: Groups header rows. Screen readers can navigate table structure.

Source

pub fn create_tbody() -> Self

Creates a table body element.

Accessibility: Groups body rows. Screen readers can navigate table structure.

Source

pub fn create_tfoot() -> Self

Creates a table footer element.

Accessibility: Groups footer rows. Screen readers can navigate table structure.

Source

pub fn create_tr() -> Self

Creates a table row element.

Source

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.

Source

pub fn create_td() -> Self

Creates a table data cell element.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub const fn create_address() -> Self

Creates an address element.

Accessibility: Represents contact information. Screen readers identify this as address content.

Source

pub const fn create_dl() -> Self

Creates a definition list element.

Accessibility: Screen readers announce definition lists and their structure.

Source

pub const fn create_dt() -> Self

Creates a definition term element.

Accessibility: Must be a child of dl. Represents the term being defined.

Source

pub const fn create_dd() -> Self

Creates a definition description element.

Accessibility: Must be a child of dl. Provides the definition for the term.

Source

pub const fn create_colgroup() -> Self

Creates a table column group element.

Source

pub fn create_col(span: i32) -> Self

Creates a table column element.

Source

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
Source

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.

Source

pub const fn create_q() -> Self

Creates a quotation element.

Accessibility: Represents an inline quotation.

Source

pub const fn create_acronym() -> Self

Creates an empty acronym element.

Note: Deprecated in HTML5. Consider using create_abbr() instead.

Source

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.

Source

pub const fn create_menu_no_a11y() -> Self

Creates a menu element without accessibility information.

Prefer Dom::create_menu so that the menu’s purpose is announced.

Source

pub fn create_menu(aria: SmallAriaInfo) -> Self

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.

Source

pub const fn create_menuitem_no_a11y() -> Self

Creates an empty menu item element without accessibility information.

Prefer Dom::create_menuitem so that the menu item’s purpose is announced.

Source

pub fn create_menuitem(aria: SmallAriaInfo) -> Self

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.

Source

pub fn create_menuitem_with_text_no_a11y<S: Into<AzString>>(text: S) -> Self

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.

Source

pub fn create_menuitem_with_text<S: Into<AzString>>( text: S, aria: SmallAriaInfo, ) -> Self

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.

Source

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.

Source

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.

Source

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 value
  • max: Maximum value
Source

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.

Source

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 value
  • min: Minimum value
  • max: Maximum value
Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn create_param(name: AzString, value: AzString) -> Self

Creates a param element for object parameters.

Parameters:

  • name: Parameter name
  • value: Parameter value
Source

pub const fn create_embed() -> Self

Creates an embed element.

Accessibility: Provide alternative content or link. Use aria-label to describe embedded content.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn create_source(src: AzString, media_type: AzString) -> Self

Creates a source element for media.

Parameters:

  • src: Media source URL
  • media_type: MIME type (e.g., “video/mp4”, “audio/ogg”)
Source

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 (WebVTT format)
  • kind: Track kind (“subtitles”, “captions”, “descriptions”, “chapters”, “metadata”)
Source

pub const fn create_map() -> Self

Creates a map element for image maps.

Accessibility: Provide text alternatives. Ensure all areas have alt text.

Source

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.

Source

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.

Source

pub fn create_title() -> Self

Creates an empty title element for document title.

Accessibility: Required for all pages. Screen readers announce this first.

Source

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.

Source

pub const fn create_meta() -> Self

Creates a meta element.

Accessibility: Use for charset, viewport, description. Crucial for proper text display.

Creates a link element for external resources.

Accessibility: Use for stylesheets, icons, alternate versions. Provide meaningful title attribute for alternate stylesheets.

Source

pub const fn create_script() -> Self

Creates a script element.

Accessibility: Ensure scripted content is accessible. Provide noscript fallbacks for critical functionality.

Source

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.

Source

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.

Source

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
Source

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.

Source

pub fn create_td_with_text<S: Into<AzString>>(text: S) -> Self

Creates a table data cell with text.

Parameters:

  • text: Cell content
Source

pub fn create_th_with_text<S: Into<AzString>>(text: S) -> Self

Creates a table header cell with text.

Parameters:

  • text: Header text
Source

pub fn create_li_with_text<S: Into<AzString>>(text: S) -> Self

Creates a list item with text.

Parameters:

  • text: List item content
Source

pub fn create_p_with_text<S: Into<AzString>>(text: S) -> Self

Creates a paragraph with text.

Parameters:

  • text: Paragraph content
Source

pub fn create_button<S: Into<AzString>>(text: S, aria: SmallAriaInfo) -> Self

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 text
  • aria: Accessibility information (role, description, etc.)
Source

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 destination
  • text: The visible link text
  • aria: Accessibility information (expanded description, etc.)
Source

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 name
  • label: Base accessibility label
  • aria: Additional accessibility information (description, etc.)
Source

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 name
  • label: Base accessibility label
  • aria: Additional accessibility information (description, etc.)
Source

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 name
  • label: Base accessibility label
  • aria: Additional accessibility information (description, etc.)
Source

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
Source

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 control
  • text: The visible label text
  • aria: Additional accessibility information (description, etc.)
Source

pub fn from_xml<S: AsRef<str>>(xml_str: S) -> Self

Parse XML/XHTML string into a DOM (fallback without xml feature)

Source

pub const fn swap_with_default(&mut self) -> Self

Source

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.

Source

pub fn add_child(&mut self, child: Self)

Source

pub fn set_children(&mut self, children: DomVec)

Source

pub fn copy_except_for_root(&mut self) -> Self

Source

pub const fn node_count(&self) -> usize

Source

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).

Source

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.

Source

pub fn with_children(self, children: DomVec) -> Self

Source

pub fn with_child(self, child: Self) -> Self

Source

pub fn with_node_type(self, node_type: NodeType) -> Self

Source

pub fn with_id(self, id: AzString) -> Self

Source

pub fn with_class(self, class: AzString) -> Self

Source

pub fn with_callback<C: Into<CoreCallback>>( self, event: EventFilter, data: RefAny, callback: C, ) -> Self

Source

pub fn with_css_property(self, prop: CssPropertyWithConditions) -> Self

Add a CSS property with optional conditions (hover, focus, active, etc.)

Source

pub fn add_css_property(&mut self, prop: CssPropertyWithConditions)

Add a CSS property with optional conditions (hover, focus, active, etc.)

Source

pub fn add_class(&mut self, class: AzString)

Source

pub fn add_callback<C: Into<CoreCallback>>( &mut self, event: EventFilter, data: RefAny, callback: C, )

Source

pub const fn set_tab_index(&mut self, tab_index: TabIndex)

Source

pub const fn set_contenteditable(&mut self, contenteditable: bool)

Source

pub const fn with_tab_index(self, tab_index: TabIndex) -> Self

Source

pub const fn with_contenteditable(self, contenteditable: bool) -> Self

Source

pub fn with_dataset(self, data: OptionRefAny) -> Self

Source

pub fn with_ids_and_classes(self, ids_and_classes: IdOrClassVec) -> Self

Source

pub fn with_attribute(self, attr: AttributeType) -> Self

Adds an attribute to this DOM element.

Source

pub fn with_attributes(self, attributes: AttributeTypeVec) -> Self

Adds multiple attributes to this DOM element.

Source

pub fn with_callbacks(self, callbacks: CoreCallbackDataVec) -> Self

Source

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.

Source

pub fn with_style(self, style: Css) -> Self

Builder-form for setting the inline Css directly.

Source

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");
Source

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.

Source

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; }
");
Source

pub fn with_css(self, style: &str) -> Self

Builder method for set_css

Source

pub fn set_context_menu(&mut self, context_menu: Menu)

Sets the context menu for the root node

Source

pub fn with_context_menu(self, context_menu: Menu) -> Self

Source

pub fn set_menu_bar(&mut self, menu_bar: Menu)

Sets the menu bar for the root node

Source

pub fn with_menu_bar(self, menu_bar: Menu) -> Self

Source

pub fn with_clip_mask(self, clip_mask: ImageMask) -> Self

Source

pub fn with_svg_clip_path(self, clip: SvgMultiPolygon) -> Self

Source

pub fn with_svg_data(self, data: SvgNodeData) -> Self

Source

pub fn with_accessibility_info( self, accessibility_info: AccessibilityInfo, ) -> Self

Source

pub fn fixup_children_estimated(&mut self) -> usize

Trait Implementations§

Source§

impl Clone for Dom

Source§

fn clone(&self) -> Dom

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Dom

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
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.

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for Dom

Source§

impl Extend<Dom> for DomVec

Source§

fn extend<T: IntoIterator<Item = Dom>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl From<Dom> for CompactDom

Source§

fn from(dom: Dom) -> Self

Converts to this type from the input type.
Source§

impl FromIterator<Dom> for DomVec

Source§

fn from_iter<T>(iter: T) -> Self
where T: IntoIterator<Item = Dom>,

Creates a value from an iterator. Read more
Source§

impl FromIterator<Dom> for Dom

Source§

fn from_iter<I: IntoIterator<Item = Self>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl Hash for Dom

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Dom

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Dom

Source§

fn eq(&self, other: &Dom) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for Dom

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for Dom

Auto Trait Implementations§

§

impl Freeze for Dom

§

impl RefUnwindSafe for Dom

§

impl Send for Dom

§

impl Sync for Dom

§

impl Unpin for Dom

§

impl UnsafeUnpin for Dom

§

impl UnwindSafe for Dom

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> GetHash for T
where T: Hash,

Source§

fn get_hash(&self) -> u64

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.