[−][src]Struct stdweb::web::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]
pub fn create_document_fragment(&self) -> DocumentFragment
[src]
In an HTML document, the Document.createDocumentFragment() method creates a new empty DocumentFragment.
pub fn create_element(
&self,
tag: &str
) -> Result<Element, InvalidCharacterError>
[src]
&self,
tag: &str
) -> Result<Element, InvalidCharacterError>
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_element_ns(
&self,
namespace_uri: &str,
tag: &str
) -> Result<Element, CreateElementNsError>
[src]
&self,
namespace_uri: &str,
tag: &str
) -> Result<Element, CreateElementNsError>
Creates an element with the specified namespace URI and qualified name.
To create an element without specifying a namespace URI, use the createElement
method.
pub fn create_text_node(&self, text: &str) -> TextNode
[src]
Creates a new text node.
pub 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.
pub fn body(&self) -> Option<HtmlElement>
[src]
Returns the <body>
or <frameset>
node of the current document, or null if no such element exists.
pub fn head(&self) -> Option<HtmlElement>
[src]
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]
Gets the title of the document.
pub fn set_title(&self, title: &str)
[src]
Sets the title of the document.
pub fn document_element(&self) -> Option<Element>
[src]
Returns the Element that is the root element of the document (for example, the <html>
element for HTML documents).
pub fn pointer_lock_element(&self) -> Option<Element>
[src]
Returns the Element that the pointer is locked to, if it is locked to any
pub fn exit_pointer_lock(&self)
[src]
Exit the pointer lock on the current element
pub fn import_node<N: INode>(
&self,
n: &N,
kind: CloneKind
) -> Result<Node, NotSupportedError>
[src]
&self,
n: &N,
kind: CloneKind
) -> Result<Node, NotSupportedError>
Import node from another document
pub fn fullscreen_enabled(&self) -> bool
[src]
Check if the fullscreen API is enabled
pub fn fullscreen_element(&self) -> Option<Element>
[src]
Get the current fullscreen element, or None if there is nothing fullscreen
Trait Implementations
impl JsSerialize for Document
[src]
impl TryFrom<EventTarget> for Document
[src]
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: EventTarget) -> Result<Self, Self::Error>
[src]
impl TryFrom<Node> for Document
[src]
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: Node) -> Result<Self, Self::Error>
[src]
impl TryFrom<Document> for Reference
[src]
type Error = Void
The type returned in the event of a conversion error.
fn try_from(value: Document) -> Result<Self, Self::Error>
[src]
impl TryFrom<Reference> for Document
[src]
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(reference: Reference) -> Result<Self, Self::Error>
[src]
impl<'_r> TryFrom<&'_r Reference> for Document
[src]
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(reference: &Reference) -> Result<Self, Self::Error>
[src]
impl TryFrom<Value> for Document
[src]
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: Value) -> Result<Self, Self::Error>
[src]
impl<'_r> TryFrom<&'_r Value> for Document
[src]
type Error = ConversionError
The type returned in the event of a conversion error.
fn try_from(value: &Value) -> Result<Self, Self::Error>
[src]
impl InstanceOf for Document
[src]
fn instance_of(reference: &Reference) -> bool
[src]
impl ReferenceType for Document
[src]
unsafe fn from_reference_unchecked(reference: Reference) -> Self
[src]
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,
fn dispatch_event<T: IEvent>(&self, event: &T) -> Result<bool, TODO>
[src]
impl INode for Document
[src]
fn as_node(&self) -> &Node
[src]
fn append_child<T: INode>(&self, child: &T)
[src]
fn remove_child<T: INode>(&self, child: &T) -> Result<Node, NotFoundError>
[src]
fn clone_node(&self, kind: CloneKind) -> Result<Self, TODO>
[src]
fn contains<T: INode>(&self, node: &T) -> bool
[src]
fn insert_before<T: INode, U: INode>(
&self,
new_node: &T,
reference_node: &U
) -> Result<Node, InsertNodeError>
[src]
&self,
new_node: &T,
reference_node: &U
) -> Result<Node, InsertNodeError>
fn replace_child<T: INode, U: INode>(
&self,
new_child: &T,
old_child: &U
) -> Result<Node, InsertNodeError>
[src]
&self,
new_child: &T,
old_child: &U
) -> Result<Node, InsertNodeError>
fn parent_node(&self) -> Option<Node>
[src]
fn first_child(&self) -> Option<Node>
[src]
fn last_child(&self) -> Option<Node>
[src]
fn next_sibling(&self) -> Option<Node>
[src]
fn node_name(&self) -> String
[src]
fn node_type(&self) -> NodeType
[src]
fn node_value(&self) -> Option<String>
[src]
fn set_node_value(&self, value: Option<&str>)
[src]
fn owner_document(&self) -> Option<Document>
[src]
fn parent_element(&self) -> Option<Element>
[src]
fn previous_sibling(&self) -> Option<Node>
[src]
fn text_content(&self) -> Option<String>
[src]
fn set_text_content(&self, text: &str)
[src]
fn child_nodes(&self) -> NodeList
[src]
fn base_uri(&self) -> String
[src]
fn has_child_nodes(&self) -> bool
[src]
fn is_default_namespace(&self, namespace: &str) -> bool
[src]
fn is_equal_node<T: INode>(&self, node: &T) -> bool
[src]
fn is_same_node<T: INode>(&self, node: &T) -> bool
[src]
fn lookup_prefix(&self, namespace: &str) -> Option<String>
[src]
fn lookup_namespace_uri(&self, prefix: &str) -> Option<String>
[src]
fn normalize(&self)
[src]
impl IParentNode for Document
[src]
fn query_selector(&self, selector: &str) -> Result<Option<Element>, SyntaxError>
[src]
fn query_selector_all(&self, selector: &str) -> Result<NodeList, SyntaxError>
[src]
impl INonElementParentNode for Document
[src]
fn get_element_by_id(&self, id: &str) -> Option<Element>
[src]
impl AsRef<Reference> for Document
[src]
impl From<Document> for EventTarget
[src]
impl From<Document> for Node
[src]
impl From<Document> for Reference
[src]
impl Clone for Document
[src]
impl Eq for Document
[src]
impl PartialEq<Document> for Document
[src]
impl Debug for Document
[src]
Auto Trait Implementations
impl Send for Document
impl Sync for Document
impl Unpin for Document
impl UnwindSafe for Document
impl RefUnwindSafe for Document
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,