diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-11-25 06:49:44 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-25 06:49:44 -0800 |
commit | beec035eb0ff6babf48ce836184329e60e795177 (patch) | |
tree | eb068bd81c2a2ffe802398bb521d9ed2beadf21d /components/script/dom/htmlbuttonelement.rs | |
parent | 67a4ecd68ec782fd661c0095df1e7f75e79a5d84 (diff) | |
parent | 2a408778518050d3632ad5c2694a96ae0b219cd9 (diff) | |
download | servo-beec035eb0ff6babf48ce836184329e60e795177.tar.gz servo-beec035eb0ff6babf48ce836184329e60e795177.zip |
Auto merge of #13969 - bbansalWolfPack:master, r=jdm
html form validation initial steps with test html file
<!-- Please describe your changes on the following line: -->
Added code for initial steps in html form validation.
1. Added methods for trait validatable
2. implemented stub methods for elements like HTMLInputElement, HTMLButtonElement, etc
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X ] `./mach build -d` does not report any errors
- [ X] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).
<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13969)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/htmlbuttonelement.rs')
-rwxr-xr-x[-rw-r--r--] | components/script/dom/htmlbuttonelement.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/components/script/dom/htmlbuttonelement.rs b/components/script/dom/htmlbuttonelement.rs index b309da6466a..f266f0236c5 100644..100755 --- a/components/script/dom/htmlbuttonelement.rs +++ b/components/script/dom/htmlbuttonelement.rs @@ -21,7 +21,7 @@ use dom::htmlformelement::HTMLFormElement; use dom::node::{Node, UnbindContext, document_from_node, window_from_node}; use dom::nodelist::NodeList; use dom::validation::Validatable; -use dom::validitystate::ValidityState; +use dom::validitystate::{ValidityState, ValidationFlags}; use dom::virtualmethods::VirtualMethods; use html5ever_atoms::LocalName; use std::cell::Cell; @@ -238,7 +238,16 @@ impl VirtualMethods for HTMLButtonElement { impl FormControl for HTMLButtonElement {} -impl Validatable for HTMLButtonElement {} +impl Validatable for HTMLButtonElement { + fn is_instance_validatable(&self) -> bool { + true + } + fn validate(&self, validate_flags: ValidationFlags) -> bool { + if validate_flags.is_empty() {} + // Need more flag check for different validation types later + true + } +} impl Activatable for HTMLButtonElement { fn as_element(&self) -> &Element { |