Repository navigation
HTML input value - #9514
HTML input value#9514
Conversation
There was a problem hiding this comment.
nit: Move these impl up to where the enum is.
|
|
Thanks for the feedback! I broke a bunch of tests in: |
|
OK, I'm stuck. 9a4b26f passes the radionodelist test and the I tried to get it test passing by setting the value to the textinput value when the type attribute changes (in |
| } else { | ||
| input.upcast::<Element>() | ||
| .get_attribute(&ns!(), &atom!("value")) | ||
| .map_or_else(|| default, |
There was a problem hiding this comment.
This looks like a .map_or() is enough, no need for .map_or_else()
|
Could you also provide step annotations for the functions that you've wrote? It's hard to follow which part of the spec you're implementing. |
| // https://html.spec.whatwg.org/multipage/#dom-input-value | ||
| fn Value(&self) -> DOMString { | ||
| self.textinput.borrow().get_content() | ||
| InputValueMode::from_input_element(&self).get_value(self) |
There was a problem hiding this comment.
I'm not sure how I missed this, but this style is kind of weird. I'd expect InputValueMode to be a field in HTMLInputElement, and this method would just be a call to self.get_value(). Here you're constructing a new InputValueMode every time you get or set the value of an HTMLInputElement, and then calling a method on the InputValueMode, supplying it with an instance of HTMLInputElement.
|
I suspect that the test failures are because of the changes between |
|
Ah! I thought only content attributes were called attributes. I made the suggested changes and the input and raidonodelist tests pass, but the implementation is wrong since I need to find out if the simple list iterator does a tree order traversal (pre-order, depth-first traversal of DOM nodes) and whether remove attribute on an |
| // assert_equals(document.getElementById("r1").value, -39); // but got string "1" | ||
|
|
||
| rdoList.value = "on"; | ||
| // expected "1" but got "2" |
There was a problem hiding this comment.
Revert changes to this file, please.
There was a problem hiding this comment.
I will. This is a WIP branch.
I just thought it was interesting, because it seems like IDL attribute has the right value before it is set to "on".
|
|
||
| // On setting, if the new value is the empty string, it | ||
| // must empty the list of selected files; otherwise, it | ||
| // must throw an InvalidStateError exception. |
There was a problem hiding this comment.
All of these annotations are unnecessary; we only need step numbers.
There was a problem hiding this comment.
I might be misreading the spec or looking in the wrong place, but I don't see any step numbers on: https://html.spec.whatwg.org/multipage/forms.html#dom-input-value
a9994e1 to
a2efef6
Compare
8fc5c64 to
7b21d8e
Compare
| |a| DOMString::from(a.summarize().value)), | ||
| ValueMode::DefaultOn => | ||
| self.upcast::<Element>() | ||
| .get_attribute(&ns!(), &atom!("value")) |
HTML input value Ready for review. Fixes #9455. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9514) <!-- Reviewable:end -->
|
💔 Test failed - linux-rel |
|
@bors-servo retry #9148 |
|
⚡ Previous build results for android, gonk, linux-dev, mac-dev-unit, mac-rel-css, mac-rel-wpt are reusable. Rebuilding only linux-rel... |
|
💔 Test failed - linux-rel |
HTML input value Ready for review. Fixes #9455. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9514) <!-- Reviewable:end -->
|
💔 Test failed - linux-rel |
HTML input value Ready for review. Fixes #9455. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9514) <!-- Reviewable:end -->
|
☀️ Test successful - android, gonk, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt |
According to step 3 of https://html.spec.whatwg.org/multipage/forms.html#input-type-change a value mode transition from non-filename to filename should update the input internal value state to the empty string. According to https://html.spec.whatwg.org/multipage/forms.html#dom-input-value a subsequent read of the value IDL attribute should return the empty string (assuming no selected files). Refs: servo/servo#9514
Ready for review.
Fixes #9455.