Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upImplement minlength attribute for text inputs #13315
Conversation
highfive
commented
Sep 19, 2016
|
Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @connorgbrewster (or someone else) soon. |
highfive
commented
Sep 19, 2016
|
Heads up! This PR modifies the following files:
|
|
|
||
| <div style="display: none"> | ||
| <input id="none" /> | ||
| <input id="negative" type="-5" /> |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Phrohdoh
Sep 19, 2016
Author
Contributor
I thought the same but just blindly followed the maxlength example.
This comment has been minimized.
This comment has been minimized.
|
Thanks for doing this! |
| @@ -479,6 +487,12 @@ impl HTMLInputElementMethods for HTMLInputElement { | |||
| // https://html.spec.whatwg.org/multipage/#dom-input-maxlength | |||
| make_limited_int_setter!(SetMaxLength, "maxlength", DEFAULT_MAX_LENGTH); | |||
|
|
|||
| // https://html.spec.whatwg.org/multipage/#dom-input-minlength // This doesn't exist? | |||
This comment has been minimized.
This comment has been minimized.
| let minGtMax = document.getElementById("min-greater-than-max"); | ||
| assert_equals(minGtMax.minLength, 0); | ||
| assert_equals(minGtMax.minLength, minGtMax.maxLength); | ||
| }, "A minLength value greater than maxLength results in minLength = maxLength = 0"); |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Phrohdoh
Sep 19, 2016
•
Author
Contributor
I have not implemented this yet because TextInput::replace_selection(DOMString) is quite complex and I haven't worked out what it will need to look like (after doing this the rest should come easily).
This comment has been minimized.
This comment has been minimized.
cbrewster
Sep 19, 2016
Member
Ok, we can leave the test expectation as failing if you want to open an issue for it.
|
Also it looks like there are some unit tests that need to be updated after these changes. |
|
Ahh also, we should actually enforce the min length and add unit tests. (Sorry for missing that, its a Monday). relevant code: |
|
Indeed tests are desired, but
Regarding enforcing minlength @jdm and I spoke about that on IRC today and I believe the consensus was to only enforce this on form validation. If you have a greater-than-zero Is form validation not built into Servo at all at this point? |
|
Form validation is being tracked in #11444 and should be implemented by a group of students at NCSU this term. |
|
Excellent, I will try to get the unit tests working again this afternoon! |
|
@ConnorGBrewster The unit tests have been fixed. |
| function() { | ||
| document.getElementById("assign-non-numeric").minLength = "not-a-number"; | ||
| assert_equals(document.getElementById("assign-non-numeric").minLength, 0); | ||
| }, "Assigning non-numeric to minlength sets minlength to 0"); |
This comment has been minimized.
This comment has been minimized.
jdm
Sep 20, 2016
Member
As mentioned on IRC, this behaviour cannot be exposed to the web since it's not part of the specification.
This comment has been minimized.
This comment has been minimized.
|
Thank you! |
|
|
…rewster Implement minlength attribute for text inputs <!-- Please describe your changes on the following line: --> **This is not ready to be merged: I need help writing tests as I am not familiar with the methods used in the `maxlength` tests (introduced in tests/unit/script/textinput.rs).** I also need to write the `minlength-manual` test. Closes #13313 This depends on #13314 (and includes the commit from it so will need to be rebased once that patch lands). I am just looking for a quick review to make sure I am on the right path. --- <!-- 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 - [X] These changes fix #13313 <!-- Either: --> - [X] There ~~are~~ *will be* tests for these changes <!-- 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/13315) <!-- Reviewable:end -->
|
|
|
Looks like some test expectations will need updated
|
|
@bors-servo r=ConnorGBrewster |
|
|
…rewster Implement minlength attribute for text inputs <!-- Please describe your changes on the following line: --> **This is not ready to be merged: I need help writing tests as I am not familiar with the methods used in the `maxlength` tests (introduced in tests/unit/script/textinput.rs).** I also need to write the `minlength-manual` test. Closes #13313 This depends on #13314 (and includes the commit from it so will need to be rebased once that patch lands). I am just looking for a quick review to make sure I am on the right path. --- <!-- 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 - [X] These changes fix #13313 <!-- Either: --> - [X] There ~~are~~ *will be* tests for these changes <!-- 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/13315) <!-- Reviewable:end -->
|
|
|
Well.. that is an odd failure.
Looks like I need to update the proto.
|
|
You only changed HTMLInputElement; those failure relate to HTMLTextAreaElement. |
|
Indeed but these are not the same errors. |
|
@bors-servo: r=ConnorGBrewster |
|
|
…rewster Implement minlength attribute for text inputs <!-- Please describe your changes on the following line: --> **This is not ready to be merged: I need help writing tests as I am not familiar with the methods used in the `maxlength` tests (introduced in tests/unit/script/textinput.rs).** I also need to write the `minlength-manual` test. Closes #13313 This depends on #13314 (and includes the commit from it so will need to be rebased once that patch lands). I am just looking for a quick review to make sure I am on the right path. --- <!-- 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 - [X] These changes fix #13313 <!-- Either: --> - [X] There ~~are~~ *will be* tests for these changes <!-- 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/13315) <!-- Reviewable:end -->
|
|
|
Awesome! |
Phrohdoh commentedSep 19, 2016
•
edited
This is not ready to be merged:
I need help writing tests as I am not familiar with the methods used in the
maxlengthtests (introduced in tests/unit/script/textinput.rs).I also need to write the
minlength-manualtest.Closes #13313
This depends on #13314 (and includes the commit from it so will need to be rebased once that patch lands).
I am just looking for a quick review to make sure I am on the right path.
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsarewill be tests for these changesThis change is