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]
impl Document
pub fn create_document_fragment(&self) -> DocumentFragment
[src]
pub fn create_document_fragment(&self) -> DocumentFragment
In an HTML document, the Document.createDocumentFragment() method creates a new empty DocumentFragment.
pub fn create_element(&self, tag: &str) -> Result<Element, TODO>
[src]
pub fn create_element(&self, tag: &str) -> Result<Element, TODO>
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.
pub fn create_text_node(&self, text: &str) -> TextNode
[src]
pub fn create_text_node(&self, text: &str) -> TextNode
Creates a new text node.
pub fn location(&self) -> Option<Location>
[src]
pub fn location(&self) -> Option<Location>
Returns a Location object which contains information about the URL of the document and provides methods for changing that URL and loading another URL.
pub fn body(&self) -> Option<HtmlElement>
[src]
pub fn body(&self) -> Option<HtmlElement>
Returns the <body>
or <frameset>
node of the current document, or null if no such element exists.
pub fn head(&self) -> Option<HtmlElement>
[src]
pub fn head(&self) -> Option<HtmlElement>
Returns the <head>
element of the current document. If there are more than one <head>
elements, the first one is returned.
pub fn title(&self) -> String
[src]
pub fn title(&self) -> String
Gets the title of the document.
pub fn set_title(&self, title: &str)
[src]
pub fn set_title(&self, title: &str)
Sets the title of the document.
pub fn document_element(&self) -> Option<Element>
[src]
pub fn document_element(&self) -> Option<Element>
Returns the Element that is the root element of the document (for example, the <html>
element for HTML documents).
Trait Implementations
impl Clone for Document
[src]
impl Clone for Document
fn clone(&self) -> Document
[src]
fn clone(&self) -> Document
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Document
[src]
impl Debug for Document
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl PartialEq for Document
[src]
impl PartialEq for Document
fn eq(&self, other: &Document) -> bool
[src]
fn eq(&self, other: &Document) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Document) -> bool
[src]
fn ne(&self, other: &Document) -> bool
This method tests for !=
.
impl Eq for Document
[src]
impl Eq for Document
impl From<Document> for EventTarget
[src]
impl From<Document> for EventTarget
impl TryFrom<EventTarget> for Document
[src]
impl TryFrom<EventTarget> for Document
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: EventTarget) -> Result<Self, Self::Error>
[src]
fn try_from(value: EventTarget) -> Result<Self, Self::Error>
Performs the conversion.
impl From<Document> for Node
[src]
impl From<Document> for Node
impl TryFrom<Node> for Document
[src]
impl TryFrom<Node> for Document
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: Node) -> Result<Self, Self::Error>
[src]
fn try_from(value: Node) -> Result<Self, Self::Error>
Performs the conversion.
impl InstanceOf for Document
[src]
impl InstanceOf for Document
fn instance_of(reference: &Reference) -> bool
[src]
fn instance_of(reference: &Reference) -> bool
Checks whenever a given Reference if of type Self
.
impl AsRef<Reference> for Document
[src]
impl AsRef<Reference> for Document
impl ReferenceType for Document
[src]
impl ReferenceType for Document
unsafe fn from_reference_unchecked(reference: Reference) -> Self
[src]
unsafe fn from_reference_unchecked(reference: Reference) -> Self
Converts a given reference into a concrete reference-like wrapper. Doesn't do any type checking; highly unsafe to use! Read more
impl From<Document> for Reference
[src]
impl From<Document> for Reference
impl TryFrom<Document> for Reference
[src]
impl TryFrom<Document> for Reference
type Error = Void
The type returned in the event of a conversion error.
fn try_from(value: Document) -> Result<Self, Self::Error>
[src]
fn try_from(value: Document) -> Result<Self, Self::Error>
Performs the conversion.
impl TryFrom<Reference> for Document
[src]
impl TryFrom<Reference> for Document
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(reference: Reference) -> Result<Self, Self::Error>
[src]
fn try_from(reference: Reference) -> Result<Self, Self::Error>
Performs the conversion.
impl<'_r> TryFrom<&'_r Reference> for Document
[src]
impl<'_r> TryFrom<&'_r Reference> for Document
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(reference: &Reference) -> Result<Self, Self::Error>
[src]
fn try_from(reference: &Reference) -> Result<Self, Self::Error>
Performs the conversion.
impl TryFrom<Value> for Document
[src]
impl TryFrom<Value> for Document
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: Value) -> Result<Self, Self::Error>
[src]
fn try_from(value: Value) -> Result<Self, Self::Error>
Performs the conversion.
impl<'_r> TryFrom<&'_r Value> for Document
[src]
impl<'_r> TryFrom<&'_r Value> for Document
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: &Value) -> Result<Self, Self::Error>
[src]
fn try_from(value: &Value) -> Result<Self, Self::Error>
Performs the conversion.
impl JsSerialize for Document
[src]
impl JsSerialize for Document
impl IEventTarget for Document
[src]
impl IEventTarget for Document
fn add_event_listener<T, F>(&self, listener: F) -> EventListenerHandle where
T: ConcreteEvent,
F: FnMut(T) + 'static,
[src]
fn add_event_listener<T, F>(&self, listener: F) -> EventListenerHandle where
T: ConcreteEvent,
F: FnMut(T) + 'static,
Adds given event handler to the list of event listeners for the specified EventTarget
on which it's called. Read more
fn dispatch_event<T: IEvent>(&self, event: &T) -> Result<bool, TODO>
[src]
fn dispatch_event<T: IEvent>(&self, event: &T) -> Result<bool, TODO>
Dispatches an Event
at this EventTarget
, invoking the affected event listeners in the appropriate order. Read more
impl IParentNode for Document
[src]
impl IParentNode for Document
fn query_selector(&self, selector: &str) -> Result<Option<Element>, TODO>
[src]
fn query_selector(&self, selector: &str) -> Result<Option<Element>, TODO>
Returns the first element that is a descendant of the element on which it is invoked that matches the specified group of selectors. Read more
fn query_selector_all(&self, selector: &str) -> Result<NodeList, TODO>
[src]
fn query_selector_all(&self, selector: &str) -> Result<NodeList, TODO>
Returns a non-live NodeList of all elements descended from the element on which it is invoked that matches the specified group of CSS selectors. Read more
impl INode for Document
[src]
impl INode for Document
fn as_node(&self) -> &Node
[src]
fn as_node(&self) -> &Node
Casts a reference to this object into a reference to a Node.
fn append_child<T: INode>(&self, child: &T)
[src]
fn append_child<T: INode>(&self, child: &T)
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<Node, NotFoundError>
[src]
fn remove_child<T: INode>(&self, child: &T) -> Result<Node, NotFoundError>
Removes a child node from the DOM. Read more
fn clone_node(&self, kind: CloneKind) -> Result<Self, TODO>
[src]
fn clone_node(&self, kind: CloneKind) -> Result<Self, TODO>
Returns a duplicate of the node on which this method was called. Read more
fn contains<T: INode>(&self, node: &T) -> bool
[src]
fn contains<T: INode>(&self, node: &T) -> bool
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
) -> Result<Node, InsertNodeError>
[src]
fn insert_before<T: INode, U: INode>(
&self,
new_node: &T,
reference_node: &U
) -> Result<Node, InsertNodeError>
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
) -> Result<Node, InsertNodeError>
[src]
fn replace_child<T: INode, U: INode>(
&self,
new_child: &T,
old_child: &U
) -> Result<Node, InsertNodeError>
Replaces one hild node of the specified node with another. Read more
fn parent_node(&self) -> Option<Node>
[src]
fn parent_node(&self) -> Option<Node>
Returns the parent of this node in the DOM tree. Read more
fn first_child(&self) -> Option<Node>
[src]
fn first_child(&self) -> Option<Node>
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]
fn last_child(&self) -> Option<Node>
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]
fn next_sibling(&self) -> Option<Node>
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]
fn node_name(&self) -> String
Returns the name of the node. Read more
fn node_type(&self) -> NodeType
[src]
fn node_type(&self) -> NodeType
Returns the type of the node. Read more
fn node_value(&self) -> Option<String>
[src]
fn node_value(&self) -> Option<String>
Returns the value of the node. Read more
fn set_node_value(&self, value: Option<&str>)
[src]
fn set_node_value(&self, value: Option<&str>)
Sets the value of the node. Read more
fn owner_document(&self) -> Option<Document>
[src]
fn owner_document(&self) -> Option<Document>
Returns the Document
that this node belongs to. Read more
fn parent_element(&self) -> Option<Element>
[src]
fn parent_element(&self) -> Option<Element>
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]
fn previous_sibling(&self) -> Option<Node>
Returns the node's previous sibling in the tree, or None
if there isn't such a node. Read more
fn text_content(&self) -> Option<String>
[src]
fn text_content(&self) -> Option<String>
A property which represents the text content of a node and its descendants. Read more
fn set_text_content(&self, text: &str)
[src]
fn set_text_content(&self, text: &str)
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]
fn child_nodes(&self) -> NodeList
Returns a live collection of child nodes of this node. Read more
fn base_uri(&self) -> String
[src]
fn base_uri(&self) -> String
Gets the base URL. Read more
fn has_child_nodes(&self) -> bool
[src]
fn has_child_nodes(&self) -> bool
Returns whether this node has children nodes. Read more
fn is_default_namespace(&self, namespace: &str) -> bool
[src]
fn is_default_namespace(&self, namespace: &str) -> bool
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]
fn is_equal_node<T: INode>(&self, node: &T) -> bool
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]
fn is_same_node<T: INode>(&self, node: &T) -> bool
Test whether two Node
references are the same. Read more
fn lookup_prefix(&self, namespace: &str) -> Option<String>
[src]
fn lookup_prefix(&self, namespace: &str) -> Option<String>
Returns the prefix for the given namespace URI, if present. Read more
fn lookup_namespace_uri(&self, prefix: &str) -> Option<String>
[src]
fn lookup_namespace_uri(&self, prefix: &str) -> Option<String>
Returns the namespace URI for the given prefix. Read more
fn normalize(&self)
[src]
fn normalize(&self)
Merges any adjacent text nodes and removes empty text nodes under this node. Read more
impl INonElementParentNode for Document
[src]
impl INonElementParentNode for Document