mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Implement value sanitization on HTMLInputElement
This commit is contained in:
parent
9d60333af9
commit
8203605c04
13 changed files with 187 additions and 285 deletions
|
@ -754,6 +754,18 @@ impl<T: ClipboardProvider> TextInput<T> {
|
|||
DOMString::from(content)
|
||||
}
|
||||
|
||||
/// Get a reference to the contents of a single-line text input. Panics if self is a multiline input.
|
||||
pub fn single_line_content(&self) -> &DOMString {
|
||||
assert!(!self.multiline);
|
||||
&self.lines[0]
|
||||
}
|
||||
|
||||
/// Get a mutable reference to the contents of a single-line text input. Panics if self is a multiline input.
|
||||
pub fn single_line_content_mut(&mut self) -> &mut DOMString {
|
||||
assert!(!self.multiline);
|
||||
&mut self.lines[0]
|
||||
}
|
||||
|
||||
/// Set the current contents of the text input. If this is control supports multiple lines,
|
||||
/// any \n encountered will be stripped and force a new logical line.
|
||||
pub fn set_content(&mut self, content: DOMString) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue