#[repr(C)]pub struct Node {
eventtarget: EventTarget,
parent_node: MutNullableDom<Node>,
first_child: MutNullableDom<Node>,
last_child: MutNullableDom<Node>,
next_sibling: MutNullableDom<Node>,
prev_sibling: MutNullableDom<Node>,
owner_doc: MutNullableDom<Document>,
rare_data: DomRefCell<Option<Box<NodeRareData>>>,
children_count: Cell<u32>,
flags: Cell<NodeFlags>,
inclusive_descendants_version: Cell<u64>,
layout_data: DomRefCell<Option<Box<GenericLayoutData>>>,
}Expand description
An HTML node.
Fields§
§eventtarget: EventTargetThe JavaScript reflector for this node.
parent_node: MutNullableDom<Node>The parent of this node.
first_child: MutNullableDom<Node>The first child of this node.
last_child: MutNullableDom<Node>The last child of this node.
next_sibling: MutNullableDom<Node>The next sibling of this node.
prev_sibling: MutNullableDom<Node>The previous sibling of this node.
owner_doc: MutNullableDom<Document>The document that this node belongs to.
rare_data: DomRefCell<Option<Box<NodeRareData>>>Rare node data.
children_count: Cell<u32>The live count of children of this node.
flags: Cell<NodeFlags>A bitfield of flags for node items.
inclusive_descendants_version: Cell<u64>The maximum version of any inclusive descendant of this node.
layout_data: DomRefCell<Option<Box<GenericLayoutData>>>Layout data for this node. This is populated during layout and can be used for incremental relayout and script queries.
Implementations§
Source§impl Node
impl Node
Sourcepub(crate) fn push_down_values(
&self,
cx: &mut JSContext,
command: &CommandName,
new_value: Option<DOMString>,
)
pub(crate) fn push_down_values( &self, cx: &mut JSContext, command: &CommandName, new_value: Option<DOMString>, )
Sourcefn reorder_modifiable_descendants(
&self,
cx: &mut JSContext,
command: &CommandName,
new_value: &DOMString,
)
fn reorder_modifiable_descendants( &self, cx: &mut JSContext, command: &CommandName, new_value: &DOMString, )
Sourcepub(crate) fn force_the_value(
&self,
cx: &mut JSContext,
command: &CommandName,
new_value: Option<&DOMString>,
)
pub(crate) fn force_the_value( &self, cx: &mut JSContext, command: &CommandName, new_value: Option<&DOMString>, )
Sourcepub(crate) fn same_editing_host(&self, other: &Node) -> bool
pub(crate) fn same_editing_host(&self, other: &Node) -> bool
Sourcepub(crate) fn is_block_node(&self) -> bool
pub(crate) fn is_block_node(&self) -> bool
Sourcepub(crate) fn is_inline_node(&self) -> bool
pub(crate) fn is_inline_node(&self) -> bool
Sourcepub(crate) fn block_node_of(&self) -> Option<DomRoot<Node>>
pub(crate) fn block_node_of(&self) -> Option<DomRoot<Node>>
Sourcepub(crate) fn is_visible(&self) -> bool
pub(crate) fn is_visible(&self) -> bool
Sourcepub(crate) fn is_invisible(&self) -> bool
pub(crate) fn is_invisible(&self) -> bool
Sourcepub(crate) fn is_formattable(&self) -> bool
pub(crate) fn is_formattable(&self) -> bool
Sourcefn is_block_start_point(&self, offset: usize) -> bool
fn is_block_start_point(&self, offset: usize) -> bool
Sourcefn is_block_end_point(&self, offset: u32) -> bool
fn is_block_end_point(&self, offset: u32) -> bool
Sourcefn is_block_boundary_point(&self, offset: u32) -> bool
fn is_block_boundary_point(&self, offset: u32) -> bool
Sourcepub(crate) fn is_collapsed_block_prop(&self) -> bool
pub(crate) fn is_collapsed_block_prop(&self) -> bool
Sourcefn follows_a_line_break(&self) -> bool
fn follows_a_line_break(&self) -> bool
Sourcefn precedes_a_line_break(&self) -> bool
fn precedes_a_line_break(&self) -> bool
Sourcefn canonical_space_sequence(
n: usize,
non_breaking_start: bool,
non_breaking_end: bool,
) -> String
fn canonical_space_sequence( n: usize, non_breaking_start: bool, non_breaking_end: bool, ) -> String
Sourcepub(crate) fn canonicalize_whitespace(
&self,
offset: u32,
fix_collapsed_space: bool,
)
pub(crate) fn canonicalize_whitespace( &self, offset: u32, fix_collapsed_space: bool, )
Sourcefn remove_extraneous_line_breaks_before(&self, cx: &mut JSContext)
fn remove_extraneous_line_breaks_before(&self, cx: &mut JSContext)
Sourcepub(crate) fn remove_extraneous_line_breaks_at_the_end_of(
&self,
cx: &mut JSContext,
)
pub(crate) fn remove_extraneous_line_breaks_at_the_end_of( &self, cx: &mut JSContext, )
Sourcefn remove_extraneous_line_breaks_from(&self, cx: &mut JSContext)
fn remove_extraneous_line_breaks_from(&self, cx: &mut JSContext)
Sourcepub(crate) fn remove_preserving_its_descendants(&self, cx: &mut JSContext)
pub(crate) fn remove_preserving_its_descendants(&self, cx: &mut JSContext)
Sourcepub(crate) fn effective_command_value(
&self,
command: &CommandName,
) -> Option<DOMString>
pub(crate) fn effective_command_value( &self, command: &CommandName, ) -> Option<DOMString>
Source§impl Node
impl Node
Sourcepub(crate) fn find_click_focusable_area(&self) -> FocusableArea
pub(crate) fn find_click_focusable_area(&self) -> FocusableArea
Returns the appropriate FocusableArea when this Node is clicked on according to
https://www.w3.org/TR/pointerevents4/#handle-native-mouse-down.
Note that this is doing more than the specification which says to only take into account
the node from the hit test. This isn’t exactly how browsers work though, as they seem
to look for the first inclusive ancestor node that has a focusable area associated with it.
Note also that this may return FocusableArea::Viewport.
Sourcepub(crate) fn get_the_focusable_area(&self) -> Option<FocusableArea>
pub(crate) fn get_the_focusable_area(&self) -> Option<FocusableArea>
https://html.spec.whatwg.org/multipage/#get-the-focusable-area
There seems to be hole in the specification here. It describes how to get the focusable area for a focus target that isn’t a focuable area, but is ambiguous about how to do this for a focus target that actually is a focusable area. The obvious thing is to just return the focus target, but it’s still odd that this isn’t mentioned in the specification.
Sourcefn get_the_focusable_area_if_not_a_focusable_area(
&self,
) -> Option<FocusableArea>
fn get_the_focusable_area_if_not_a_focusable_area( &self, ) -> Option<FocusableArea>
https://html.spec.whatwg.org/multipage/#get-the-focusable-area
In addition to returning the DOM anchor of the focusable area for this Node, this
method also returns the FocusableAreaKind for efficiency reasons. Note that None
is returned if this Node does not have a focusable area or if its focusable area
is the Document’s viewport.
TODO: It might be better to distinguish these two cases in the future.
Sourcefn focus_delegate(&self) -> Option<FocusableArea>
fn focus_delegate(&self) -> Option<FocusableArea>
https://html.spec.whatwg.org/multipage/#focus-delegate
In addition to returning the focus delegate for this Node, this method also returns
the FocusableAreaKind for efficiency reasons.
Sourcepub(crate) fn run_the_focusing_steps(
&self,
cx: &mut JSContext,
fallback_target: Option<FocusableArea>,
) -> bool
pub(crate) fn run_the_focusing_steps( &self, cx: &mut JSContext, fallback_target: Option<FocusableArea>, ) -> bool
https://html.spec.whatwg.org/multipage/#focusing-steps
This is an initial implementation of the “focusing steps” from the HTML specification. Note that this is currently in a state of transition from Servo’s old internal focus APIs to ones that match the specification. That is why the arguments to this method do not match the specification yet.
Return true if anything was focused or false otherwise.
If this node is a focus navigation scope owner, return the corresponding
FocusNavigationScopeOwner that describes it or None if this node is not
a focus navigation scope owner.
https://html.spec.whatwg.org/multipage/#focus-navigation-scope-owner
Find the focus navigation scope owner for this node. If this node is itself a focus navigation scope owner, this will return its containing focus navigation scope owner.
This will return None if this node is the Document element.
https://html.spec.whatwg.org/multipage/#focus-navigation-scope-owner
Source§impl Node
impl Node
Sourcefn add_child(&self, cx: &mut JSContext, new_child: &Node, before: Option<&Node>)
fn add_child(&self, cx: &mut JSContext, new_child: &Node, before: Option<&Node>)
Adds a new child to the end of this node’s list of children.
Fails unless new_child is disconnected from the tree.
Sourcepub(crate) fn unsafely_set_html(
target: &Node,
context_element: &Element,
html: DOMString,
cx: &mut JSContext,
)
pub(crate) fn unsafely_set_html( target: &Node, context_element: &Element, html: DOMString, cx: &mut JSContext, )
Implements the “unsafely set HTML” algorithm as specified in: https://html.spec.whatwg.org/multipage/#concept-unsafely-set-html
Sourcepub(crate) fn remove_style_and_layout_data_from_subtree(&self, no_gc: &NoGC)
pub(crate) fn remove_style_and_layout_data_from_subtree(&self, no_gc: &NoGC)
fn clean_up_style_and_layout_data(&self)
Sourcepub(crate) fn complete_remove_subtree(
cx: &mut JSContext,
root: &Node,
context: &UnbindContext<'_>,
)
pub(crate) fn complete_remove_subtree( cx: &mut JSContext, root: &Node, context: &UnbindContext<'_>, )
Clean up flags and runs steps 11-14 of remove a node. https://dom.spec.whatwg.org/#concept-node-remove
pub(crate) fn complete_move_subtree(root: &Node)
Sourcefn remove_child(
&self,
cx: &mut JSContext,
child: &Node,
cached_index: Option<u32>,
)
fn remove_child( &self, cx: &mut JSContext, child: &Node, cached_index: Option<u32>, )
Removes the given child from this node’s list of children.
Fails unless child is a child of this node.
fn move_child(&self, child: &Node)
pub(crate) fn to_untrusted_node_address(&self) -> UntrustedNodeAddress
pub(crate) fn to_opaque(&self) -> OpaqueNode
pub(crate) fn as_custom_element(&self) -> Option<DomRoot<Element>>
Sourcepub(crate) fn fire_synthetic_pointer_event_not_trusted(
&self,
cx: &mut JSContext,
event_type: Atom,
)
pub(crate) fn fire_synthetic_pointer_event_not_trusted( &self, cx: &mut JSContext, event_type: Atom, )
pub(crate) fn parent_directionality(&self) -> String
Sourcepub(crate) fn is_being_rendered_or_delegates_rendering(
&self,
pseudo_element: Option<PseudoElement>,
) -> bool
pub(crate) fn is_being_rendered_or_delegates_rendering( &self, pseudo_element: Option<PseudoElement>, ) -> bool
Sourcepub(crate) fn is_being_rendered(
&self,
pseudo_element: Option<PseudoElement>,
) -> bool
pub(crate) fn is_being_rendered( &self, pseudo_element: Option<PseudoElement>, ) -> bool
Source§impl Node
impl Node
fn rare_data(&self) -> Ref<'_, Option<Box<NodeRareData>>>
fn ensure_rare_data(&self) -> RefMut<'_, Box<NodeRareData>>
Sourcepub(crate) fn is_before(&self, other: &Node) -> bool
pub(crate) fn is_before(&self, other: &Node) -> bool
Returns true if this node is before other in the same connected DOM
tree.
Sourcepub(crate) fn registered_mutation_observers_mut(
&self,
) -> RefMut<'_, Vec<RegisteredObserver>>
pub(crate) fn registered_mutation_observers_mut( &self, ) -> RefMut<'_, Vec<RegisteredObserver>>
Return all registered mutation observers for this node. Lazily initialize the raredata if it does not exist.
pub(crate) fn registered_mutation_observers( &self, ) -> Option<Ref<'_, Vec<RegisteredObserver>>>
Sourcepub(crate) fn add_mutation_observer(&self, observer: RegisteredObserver)
pub(crate) fn add_mutation_observer(&self, observer: RegisteredObserver)
Add a new mutation observer for a given node.
Sourcepub(crate) fn remove_mutation_observer(&self, observer: &MutationObserver)
pub(crate) fn remove_mutation_observer(&self, observer: &MutationObserver)
Removes the mutation observer for a given node.
Sourcepub(crate) fn dump_indent(&self, indent: u32)
pub(crate) fn dump_indent(&self, indent: u32)
Dumps the node tree, for debugging, with indentation.
Sourcepub(crate) fn is_in_a_document_tree(&self) -> bool
pub(crate) fn is_in_a_document_tree(&self) -> bool
Sourcepub(crate) fn is_in_a_shadow_tree(&self) -> bool
pub(crate) fn is_in_a_shadow_tree(&self) -> bool
Return true iff node’s root is a shadow-root.
pub(crate) fn has_weird_parser_insertion_mode(&self) -> bool
pub(crate) fn set_weird_parser_insertion_mode(&self)
Sourcepub(crate) fn is_connected(&self) -> bool
pub(crate) fn is_connected(&self) -> bool
pub(crate) fn set_in_ua_widget(&self, in_ua_widget: bool)
pub(crate) fn is_in_ua_widget(&self) -> bool
Sourcepub(crate) fn type_id(&self) -> NodeTypeId
pub(crate) fn type_id(&self) -> NodeTypeId
Returns the type ID of this node.
pub(crate) fn is_empty(&self) -> bool
Sourcepub(crate) fn has_parent(&self) -> bool
pub(crate) fn has_parent(&self) -> bool
Returns true if this node has a parent.
pub(crate) fn children_count(&self) -> u32
pub(crate) fn ranges(&self) -> RefMut<'_, WeakRangeVec>
pub(crate) fn ranges_is_empty(&self) -> bool
pub(crate) fn is_doctype(&self) -> bool
pub(crate) fn get_flag(&self, flag: NodeFlags) -> bool
pub(crate) fn set_flag(&self, flag: NodeFlags, value: bool)
pub(crate) fn note_dirty_descendants(&self)
pub(crate) fn has_dirty_descendants(&self) -> bool
pub(crate) fn rev_version(&self)
pub(crate) fn dirty(&self, damage: NodeDamage)
Sourcepub(crate) fn inclusive_descendants_version(&self) -> u64
pub(crate) fn inclusive_descendants_version(&self) -> u64
The maximum version number of this node’s descendants, including itself
Sourcepub(crate) fn traverse_preorder(
&self,
shadow_including: ShadowIncluding,
) -> TreeIterator ⓘ
pub(crate) fn traverse_preorder( &self, shadow_including: ShadowIncluding, ) -> TreeIterator ⓘ
Iterates over this node and all its descendants, in preorder.
Sourcepub(crate) fn traverse_preorder_non_rooting<'a, 'b>(
&'a self,
no_gc: &'b NoGC,
shadow_including: ShadowIncluding,
) -> UnrootedTreeIterator<'a, 'b> ⓘwhere
'b: 'a,
pub(crate) fn traverse_preorder_non_rooting<'a, 'b>(
&'a self,
no_gc: &'b NoGC,
shadow_including: ShadowIncluding,
) -> UnrootedTreeIterator<'a, 'b> ⓘwhere
'b: 'a,
Iterates over this node and all its descendants, in preorder. We take &NoGC to prevent GC which allows us to avoid rooting.
pub(crate) fn inclusively_following_siblings( &self, ) -> impl Iterator<Item = DomRoot<Node>> + use<>
pub(crate) fn inclusively_following_siblings_unrooted<'b>( &self, no_gc: &'b NoGC, ) -> impl Iterator<Item = UnrootedDom<'b, Node>> + use<'b>
pub(crate) fn inclusively_preceding_siblings( &self, ) -> impl Iterator<Item = DomRoot<Node>> + use<>
pub(crate) fn inclusively_preceding_siblings_unrooted<'b>( &self, no_gc: &'b NoGC, ) -> impl Iterator<Item = UnrootedDom<'b, Node>> + use<'b>
pub(crate) fn common_ancestor( &self, other: &Node, shadow_including: ShadowIncluding, ) -> Option<DomRoot<Node>>
pub(crate) fn common_ancestor_in_flat_tree( &self, other: &Node, ) -> Option<DomRoot<Node>>
Sourcepub(crate) fn is_inclusive_ancestor_of(&self, child: &Node) -> bool
pub(crate) fn is_inclusive_ancestor_of(&self, child: &Node) -> bool
Sourcepub(crate) fn is_ancestor_of(&self, possible_descendant: &Node) -> bool
pub(crate) fn is_ancestor_of(&self, possible_descendant: &Node) -> bool
Sourcefn is_host_including_inclusive_ancestor(&self, child: &Node) -> bool
fn is_host_including_inclusive_ancestor(&self, child: &Node) -> bool
Sourcepub(crate) fn is_shadow_including_inclusive_ancestor_of(
&self,
node: &Node,
) -> bool
pub(crate) fn is_shadow_including_inclusive_ancestor_of( &self, node: &Node, ) -> bool
pub(crate) fn following_siblings( &self, ) -> impl Iterator<Item = DomRoot<Node>> + use<>
pub(crate) fn preceding_siblings( &self, ) -> impl Iterator<Item = DomRoot<Node>> + use<>
pub(crate) fn following_nodes(&self, root: &Node) -> FollowingNodeIterator ⓘ
pub(crate) fn preceding_nodes(&self, root: &Node) -> PrecedingNodeIterator ⓘ
Sourcepub(crate) fn descending_last_children(
&self,
) -> impl Iterator<Item = DomRoot<Node>> + use<>
pub(crate) fn descending_last_children( &self, ) -> impl Iterator<Item = DomRoot<Node>> + use<>
Return an iterator that moves from self down the tree, choosing the last child
at each step of the way.
pub(crate) fn is_parent_of(&self, child: &Node) -> bool
pub(crate) fn to_trusted_node_address(&self) -> TrustedNodeAddress
Sourcepub(crate) fn containing_block_node_without_reflow(
&self,
) -> Option<DomRoot<Node>>
pub(crate) fn containing_block_node_without_reflow( &self, ) -> Option<DomRoot<Node>>
Return the node that establishes a containing block for this node.
pub(crate) fn padding(&self) -> Option<PhysicalSides>
pub(crate) fn content_box(&self) -> Option<Rect<Au, CSSPixel>>
pub(crate) fn border_box(&self) -> Option<Rect<Au, CSSPixel>>
pub(crate) fn border_box_without_reflow(&self) -> Option<Rect<Au, CSSPixel>>
pub(crate) fn padding_box(&self) -> Option<Rect<Au, CSSPixel>>
pub(crate) fn padding_box_without_reflow(&self) -> Option<Rect<Au, CSSPixel>>
pub(crate) fn border_boxes(&self) -> CSSPixelRectIterator
pub(crate) fn client_rect(&self) -> Rect<i32, CSSPixel>
Sourcepub(crate) fn scroll_area(&self) -> Rect<i32, CSSPixel>
pub(crate) fn scroll_area(&self) -> Rect<i32, CSSPixel>
pub(crate) fn effective_overflow(&self) -> Option<AxesOverflow>
pub(crate) fn effective_overflow_without_reflow(&self) -> Option<AxesOverflow>
Sourcepub(crate) fn before(
&self,
cx: &mut JSContext,
nodes: Vec<NodeOrString<DomTypeHolder>>,
) -> ErrorResult
pub(crate) fn before( &self, cx: &mut JSContext, nodes: Vec<NodeOrString<DomTypeHolder>>, ) -> ErrorResult
Sourcepub(crate) fn after(
&self,
cx: &mut JSContext,
nodes: Vec<NodeOrString<DomTypeHolder>>,
) -> ErrorResult
pub(crate) fn after( &self, cx: &mut JSContext, nodes: Vec<NodeOrString<DomTypeHolder>>, ) -> ErrorResult
Sourcepub(crate) fn replace_with(
&self,
cx: &mut JSContext,
nodes: Vec<NodeOrString<DomTypeHolder>>,
) -> ErrorResult
pub(crate) fn replace_with( &self, cx: &mut JSContext, nodes: Vec<NodeOrString<DomTypeHolder>>, ) -> ErrorResult
Sourcepub(crate) fn prepend(
&self,
cx: &mut JSContext,
nodes: Vec<NodeOrString<DomTypeHolder>>,
) -> ErrorResult
pub(crate) fn prepend( &self, cx: &mut JSContext, nodes: Vec<NodeOrString<DomTypeHolder>>, ) -> ErrorResult
Sourcepub(crate) fn append(
&self,
cx: &mut JSContext,
nodes: Vec<NodeOrString<DomTypeHolder>>,
) -> ErrorResult
pub(crate) fn append( &self, cx: &mut JSContext, nodes: Vec<NodeOrString<DomTypeHolder>>, ) -> ErrorResult
Sourcepub(crate) fn replace_children(
&self,
cx: &mut JSContext,
nodes: Vec<NodeOrString<DomTypeHolder>>,
) -> ErrorResult
pub(crate) fn replace_children( &self, cx: &mut JSContext, nodes: Vec<NodeOrString<DomTypeHolder>>, ) -> ErrorResult
Sourcepub(crate) fn move_before(
&self,
cx: &mut JSContext,
node: &Node,
child: Option<&Node>,
) -> ErrorResult
pub(crate) fn move_before( &self, cx: &mut JSContext, node: &Node, child: Option<&Node>, ) -> ErrorResult
Sourcefn move_fn(
cx: &mut JSContext,
node: &Node,
new_parent: &Node,
child: Option<&Node>,
) -> ErrorResult
fn move_fn( cx: &mut JSContext, node: &Node, new_parent: &Node, child: Option<&Node>, ) -> ErrorResult
Sourcepub(crate) fn query_selector(
&self,
selectors: DOMString,
) -> Fallible<Option<DomRoot<Element>>>
pub(crate) fn query_selector( &self, selectors: DOMString, ) -> Fallible<Option<DomRoot<Element>>>
Sourcepub(crate) fn query_selector_all(
&self,
selectors: DOMString,
) -> Fallible<DomRoot<NodeList>>
pub(crate) fn query_selector_all( &self, selectors: DOMString, ) -> Fallible<DomRoot<NodeList>>
pub(crate) fn ancestors(&self) -> impl Iterator<Item = DomRoot<Node>> + use<>
Sourcepub(crate) fn inclusive_ancestors(
&self,
shadow_including: ShadowIncluding,
) -> impl Iterator<Item = DomRoot<Node>> + use<>
pub(crate) fn inclusive_ancestors( &self, shadow_including: ShadowIncluding, ) -> impl Iterator<Item = DomRoot<Node>> + use<>
pub(crate) fn owner_doc(&self) -> DomRoot<Document>
pub(crate) fn set_owner_doc(&self, document: &Document)
pub(crate) fn containing_shadow_root(&self) -> Option<DomRoot<ShadowRoot>>
pub(crate) fn set_containing_shadow_root( &self, shadow_root: Option<&ShadowRoot>, )
pub(crate) fn is_in_html_doc(&self) -> bool
pub(crate) fn is_connected_with_browsing_context(&self) -> bool
pub(crate) fn children(&self) -> impl Iterator<Item = DomRoot<Node>> + use<>
pub(crate) fn children_unrooted<'a>( &self, no_gc: &'a NoGC, ) -> impl Iterator<Item = UnrootedDom<'a, Node>> + use<'a>
pub(crate) fn rev_children(&self) -> impl Iterator<Item = DomRoot<Node>> + use<>
Sourcepub(crate) fn child_elements(
&self,
) -> impl Iterator<Item = DomRoot<Element>> + use<>
pub(crate) fn child_elements( &self, ) -> impl Iterator<Item = DomRoot<Element>> + use<>
Returns the children as Elements
pub(crate) fn child_elements_unrooted<'a>( &self, no_gc: &'a NoGC, ) -> impl Iterator<Item = UnrootedDom<'a, Element>> + use<'a>
pub(crate) fn remove_self(&self, cx: &mut JSContext)
Sourcepub(crate) fn unique_id_if_already_present(&self) -> Option<String>
pub(crate) fn unique_id_if_already_present(&self) -> Option<String>
Returns the node’s unique_id if it has been computed before and None otherwise.
pub(crate) fn unique_id(&self, pipeline: PipelineId) -> String
pub(crate) fn summarize(&self, cx: &mut JSContext) -> NodeInfo
Sourcepub(crate) fn insert_cell_or_row<F, G, I>(
&self,
cx: &mut JSContext,
index: i32,
get_items: F,
new_child: G,
) -> Fallible<DomRoot<HTMLElement>>where
F: Fn(&mut JSContext) -> DomRoot<HTMLCollection>,
G: Fn(&mut JSContext) -> DomRoot<I>,
I: DerivedFrom<Node> + DerivedFrom<HTMLElement> + DomObject,
pub(crate) fn insert_cell_or_row<F, G, I>(
&self,
cx: &mut JSContext,
index: i32,
get_items: F,
new_child: G,
) -> Fallible<DomRoot<HTMLElement>>where
F: Fn(&mut JSContext) -> DomRoot<HTMLCollection>,
G: Fn(&mut JSContext) -> DomRoot<I>,
I: DerivedFrom<Node> + DerivedFrom<HTMLElement> + DomObject,
Used by HTMLTableSectionElement::InsertRow and HTMLTableRowElement::InsertCell
Sourcepub(crate) fn delete_cell_or_row<F, G>(
&self,
cx: &mut JSContext,
index: i32,
get_items: F,
is_delete_type: G,
) -> ErrorResult
pub(crate) fn delete_cell_or_row<F, G>( &self, cx: &mut JSContext, index: i32, get_items: F, is_delete_type: G, ) -> ErrorResult
Used by HTMLTableSectionElement::DeleteRow and HTMLTableRowElement::DeleteCell
pub(crate) fn get_stylesheet(&self) -> Option<ServoArc<Stylesheet>>
pub(crate) fn get_cssom_stylesheet(&self) -> Option<DomRoot<CSSStyleSheet>>
Sourcepub(crate) fn assign_slottables_for_a_tree(
&self,
force: ForceSlottableNodeReconciliation,
)
pub(crate) fn assign_slottables_for_a_tree( &self, force: ForceSlottableNodeReconciliation, )
pub(crate) fn assigned_slot(&self) -> Option<DomRoot<HTMLSlotElement>>
pub(crate) fn set_assigned_slot(&self, assigned_slot: Option<&HTMLSlotElement>)
pub(crate) fn manual_slot_assignment(&self) -> Option<DomRoot<HTMLSlotElement>>
pub(crate) fn set_manual_slot_assignment( &self, manually_assigned_slot: Option<&HTMLSlotElement>, )
Sourcepub(crate) fn parent_in_flat_tree(&self) -> Option<DomRoot<Node>>
pub(crate) fn parent_in_flat_tree(&self) -> Option<DomRoot<Node>>
Gets the parent of this node from the perspective of layout and style.
The returned node is the node’s assigned slot, if any, or the shadow host if it’s a shadow root. Otherwise, it is the node’s parent.
pub(crate) fn inclusive_ancestors_in_flat_tree( &self, ) -> impl Iterator<Item = DomRoot<Node>> + use<>
Sourcepub(crate) fn set_implemented_pseudo_element(
&self,
pseudo_element: PseudoElement,
)
pub(crate) fn set_implemented_pseudo_element( &self, pseudo_element: PseudoElement, )
We are marking this as an implemented pseudo element.
pub(crate) fn implemented_pseudo_element(&self) -> Option<PseudoElement>
Sourcepub(crate) fn editing_host_of(&self) -> Option<DomRoot<Node>>
pub(crate) fn editing_host_of(&self) -> Option<DomRoot<Node>>
pub(crate) fn is_editable_or_editing_host(&self) -> bool
Sourcepub(crate) fn is_editing_host(&self) -> bool
pub(crate) fn is_editing_host(&self) -> bool
Sourcepub(crate) fn is_editable(&self) -> bool
pub(crate) fn is_editable(&self) -> bool
Source§impl Node
impl Node
pub(crate) fn reflect_node<N>( cx: &mut JSContext, node: Box<N>, document: &Document, ) -> DomRoot<N>
pub(crate) fn reflect_node_with_proto<N>( cx: &mut JSContext, node: Box<N>, document: &Document, proto: Option<HandleObject<'_>>, ) -> DomRoot<N>
pub(crate) fn new_inherited(doc: &Document) -> Node
pub(crate) fn new_document_node() -> Node
fn new_(flags: NodeFlags, doc: Option<&Document>) -> Node
Sourcepub(crate) fn ensure_pre_insertion_validity(
no_gc: &NoGC,
node: &Node,
parent: &Node,
child: Option<&Node>,
) -> ErrorResult
pub(crate) fn ensure_pre_insertion_validity( no_gc: &NoGC, node: &Node, parent: &Node, child: Option<&Node>, ) -> ErrorResult
Sourcepub(crate) fn pre_insert(
cx: &mut JSContext,
node: &Node,
parent: &Node,
child: Option<&Node>,
) -> Fallible<DomRoot<Node>>
pub(crate) fn pre_insert( cx: &mut JSContext, node: &Node, parent: &Node, child: Option<&Node>, ) -> Fallible<DomRoot<Node>>
Sourcefn insert(
cx: &mut JSContext,
node: &Node,
parent: &Node,
child: Option<&Node>,
suppress_observers: SuppressObserver,
)
fn insert( cx: &mut JSContext, node: &Node, parent: &Node, child: Option<&Node>, suppress_observers: SuppressObserver, )
Sourcepub(crate) fn string_replace_all(
cx: &mut JSContext,
string: DOMString,
parent: &Node,
)
pub(crate) fn string_replace_all( cx: &mut JSContext, string: DOMString, parent: &Node, )
Sourcefn remove(
cx: &mut JSContext,
node: &Node,
parent: &Node,
suppress_observers: SuppressObserver,
)
fn remove( cx: &mut JSContext, node: &Node, parent: &Node, suppress_observers: SuppressObserver, )
Sourcepub(crate) fn clone(
cx: &mut JSContext,
node: &Node,
maybe_doc: Option<&Document>,
clone_children: CloneChildrenFlag,
registry: Option<DomRoot<CustomElementRegistry>>,
) -> DomRoot<Node>
pub(crate) fn clone( cx: &mut JSContext, node: &Node, maybe_doc: Option<&Document>, clone_children: CloneChildrenFlag, registry: Option<DomRoot<CustomElementRegistry>>, ) -> DomRoot<Node>
Sourcepub(crate) fn child_text_content(&self) -> DOMString
pub(crate) fn child_text_content(&self) -> DOMString
Sourcepub(crate) fn descendant_text_content(&self) -> DOMString
pub(crate) fn descendant_text_content(&self) -> DOMString
pub(crate) fn collect_text_contents<T: Iterator<Item = DomRoot<Node>>>( iterator: T, ) -> DOMString
Sourcepub(crate) fn set_text_content_for_element(
&self,
cx: &mut JSContext,
value: Option<DOMString>,
)
pub(crate) fn set_text_content_for_element( &self, cx: &mut JSContext, value: Option<DOMString>, )
pub(crate) fn namespace_to_string(namespace: Namespace) -> Option<DOMString>
Sourcepub(crate) unsafe fn from_untrusted_node_address(
candidate: UntrustedNodeAddress,
) -> &'static Self
pub(crate) unsafe fn from_untrusted_node_address( candidate: UntrustedNodeAddress, ) -> &'static Self
pub(crate) fn html_serialize( &self, cx: &mut JSContext, traversal_scope: TraversalScope, serialize_shadow_roots: bool, shadow_roots: Vec<DomRoot<ShadowRoot>>, ) -> DOMString
Sourcepub(crate) fn xml_serialize(
&self,
traversal_scope: TraversalScope,
) -> Fallible<DOMString>
pub(crate) fn xml_serialize( &self, traversal_scope: TraversalScope, ) -> Fallible<DOMString>
Sourcepub(crate) fn fragment_serialization_algorithm(
&self,
cx: &mut JSContext,
require_well_formed: bool,
) -> Fallible<DOMString>
pub(crate) fn fragment_serialization_algorithm( &self, cx: &mut JSContext, require_well_formed: bool, ) -> Fallible<DOMString>
fn get_next_sibling_unrooted<'a>( &self, no_gc: &'a NoGC, ) -> Option<UnrootedDom<'a, Node>>
fn get_previous_sibling_unrooted<'a>( &self, no_gc: &'a NoGC, ) -> Option<UnrootedDom<'a, Node>>
fn get_first_child_unrooted<'a>( &self, no_gc: &'a NoGC, ) -> Option<UnrootedDom<'a, Node>>
Sourcefn compare_dom_tree_position(
&self,
other: &Node,
common_ancestor: &Node,
) -> Ordering
fn compare_dom_tree_position( &self, other: &Node, common_ancestor: &Node, ) -> Ordering
Compares other with self in tree order.
Trait Implementations§
§impl Castable for Node
impl Castable for Node
Source§impl DomObject for Node
impl DomObject for Node
type ReflectorType = ()
Source§fn reflector(&self) -> &Reflector<Self::ReflectorType>
fn reflector(&self) -> &Reflector<Self::ReflectorType>
Source§impl HasParent for Node
impl HasParent for Node
Source§fn as_parent(&self) -> &EventTarget
fn as_parent(&self) -> &EventTarget
This is used in a type assertion to ensure that the source and webidls agree as to what the parent type is
type Parent = EventTarget
Source§impl IDLInterface for Node
impl IDLInterface for Node
Source§const PROTO_FIRST: u16 = 196
const PROTO_FIRST: u16 = 196
Source§const PROTO_LAST: u16 = 284
const PROTO_LAST: u16 = 284
Source§impl MallocSizeOf for Node
impl MallocSizeOf for Node
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Source§impl MutDomObject for Node
impl MutDomObject for Node
Source§impl NodeMethods<DomTypeHolder> for Node
impl NodeMethods<DomTypeHolder> for Node
Source§fn GetRootNode(&self, options: &GetRootNodeOptions) -> DomRoot<Node>
fn GetRootNode(&self, options: &GetRootNodeOptions) -> DomRoot<Node>
Source§fn GetTextContent(&self) -> Option<DOMString>
fn GetTextContent(&self) -> Option<DOMString>
Source§fn InsertBefore(
&self,
cx: &mut JSContext,
node: &Node,
child: Option<&Node>,
) -> Fallible<DomRoot<Node>>
fn InsertBefore( &self, cx: &mut JSContext, node: &Node, child: Option<&Node>, ) -> Fallible<DomRoot<Node>>
Source§fn ReplaceChild(
&self,
cx: &mut JSContext,
node: &Node,
child: &Node,
) -> Fallible<DomRoot<Node>>
fn ReplaceChild( &self, cx: &mut JSContext, node: &Node, child: &Node, ) -> Fallible<DomRoot<Node>>
Source§fn CompareDocumentPosition(&self, other: &Node) -> u16
fn CompareDocumentPosition(&self, other: &Node) -> u16
Source§impl ToJSValConvertible for Node
impl ToJSValConvertible for Node
Source§unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue<'_>)
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue<'_>)
self to a JSVal. JSAPI failure causes a panic.Source§fn safe_to_jsval(&self, cx: &mut JSContext, rval: MutableHandle<'_, Value>)
fn safe_to_jsval(&self, cx: &mut JSContext, rval: MutableHandle<'_, Value>)
self to a JSVal. JSAPI failure causes a panic.Source§impl VirtualMethods for Node
impl VirtualMethods for Node
Source§fn unbind_from_tree(&self, cx: &mut JSContext, context: &UnbindContext<'_>)
fn unbind_from_tree(&self, cx: &mut JSContext, context: &UnbindContext<'_>)
Source§fn super_type(&self) -> Option<&dyn VirtualMethods>
fn super_type(&self) -> Option<&dyn VirtualMethods>
Source§fn children_changed(&self, cx: &mut JSContext, mutation: &ChildrenMutation<'_>)
fn children_changed(&self, cx: &mut JSContext, mutation: &ChildrenMutation<'_>)
Source§fn moving_steps(&self, cx: &mut JSContext, context: &MoveContext<'_>)
fn moving_steps(&self, cx: &mut JSContext, context: &MoveContext<'_>)
Source§fn handle_event(&self, cx: &mut JSContext, event: &Event)
fn handle_event(&self, cx: &mut JSContext, event: &Event)
Source§fn attribute_mutated(
&self,
cx: &mut JSContext,
attr: AttrRef<'_>,
mutation: AttributeMutation<'_>,
)
fn attribute_mutated( &self, cx: &mut JSContext, attr: AttrRef<'_>, mutation: AttributeMutation<'_>, )
Source§fn attribute_affects_presentational_hints(&self, attr: AttrRef<'_>) -> bool
fn attribute_affects_presentational_hints(&self, attr: AttrRef<'_>) -> bool
true if given attribute attr affects style of the
given element.Source§fn parse_plain_attribute(&self, name: &LocalName, value: DOMString) -> AttrValue
fn parse_plain_attribute(&self, name: &LocalName, value: DOMString) -> AttrValue
name
on this element.Source§fn post_connection_steps(&self, cx: &mut JSContext)
fn post_connection_steps(&self, cx: &mut JSContext)
Source§fn bind_to_tree(&self, cx: &mut JSContext, context: &BindContext<'_>)
fn bind_to_tree(&self, cx: &mut JSContext, context: &BindContext<'_>)
Source§fn is_valid_command_steps(&self, command: CommandState) -> bool
fn is_valid_command_steps(&self, command: CommandState) -> bool
Source§fn command_steps(
&self,
cx: &mut JSContext,
button: DomRoot<HTMLButtonElement>,
command: CommandState,
) -> bool
fn command_steps( &self, cx: &mut JSContext, button: DomRoot<HTMLButtonElement>, command: CommandState, ) -> bool
Source§fn adopting_steps(&self, cx: &mut JSContext, old_doc: &Document)
fn adopting_steps(&self, cx: &mut JSContext, old_doc: &Document)
Source§fn cloning_steps(
&self,
cx: &mut JSContext,
copy: &Node,
maybe_doc: Option<&Document>,
clone_children: CloneChildrenFlag,
)
fn cloning_steps( &self, cx: &mut JSContext, copy: &Node, maybe_doc: Option<&Document>, clone_children: CloneChildrenFlag, )
impl DerivedFrom<EventTarget> for Node
impl DerivedFrom<Node> for Attr
impl DerivedFrom<Node> for CDATASection
impl DerivedFrom<Node> for CharacterData
impl DerivedFrom<Node> for Comment
impl DerivedFrom<Node> for Document
impl DerivedFrom<Node> for DocumentFragment
impl DerivedFrom<Node> for DocumentType
impl DerivedFrom<Node> for Element
impl DerivedFrom<Node> for HTMLAnchorElement
impl DerivedFrom<Node> for HTMLAreaElement
impl DerivedFrom<Node> for HTMLAudioElement
impl DerivedFrom<Node> for HTMLBRElement
impl DerivedFrom<Node> for HTMLBaseElement
impl DerivedFrom<Node> for HTMLBodyElement
impl DerivedFrom<Node> for HTMLButtonElement
impl DerivedFrom<Node> for HTMLCanvasElement
impl DerivedFrom<Node> for HTMLDListElement
impl DerivedFrom<Node> for HTMLDataElement
impl DerivedFrom<Node> for HTMLDataListElement
impl DerivedFrom<Node> for HTMLDetailsElement
impl DerivedFrom<Node> for HTMLDialogElement
impl DerivedFrom<Node> for HTMLDirectoryElement
impl DerivedFrom<Node> for HTMLDivElement
impl DerivedFrom<Node> for HTMLDocument
impl DerivedFrom<Node> for HTMLElement
impl DerivedFrom<Node> for HTMLEmbedElement
impl DerivedFrom<Node> for HTMLFieldSetElement
impl DerivedFrom<Node> for HTMLFontElement
impl DerivedFrom<Node> for HTMLFormElement
impl DerivedFrom<Node> for HTMLFrameElement
impl DerivedFrom<Node> for HTMLFrameSetElement
impl DerivedFrom<Node> for HTMLHRElement
impl DerivedFrom<Node> for HTMLHeadElement
impl DerivedFrom<Node> for HTMLHeadingElement
impl DerivedFrom<Node> for HTMLHtmlElement
impl DerivedFrom<Node> for HTMLIFrameElement
impl DerivedFrom<Node> for HTMLImageElement
impl DerivedFrom<Node> for HTMLInputElement
impl DerivedFrom<Node> for HTMLLIElement
impl DerivedFrom<Node> for HTMLLabelElement
impl DerivedFrom<Node> for HTMLLegendElement
impl DerivedFrom<Node> for HTMLLinkElement
impl DerivedFrom<Node> for HTMLMapElement
impl DerivedFrom<Node> for HTMLMarqueeElement
impl DerivedFrom<Node> for HTMLMediaElement
impl DerivedFrom<Node> for HTMLMenuElement
impl DerivedFrom<Node> for HTMLMetaElement
impl DerivedFrom<Node> for HTMLMeterElement
impl DerivedFrom<Node> for HTMLModElement
impl DerivedFrom<Node> for HTMLOListElement
impl DerivedFrom<Node> for HTMLObjectElement
impl DerivedFrom<Node> for HTMLOptGroupElement
impl DerivedFrom<Node> for HTMLOptionElement
impl DerivedFrom<Node> for HTMLOutputElement
impl DerivedFrom<Node> for HTMLParagraphElement
impl DerivedFrom<Node> for HTMLParamElement
impl DerivedFrom<Node> for HTMLPictureElement
impl DerivedFrom<Node> for HTMLPreElement
impl DerivedFrom<Node> for HTMLProgressElement
impl DerivedFrom<Node> for HTMLQuoteElement
impl DerivedFrom<Node> for HTMLScriptElement
impl DerivedFrom<Node> for HTMLSelectElement
impl DerivedFrom<Node> for HTMLSlotElement
impl DerivedFrom<Node> for HTMLSourceElement
impl DerivedFrom<Node> for HTMLSpanElement
impl DerivedFrom<Node> for HTMLStyleElement
impl DerivedFrom<Node> for HTMLTableCaptionElement
impl DerivedFrom<Node> for HTMLTableCellElement
impl DerivedFrom<Node> for HTMLTableColElement
impl DerivedFrom<Node> for HTMLTableElement
impl DerivedFrom<Node> for HTMLTableRowElement
impl DerivedFrom<Node> for HTMLTableSectionElement
impl DerivedFrom<Node> for HTMLTemplateElement
impl DerivedFrom<Node> for HTMLTextAreaElement
impl DerivedFrom<Node> for HTMLTimeElement
impl DerivedFrom<Node> for HTMLTitleElement
impl DerivedFrom<Node> for HTMLTrackElement
impl DerivedFrom<Node> for HTMLUListElement
impl DerivedFrom<Node> for HTMLUnknownElement
impl DerivedFrom<Node> for HTMLVideoElement
impl DerivedFrom<Node> for Node
impl DerivedFrom<Node> for ProcessingInstruction
impl DerivedFrom<Node> for SVGElement
impl DerivedFrom<Node> for SVGGraphicsElement
impl DerivedFrom<Node> for SVGImageElement
impl DerivedFrom<Node> for SVGSVGElement
impl DerivedFrom<Node> for ShadowRoot
impl DerivedFrom<Node> for Text
impl DerivedFrom<Node> for XMLDocument
impl Eq for Node
Auto Trait Implementations§
impl !Freeze for Node
impl !RefUnwindSafe for Node
impl !Send for Node
impl !Sync for Node
impl Unpin for Node
impl UnsafeUnpin for Node
impl !UnwindSafe for Node
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<D, T> DomGlobalGeneric<D> for T
impl<D, T> DomGlobalGeneric<D> for T
Source§fn global_(&self, realm: InRealm<'_>) -> Root<Dom<<D as DomTypes>::GlobalScope>>where
Self: Sized,
fn global_(&self, realm: InRealm<'_>) -> Root<Dom<<D as DomTypes>::GlobalScope>>where
Self: Sized,
GlobalScope] of the realm that the DomObject was created in. If this
object is a Node, this will be different from it’s owning Document if adopted by. For
Nodes it’s almost always better to use NodeTraits::owning_global.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more