Skip to content

Commit

Permalink
Implement HTMLInputElement cloning steps
Browse files Browse the repository at this point in the history
  • Loading branch information
teapotd committed Dec 26, 2019
1 parent 8002c6b commit 386dc9f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 71 deletions.
22 changes: 21 additions & 1 deletion components/script/dom/htmlinputelement.rs
Expand Up @@ -35,7 +35,7 @@ use crate::dom::htmlformelement::{ResetFrom, SubmittedFrom};
use crate::dom::keyboardevent::KeyboardEvent;
use crate::dom::mouseevent::MouseEvent;
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::textcontrol::{TextControlElement, TextControlSelection};
use crate::dom::validation::Validatable;
Expand Down Expand Up @@ -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 {
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 386dc9f

Please sign in to comment.