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 upParse HTMLInputElement attributes #10962
Conversation
highfive
commented
May 2, 2016
highfive
commented
May 2, 2016
| @@ -862,6 +862,8 @@ impl VirtualMethods for HTMLInputElement { | |||
| fn parse_plain_attribute(&self, name: &Atom, value: DOMString) -> AttrValue { | |||
| match name { | |||
| &atom!("accept") => AttrValue::from_comma_separated_tokenlist(value), | |||
| &atom!("alt") | | |||
| &atom!("dirname") => AttrValue::String(value), | |||
This comment has been minimized.
This comment has been minimized.
|
Review status: 0 of 4 files reviewed at latest revision, 10 unresolved discussions. components/script/dom/htmlinputelement.rs, line 454 [r6] (raw file): Can components/script/dom/htmlinputelement.rs, line 457 [r6] (raw file): components/script/dom/htmlinputelement.rs, line 459 [r6] (raw file): components/script/dom/htmlinputelement.rs, line 461 [r6] (raw file): components/script/dom/htmlinputelement.rs, line 474 [r6] (raw file): components/script/dom/htmlinputelement.rs, line 516 [r6] (raw file): components/script/dom/htmlinputelement.rs, line 523 [r6] (raw file): components/script/dom/htmlinputelement.rs, line 529 [r6] (raw file): components/script/dom/htmlinputelement.rs, line 531 [r6] (raw file): Comments from Reviewable |
|
Review status: 0 of 4 files reviewed at latest revision, 10 unresolved discussions. components/script/dom/htmlinputelement.rs, line 459 [r6] (raw file): components/script/dom/htmlinputelement.rs, line 461 [r6] (raw file): components/script/dom/htmlinputelement.rs, line 516 [r6] (raw file): components/script/dom/htmlinputelement.rs, line 531 [r6] (raw file): Comments from Reviewable |
651bd7b
to
e9cc748
| // https://html.spec.whatwg.org/multipage/#dom-input-step | ||
| fn SetStep(&self, value: DOMString) { | ||
| let element = self.upcast::<Element>(); | ||
| if &*value.to_lowercase() == "any" { |
This comment has been minimized.
This comment has been minimized.
frewsxcv
May 3, 2016
Member
You could use AsciiExt::eq_ignore_ascii_case if you wanted to avoid a heap allocation here
| return; | ||
| } | ||
|
|
||
| let value = match self.type_() { |
This comment has been minimized.
This comment has been minimized.
frewsxcv
May 3, 2016
Member
If you wanted to DRY this out, you could have the match just return the number
|
Reviewed 1 of 1 files at r9. components/script/dom/htmlinputelement.rs, line 459 [r6] (raw file):
|
|
Review status: 1 of 4 files reviewed at latest revision, 10 unresolved discussions. components/script/dom/htmlinputelement.rs, line 531 [r6] (raw file):
|
highfive
commented
May 12, 2016
|
New code was committed to pull request. |
|
Review status: 0 of 4 files reviewed at latest revision, 10 unresolved discussions. components/script/dom/htmlinputelement.rs, line 531 [r6] (raw file):
|
highfive
commented
May 12, 2016
|
New code was committed to pull request. |
|
Reviewed 2 of 3 files at r2, 1 of 3 files at r11, 1 of 1 files at r12, 1 of 1 files at r15. components/script/dom/htmlinputelement.rs, line 531 [r6] (raw file):
|
|
|
|
@KiChjang any news? |
|
I'm in fact working on this, it's been rebased, but now i'm thinking of storing min, max and step as DOMStrings, and then add special logic for getters. |
|
Does this not get rid of most of the advantage of storing them as numbers? Could we store them as numbers where possible, and as DOMStrings otherwise? (Dates/Times might be better stored as an Instant, but we may hit spec issues around that.) |
|
So, after some discussion on #whatwg, I discovered that there are parts of the spec that are not intended for implementors of HTML to read, e.g. the following paragraph:
is intended for developers wanting to understand how to use the input element in their frontend code, and implementors (us) need not worry about the provided step value being valid floating-point. All we need to do in such a case is simply to reflect the content attribute of min, max and step, as shown in https://html.spec.whatwg.org/multipage/forms.html#dom-input-min, i.e. the behaviour as witnessed in FF and CR are correct. |
highfive
commented
May 21, 2016
|
New code was committed to pull request. |
highfive
commented
May 21, 2016
|
New code was committed to pull request. |
|
A couple of minor nits, at this point you can r=me after fixing and squashing.
|
|
|
21c3f85
to
aad8036
|
@bors-servo r=asajeffrey |
|
|
Parse HTMLInputElement attributes Fixes #10491. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10962) <!-- Reviewable:end -->
|
|
highfive
commented
May 24, 2016
|
|
Well, that's a good failure to have, lots of tests passing which were failing before. |
highfive
commented
May 24, 2016
|
New code was committed to pull request. |
|
@bors-servo r=asajeffrey |
|
|
Parse HTMLInputElement attributes Fixes #10491. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10962) <!-- Reviewable:end -->
|
|
KiChjang commentedMay 2, 2016
•
edited by larsbergstrom
Fixes #10491.
This change is