aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/validitystate.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/script/dom/validitystate.rs')
-rw-r--r--src/components/script/dom/validitystate.rs42
1 files changed, 27 insertions, 15 deletions
diff --git a/src/components/script/dom/validitystate.rs b/src/components/script/dom/validitystate.rs
index 042d41a829a..15c654fc814 100644
--- a/src/components/script/dom/validitystate.rs
+++ b/src/components/script/dom/validitystate.rs
@@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::BindingDeclarations::ValidityStateBinding;
-use dom::bindings::js::JS;
+use dom::bindings::js::{JS, JSRef, Temporary};
use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::window::Window;
@@ -15,55 +15,67 @@ pub struct ValidityState {
}
impl ValidityState {
- pub fn new_inherited(window: JS<Window>) -> ValidityState {
+ pub fn new_inherited(window: &JSRef<Window>) -> ValidityState {
ValidityState {
reflector_: Reflector::new(),
- window: window,
+ window: window.unrooted(),
state: 0,
}
}
- pub fn new(window: &JS<Window>) -> JS<ValidityState> {
- reflect_dom_object(~ValidityState::new_inherited(window.clone()),
+ pub fn new(window: &JSRef<Window>) -> Temporary<ValidityState> {
+ reflect_dom_object(~ValidityState::new_inherited(window),
window,
ValidityStateBinding::Wrap)
}
}
-impl ValidityState {
- pub fn ValueMissing(&self) -> bool {
+pub trait ValidityStateMethods {
+ fn ValueMissing(&self) -> bool;
+ fn TypeMismatch(&self) -> bool;
+ fn PatternMismatch(&self) -> bool;
+ fn TooLong(&self) -> bool;
+ fn RangeUnderflow(&self) -> bool;
+ fn RangeOverflow(&self) -> bool;
+ fn StepMismatch(&self) -> bool;
+ fn CustomError(&self) -> bool;
+ fn Valid(&self) -> bool;
+}
+
+impl<'a> ValidityStateMethods for JSRef<'a, ValidityState> {
+ fn ValueMissing(&self) -> bool {
false
}
- pub fn TypeMismatch(&self) -> bool {
+ fn TypeMismatch(&self) -> bool {
false
}
- pub fn PatternMismatch(&self) -> bool {
+ fn PatternMismatch(&self) -> bool {
false
}
- pub fn TooLong(&self) -> bool {
+ fn TooLong(&self) -> bool {
false
}
- pub fn RangeUnderflow(&self) -> bool {
+ fn RangeUnderflow(&self) -> bool {
false
}
- pub fn RangeOverflow(&self) -> bool {
+ fn RangeOverflow(&self) -> bool {
false
}
- pub fn StepMismatch(&self) -> bool {
+ fn StepMismatch(&self) -> bool {
false
}
- pub fn CustomError(&self) -> bool {
+ fn CustomError(&self) -> bool {
false
}
- pub fn Valid(&self) -> bool {
+ fn Valid(&self) -> bool {
true
}
}