diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2015-05-02 13:39:54 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2015-05-14 18:28:42 +0200 |
commit | 69220dfc10537ac935fbdefec8906f0e12657f0f (patch) | |
tree | d9a879cacfe37425d583dcfda427434e22833cc1 /components/script/dom/htmlformelement.rs | |
parent | 70e67d5e11751159fd85555d3f08cc173e321e41 (diff) | |
download | servo-69220dfc10537ac935fbdefec8906f0e12657f0f.tar.gz servo-69220dfc10537ac935fbdefec8906f0e12657f0f.zip |
Make HTMLFormElement name attribute use an atom
Diffstat (limited to 'components/script/dom/htmlformelement.rs')
-rw-r--r-- | components/script/dom/htmlformelement.rs | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index f926b521f5c..3d6ad028ab7 100644 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -2,15 +2,20 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use dom::attr::AttrValue; use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods; use dom::bindings::codegen::Bindings::EventBinding::EventMethods; use dom::bindings::codegen::Bindings::HTMLFormElementBinding; use dom::bindings::codegen::Bindings::HTMLFormElementBinding::HTMLFormElementMethods; use dom::bindings::codegen::Bindings::HTMLInputElementBinding::HTMLInputElementMethods; use dom::bindings::codegen::Bindings::HTMLButtonElementBinding::HTMLButtonElementMethods; -use dom::bindings::codegen::InheritTypes::{EventTargetCast, HTMLFormElementDerived, NodeCast}; -use dom::bindings::codegen::InheritTypes::{HTMLInputElementCast, HTMLTextAreaElementCast}; -use dom::bindings::codegen::InheritTypes::{HTMLFormElementCast, HTMLDataListElementCast}; +use dom::bindings::codegen::InheritTypes::EventTargetCast; +use dom::bindings::codegen::InheritTypes::HTMLDataListElementCast; +use dom::bindings::codegen::InheritTypes::HTMLElementCast; +use dom::bindings::codegen::InheritTypes::HTMLFormElementCast; +use dom::bindings::codegen::InheritTypes::HTMLFormElementDerived; +use dom::bindings::codegen::InheritTypes::HTMLInputElementCast; +use dom::bindings::codegen::InheritTypes::{HTMLTextAreaElementCast, NodeCast}; use dom::bindings::global::GlobalRef; use dom::bindings::js::{JSRef, OptionalRootable, Rootable, Temporary}; use dom::document::{Document, DocumentHelpers}; @@ -23,6 +28,7 @@ use dom::htmlinputelement::{HTMLInputElement, HTMLInputElementHelpers}; use dom::htmlbuttonelement::{HTMLButtonElement}; use dom::htmltextareaelement::HTMLTextAreaElementHelpers; use dom::node::{Node, NodeHelpers, NodeTypeId, document_from_node, window_from_node}; +use dom::virtualmethods::VirtualMethods; use hyper::method::Method; use hyper::header::ContentType; use hyper::mime; @@ -107,9 +113,7 @@ impl<'a> HTMLFormElementMethods for JSRef<'a, HTMLFormElement> { // https://html.spec.whatwg.org/multipage/#dom-form-name make_getter!(Name); - - // https://html.spec.whatwg.org/multipage/#dom-form-name - make_setter!(SetName, "name"); + make_atomic_setter!(SetName, "name"); // https://html.spec.whatwg.org/multipage/#dom-fs-novalidate make_bool_getter!(NoValidate); @@ -559,3 +563,16 @@ pub trait FormControl<'a> : Copy + Sized { fn to_element(self) -> JSRef<'a, Element>; } + +impl<'a> VirtualMethods for JSRef<'a, HTMLFormElement> { + fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> { + Some(HTMLElementCast::from_borrowed_ref(self) as &VirtualMethods) + } + + fn parse_plain_attribute(&self, name: &Atom, value: DOMString) -> AttrValue { + match name { + &atom!("name") => AttrValue::from_atomic(value), + _ => self.super_type().unwrap().parse_plain_attribute(name, value), + } + } +} |