stdweb::web::html_element

Struct InputElement

Source
pub struct InputElement(/* private fields */);
Expand description

The HTML input element is used to create interactive controls for web-based forms in order to accept data from the user.

(JavaScript docs)

Implementations§

Source§

impl InputElement

Source

pub fn raw_value(&self) -> String

The value of the control. This attribute is optional except when the input is a radio button or a checkbox.

Source

pub fn set_raw_value(&self, value: &str)

Sets the value of the control.

Source

pub fn selection_start(&self) -> Option<u32>

The offset to the start of the selection. This attribute only applies when the input is a text, search, url, telephone or password.

Source

pub fn set_selection_start(&self, value: u32) -> Result<(), InvalidStateError>

Sets the offset to the start of the selection. This attribute only applies when the input is a text, search, url, telephone or password.

Source

pub fn selection_end(&self) -> Option<u32>

The offset to the end of the selection. This attribute only applies when the input is a text, search, url, telephone or password.

Source

pub fn set_selection_end(&self, value: u32) -> Result<(), InvalidStateError>

Sets the offset to the end of the selection. This attribute only applies when the input is a text, search, url, telephone or password.

Trait Implementations§

Source§

impl AsRef<Reference> for InputElement

Source§

fn as_ref(&self) -> &Reference

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for InputElement

Source§

fn clone(&self) -> InputElement

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for InputElement

Source§

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

Formats the value using the given formatter. Read more
Source§

impl From<InputElement> for Element

Source§

fn from(value: InputElement) -> Self

Converts to this type from the input type.
Source§

impl From<InputElement> for EventTarget

Source§

fn from(value: InputElement) -> Self

Converts to this type from the input type.
Source§

impl From<InputElement> for HtmlElement

Source§

fn from(value: InputElement) -> Self

Converts to this type from the input type.
Source§

impl From<InputElement> for Node

Source§

fn from(value: InputElement) -> Self

Converts to this type from the input type.
Source§

impl From<InputElement> for Reference

Source§

fn from(value: InputElement) -> Self

Converts to this type from the input type.
Source§

impl IElement for InputElement

Source§

fn namespace_uri(&self) -> Option<String>

The Element.namespaceURI read-only property returns the namespace URI of the element, or null if the element is not in a namespace. Read more
Source§

fn class_list(&self) -> TokenList

The Element.classList is a read-only property which returns a live TokenList collection of the class attributes of the element. Read more
Source§

fn has_attribute(&self, name: &str) -> bool

The Element.hasAttribute() method returns a Boolean value indicating whether the specified element has the specified attribute or not. Read more
Source§

fn get_attribute(&self, name: &str) -> Option<String>

Element.getAttribute() returns the value of a specified attribute on the element. If the given attribute does not exist, the value returned will either be null or “” (the empty string); Read more
Source§

fn set_attribute( &self, name: &str, value: &str, ) -> Result<(), InvalidCharacterError>

Sets the value of an attribute on the specified element. If the attribute already exists, the value is updated; otherwise a new attribute is added with the specified name and value. Read more
Source§

fn scroll_top(&self) -> f64

Gets the the number of pixels that an element’s content is scrolled vertically. Read more
Source§

fn set_scroll_top(&self, value: f64)

Sets the the number of pixels that an element’s content is scrolled vertically. Read more
Source§

fn scroll_left(&self) -> f64

Gets the the number of pixels that an element’s content is scrolled to the left. Read more
Source§

fn set_scroll_left(&self, value: f64)

Sets the the number of pixels that an element’s content is scrolled to the left. Read more
Source§

fn get_attribute_names(&self) -> Vec<String>

Element.getAttributeNames() returns the attribute names of the element as an Array of strings. If the element has no attributes it returns an empty array. Read more
Source§

fn remove_attribute(&self, name: &str)

Element.removeAttribute removes an attribute from the specified element. Read more
Source§

fn has_attributes(&self) -> bool

The Element.hasAttributes() method returns Boolean value, indicating if the current element has any attributes or not. Read more
Source§

fn closest(&self, selectors: &str) -> Result<Option<Element>, SyntaxError>

Returns the closest ancestor of the element (or the element itself) which matches the selectors given in parameter. If there isn’t such an ancestor, it returns None. Read more
Source§

fn set_pointer_capture(&self, pointer_id: i32) -> Result<(), InvalidPointerId>

Designates a specific element as the capture target of future pointer events. Read more
Source§

fn release_pointer_capture( &self, pointer_id: i32, ) -> Result<(), InvalidPointerId>

Releases pointer capture that was previously set for a specific pointer Read more
Source§

fn has_pointer_capture(&self, pointer_id: i32) -> bool

Returns a boolean indicating if the element has captured the specified pointer Read more
Source§

fn insert_adjacent_html( &self, position: InsertPosition, html: &str, ) -> Result<(), InsertAdjacentError>

Insert nodes from HTML fragment into specified position. Read more
Source§

fn insert_html_before(&self, html: &str) -> Result<(), InsertAdjacentError>

Insert nodes from HTML fragment before element. Read more
Source§

fn prepend_html(&self, html: &str) -> Result<(), InsertAdjacentError>

Insert nodes from HTML fragment as the first children of the element. Read more
Source§

fn append_html(&self, html: &str) -> Result<(), InsertAdjacentError>

Insert nodes from HTML fragment as the last children of the element. Read more
Source§

fn insert_html_after(&self, html: &str) -> Result<(), InsertAdjacentError>

Insert nodes from HTML fragment after element. Read more
Source§

fn slot(&self) -> String

The slot property of the Element interface returns the name of the shadow DOM slot the element is inserted in. Read more
Source§

fn attach_shadow( &self, mode: ShadowRootMode, ) -> Result<ShadowRoot, AttachShadowError>

Attach a shadow DOM tree to the specified element and returns a reference to its ShadowRoot. It returns a shadow root if successfully attached or None if the element cannot be attached. Read more
Source§

fn shadow_root(&self) -> Option<ShadowRoot>

Returns the shadow root of the current element or None. Read more
Source§

impl IEventTarget for InputElement

Source§

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
Source§

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
Source§

impl IHtmlElement for InputElement

Source§

fn focus(&self)

Sets focus on the specified element, if it can be focused. Read more
Source§

fn blur(&self)

Removes keyboard focus from the current element. Read more
Source§

fn dataset(&self) -> StringMap

Allows access, both in reading and writing, to all of the custom data attributes (data-*) set on the element, either in HTML or in the DOM. Read more
Source§

fn get_bounding_client_rect(&self) -> Rect

Returns the size of an element and its position relative to the viewport. (JavaScript docs)
Source§

fn offset_width(&self) -> i32

Returns the layout width of an element. Typically, an element’s offsetWidth is a measurement which includes the element borders, the element horizontal padding, the element vertical scrollbar (if present, if rendered) and the element CSS width.
Source§

fn offset_height(&self) -> i32

Returns the height of the element including vertical padding and borders, as an integer.
Source§

fn inner_text(&self) -> String

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
Source§

impl INode for InputElement

Source§

fn as_node(&self) -> &Node

Casts a reference to this object into a reference to a Node.
Source§

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
Source§

fn remove_child<T: INode>(&self, child: &T) -> Result<Node, NotFoundError>

Removes a child node from the DOM. Read more
Source§

fn clone_node(&self, kind: CloneKind) -> Result<Self, TODO>

Returns a duplicate of the node on which this method was called. Read more
Source§

fn contains<T: INode>(&self, node: &T) -> bool

Checks whenever a given node is a descendant of this one or not. Read more
Source§

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
Source§

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
Source§

fn parent_node(&self) -> Option<Node>

Returns the parent of this node in the DOM tree. Read more
Source§

fn first_child(&self) -> Option<Node>

Returns the node’s first child in the tree, or None if the node is childless. Read more
Source§

fn last_child(&self) -> Option<Node>

Returns the node’s last child in the tree, or None if the node is childless. Read more
Source§

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
Source§

fn node_name(&self) -> String

Returns the name of the node. Read more
Source§

fn node_type(&self) -> NodeType

Returns the type of the node. Read more
Source§

fn node_value(&self) -> Option<String>

Returns the value of the node. Read more
Source§

fn set_node_value(&self, value: Option<&str>)

Sets the value of the node. Read more
Source§

fn owner_document(&self) -> Option<Document>

Returns the Document that this node belongs to. Read more
Source§

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
Source§

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
Source§

fn text_content(&self) -> Option<String>

A property which represents the text content of a node and its descendants. Read more
Source§

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
Source§

fn child_nodes(&self) -> NodeList

Returns a live collection of child nodes of this node. Read more
Source§

fn base_uri(&self) -> String

Gets the base URL. Read more
Source§

fn has_child_nodes(&self) -> bool

Returns whether this node has children nodes. Read more
Source§

fn is_default_namespace(&self, namespace: &str) -> bool

Determines whether the given namespace is the default namespace of this node. Read more
Source§

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
Source§

fn is_same_node<T: INode>(&self, node: &T) -> bool

Test whether two Node references are the same. Read more
Source§

fn lookup_prefix(&self, namespace: &str) -> Option<String>

Returns the prefix for the given namespace URI, if present. Read more
Source§

fn lookup_namespace_uri(&self, prefix: &str) -> Option<String>

Returns the namespace URI for the given prefix. Read more
Source§

fn normalize(&self)

Merges any adjacent text nodes and removes empty text nodes under this node. Read more
Source§

impl InstanceOf for InputElement

Source§

fn instance_of(reference: &Reference) -> bool

Checks whenever a given Reference if of type Self.
Source§

impl PartialEq for InputElement

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl ReferenceType for InputElement

Source§

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!
Source§

impl<'_r> TryFrom<&'_r Reference> for InputElement

Source§

type Error = ConversionError

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

fn try_from(reference: &Reference) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'_r> TryFrom<&'_r Value> for InputElement

Source§

type Error = ConversionError

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

fn try_from(value: &Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Element> for InputElement

Source§

type Error = ConversionError

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

fn try_from(value: Element) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<EventTarget> for InputElement

Source§

type Error = ConversionError

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

fn try_from(value: EventTarget) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<HtmlElement> for InputElement

Source§

type Error = ConversionError

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

fn try_from(value: HtmlElement) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<InputElement> for Reference

Source§

type Error = Void

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

fn try_from(value: InputElement) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Node> for InputElement

Source§

type Error = ConversionError

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

fn try_from(value: Node) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Reference> for InputElement

Source§

type Error = ConversionError

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

fn try_from(reference: Reference) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<Value> for InputElement

Source§

type Error = ConversionError

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

fn try_from(value: Value) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Eq for InputElement

Source§

impl JsSerialize for InputElement

Source§

impl StructuralPartialEq for InputElement

Auto Trait Implementations§

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, dst: *mut T)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> IChildNode for T
where T: IElement,

Source§

fn remove(&self)

The ChildNode.remove() method removes the object from the tree it belongs to. Read more
Source§

impl<T> IParentNode for T
where T: IElement,

Source§

fn query_selector(&self, selector: &str) -> Result<Option<Element>, SyntaxError>

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
Source§

fn query_selector_all(&self, selector: &str) -> Result<NodeList, SyntaxError>

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
Source§

impl<T> ISlotable for T
where T: IElement,

Source§

fn assigned_slot(&self) -> Option<SlotElement>

returns a SlotElement representing the <slot> element the node is inserted in. Read more
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.
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.