Struct stdweb::web::Document
[−]
[src]
pub struct Document(_);
The Document
interface represents any web page loaded in the browser and
serves as an entry point into the web page's content, which is the DOM tree.
Methods
impl Document
[src]
fn query_selector(&self, selector: &str) -> Option<Element>
[src]
Returns the first Element within the document that matches the specified selector, or group of selectors.
fn query_selector_all(&self, selector: &str) -> NodeList
[src]
Returns a list of the elements within the document (using depth-first pre-order traversal of the document's nodes) that match the specified group of selectors.
fn get_element_by_id(&self, id: &str) -> Option<Element>
[src]
Returns a reference to the element by its ID; the ID is a string which can
be used to uniquely identify the element, found in the HTML id
attribute.
fn create_element(&self, tag: &str) -> Element
[src]
In an HTML document, the Document.createElement() method creates the HTML
element specified by tag
, or an HTMLUnknownElement if tag
isn't
recognized. In other documents, it creates an element with a null namespace URI.
fn create_text_node(&self, text: &str) -> TextNode
[src]
Creates a new text node.
fn location(&self) -> Option<Location>
[src]
Returns a Location object which contains information about the URL of the document and provides methods for changing that URL and loading another URL.
Trait Implementations
impl IEventTarget for Document
[src]
fn add_event_listener<T, F>(&self, listener: F) -> EventListenerHandle where
T: ConcreteEvent,
F: FnMut(T) + 'static,
[src]
T: ConcreteEvent,
F: FnMut(T) + 'static,
Adds given event handler to the list the list of event listeners for the specified EventTarget
on which it's called. Read more
fn dispatch_event<T: IEvent>(&self, event: &T) -> bool
[src]
Dispatches an Event
at this EventTarget
, invoking the affected event listeners in the appropriate order. (JavaScript docs) Read more
impl INode for Document
[src]
fn as_node(&self) -> &Node
[src]
Casts a reference to this object into a reference to a Node.
fn append_child<T: INode>(&self, child: &T)
[src]
Adds a node to the end of the list of children of a specified parent node. Read more
fn remove_child<T: INode>(&self, child: &T) -> Result<(), NotFoundError>
[src]
Removes a child node from the DOM. Read more
fn clone_node(&self, kind: CloneKind) -> Self
[src]
Returns a duplicate of the node on which this method was called. Read more
fn contains<T: INode>(&self, node: &T) -> bool
[src]
Checks whenever a given node is a descendant of this one or not. Read more
fn insert_before<T: INode, U: INode>(&self, new_node: &T, reference_node: &U)
[src]
Inserts the specified node before the reference node as a child of the current node. Read more
fn replace_child<T: INode, U: INode>(&self, new_child: &T, old_child: &U)
[src]
Replaces one hild node of the specified node with another. Read more
fn parent_node(&self) -> Option<Node>
[src]
Returns the parent of this node in the DOM tree. Read more
fn first_child(&self) -> Option<Node>
[src]
Returns the node's first child in the tree, or None
if the node is childless. Read more
fn last_child(&self) -> Option<Node>
[src]
Returns the node's last child in the tree, or None
if the node is childless. Read more
fn next_sibling(&self) -> Option<Node>
[src]
Returns the node's next sibling in the tree, or None
if there isn't such a node. Read more
fn node_name(&self) -> String
[src]
Returns the name of the node. Read more
fn node_type(&self) -> NodeType
[src]
Returns the type of the node. Read more
fn node_value(&self) -> Option<String>
[src]
Returns the value of the node. Read more
fn set_node_value(&self, value: Option<&str>)
[src]
Sets the value of the node. Read more
fn owner_document(&self) -> Option<Document>
[src]
Returns the Document
that this node belongs to. Read more
fn parent_element(&self) -> Option<Element>
[src]
Returns an Element
that is the parent of this node. Returns null
if the node has no parent or the parent is not an Element
. Read more
fn previous_sibling(&self) -> Option<Node>
[src]
Returns the node's previous sibling in the tree, or None
if there isn't such a node. Read more
fn inner_text(&self) -> String
[src]
A property which represents the "rendered" text content of a node and its descendants. It approximates the text the user would get if they highlighted the contents of the element with the cursor and then copied to the clipboard. Read more
fn text_content(&self) -> Option<String>
[src]
A property which represents the text content of a node and its descendants. Read more
fn set_text_content(&self, text: &str)
[src]
Sets the text content of this node; calling thil removes all of node's children and replaces them with a single text node with the given value. Read more
fn child_nodes(&self) -> NodeList
[src]
Returns a live collection of child nodes of this node. Read more
fn base_uri(&self) -> Option<String>
[src]
Gets the base URL. Read more
fn has_child_nodes(&self) -> bool
[src]
Returns whether this node has children nodes. Read more
fn is_default_namespace(&self, namespace: &str) -> bool
[src]
Determines whether the given namespace is the default namespace of this node. Read more
fn is_equal_node<T: INode>(&self, node: &T) -> bool
[src]
Tests whether this node is equal to another node. Two nodes are equal if they have the same type, defining characteristics, matching attributes, and so on. Read more
fn is_same_node<T: INode>(&self, node: &T) -> bool
[src]
Test whether two Node
references are the same. Read more
fn lookup_prefix(&self, namespace: &str) -> Option<String>
[src]
Returns the prefix for the given namespace URI, if present. Read more
fn lookup_namespace_uri(&self, prefix: &str) -> Option<String>
[src]
Returns the namespace URI for the given prefix. Read more
fn normalize(&self)
[src]
Merges any adjacent text nodes and removes empty text nodes under this node. Read more
impl Debug for Document
[src]
fn fmt(&self, formatter: &mut Formatter) -> Result
[src]
Formats the value using the given formatter.
impl Clone for Document
[src]
fn clone(&self) -> Self
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl AsRef<Reference> for Document
[src]
impl<R: TryInto<Reference>> TryFrom<R> for Document where
<R as TryInto<Reference>>::Error: Into<Box<Error>>,
[src]
<R as TryInto<Reference>>::Error: Into<Box<Error>>,