mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Implement HTMLInputElement cloning steps
This commit is contained in:
parent
8002c6bc53
commit
386dc9fd75
3 changed files with 21 additions and 71 deletions
|
@ -35,7 +35,7 @@ use crate::dom::htmlformelement::{ResetFrom, SubmittedFrom};
|
||||||
use crate::dom::keyboardevent::KeyboardEvent;
|
use crate::dom::keyboardevent::KeyboardEvent;
|
||||||
use crate::dom::mouseevent::MouseEvent;
|
use crate::dom::mouseevent::MouseEvent;
|
||||||
use crate::dom::node::{document_from_node, window_from_node};
|
use crate::dom::node::{document_from_node, window_from_node};
|
||||||
use crate::dom::node::{BindContext, Node, NodeDamage, UnbindContext};
|
use crate::dom::node::{BindContext, CloneChildrenFlag, Node, NodeDamage, UnbindContext};
|
||||||
use crate::dom::nodelist::NodeList;
|
use crate::dom::nodelist::NodeList;
|
||||||
use crate::dom::textcontrol::{TextControlElement, TextControlSelection};
|
use crate::dom::textcontrol::{TextControlElement, TextControlSelection};
|
||||||
use crate::dom::validation::Validatable;
|
use crate::dom::validation::Validatable;
|
||||||
|
@ -1659,6 +1659,26 @@ impl VirtualMethods for HTMLInputElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#the-input-element%3Aconcept-node-clone-ext
|
||||||
|
fn cloning_steps(
|
||||||
|
&self,
|
||||||
|
copy: &Node,
|
||||||
|
maybe_doc: Option<&Document>,
|
||||||
|
clone_children: CloneChildrenFlag,
|
||||||
|
) {
|
||||||
|
if let Some(ref s) = self.super_type() {
|
||||||
|
s.cloning_steps(copy, maybe_doc, clone_children);
|
||||||
|
}
|
||||||
|
let elem = copy.downcast::<HTMLInputElement>().unwrap();
|
||||||
|
elem.value_dirty.set(self.value_dirty.get());
|
||||||
|
elem.checked_changed.set(self.checked_changed.get());
|
||||||
|
elem.upcast::<Element>()
|
||||||
|
.set_state(ElementState::IN_CHECKED_STATE, self.Checked());
|
||||||
|
elem.textinput
|
||||||
|
.borrow_mut()
|
||||||
|
.set_content(self.textinput.borrow().get_content());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FormControl for HTMLInputElement {
|
impl FormControl for HTMLInputElement {
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
[clone.html]
|
|
||||||
type: testharness
|
|
||||||
[Checkbox must retain checked state.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Checkbox must retain unchecked state.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Radiobutton must retain checked state.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Radiobutton must retain unchecked state.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Text field must retain changed value.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Search field must retain changed value.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Phone number field must retain changed value.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[URL field must retain changed value.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Email field must retain changed value.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Password field must retain changed value.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Date field must retain changed value.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Month field must retain changed value.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Week field must retain changed value.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Time field must retain changed value.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Datetime (local) field must retain changed value.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Number field must retain changed value.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Range control must retain changed value.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Color picker must retain changed value.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
[cloning-steps.html]
|
|
||||||
type: testharness
|
|
||||||
[input element's value should be cloned]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[input element's dirty value flag should be cloned, so setAttribute doesn't affect the cloned input's value]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[input element's checkedness should be cloned]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[input element's dirty checkedness should be cloned, so setAttribute doesn't affect the cloned input's checkedness]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue