Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/webapi/element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,28 @@ pub trait IElement: INode + IParentNode + IChildNode + ISlotable {
}
}

/// The Element.clientWidth property is zero for inline elements and elements with no CSS;
/// otherwise, it's the inner width of an element in pixels. It includes padding but excludes
/// borders, margins, and vertical scrollbars (if present).
///
/// [(Javascript docs)](https://developer.mozilla.org/en-US/docs/Web/API/Element/clientWidth)
fn client_width( &self ) -> i32 {
js!(
return @{self.as_ref()}.clientWidth;
).try_into().unwrap()
}

/// The Element.clientHeight read-only property is zero for elements with no CSS or inline
/// layout boxes; otherwise, it's the inner height of an element in pixels. It includes padding
/// but excludes borders, margins, and horizontal scrollbars (if present).
///
/// [(Javascript docs)](https://developer.mozilla.org/en-US/docs/Web/API/Element/clientHeight)
fn client_height( &self ) -> i32 {
js!(
return @{self.as_ref()}.clientHeight;
).try_into().unwrap()
}

/// Request this element and its children be made fullscreen
///
/// Note: this may only be called during a user interaction.
Expand Down