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/htmlinputelement.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/htmlinputelement.rs')
-rwxr-xr-x[-rw-r--r--] | components/script/dom/htmlinputelement.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index ddbd57d2438..90cf630e9fe 100644..100755 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -31,6 +31,7 @@ use dom::node::{Node, NodeDamage, UnbindContext}; use dom::node::{document_from_node, window_from_node}; use dom::nodelist::NodeList; use dom::validation::Validatable; +use dom::validitystate::ValidationFlags; use dom::virtualmethods::VirtualMethods; use html5ever_atoms::LocalName; use ipc_channel::ipc::{self, IpcSender}; @@ -1131,7 +1132,16 @@ impl VirtualMethods for HTMLInputElement { impl FormControl for HTMLInputElement {} -impl Validatable for HTMLInputElement {} +impl Validatable for HTMLInputElement { + fn is_instance_validatable(&self) -> bool { + // https://html.spec.whatwg.org/multipage/#candidate-for-constraint-validation + true + } + fn validate(&self, _validate_flags: ValidationFlags) -> bool { + // call stub methods defined in validityState.rs file here according to the flags set in validate_flags + true + } +} impl Activatable for HTMLInputElement { fn as_element(&self) -> &Element { |