Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor html form dataset collection #7892

Merged
merged 1 commit into from Oct 7, 2015

Conversation

@anthgur
Copy link
Contributor

anthgur commented Oct 6, 2015

Factor out FormDatum collection for <input>
Improve early return logic for getting the FormDatum from an <input>
Condense element type patterns

Proposed to close #7851

Review on Reviewable

@anthgur anthgur force-pushed the anthgur:form-data-refactor branch from fe919ee to 11402b5 Oct 6, 2015
@jdm
Copy link
Member

jdm commented Oct 7, 2015

Great work! Thanks for fixing the TODO about button submitters, too :) Just a few changes required to merge this now.
-S-awaiting-review +S-needs-code-changes


Reviewed 2 of 2 files at r1.
Review status: all files reviewed at latest revision, 5 unresolved discussions, all commit checks successful.


components/script/dom/htmlformelement.rs, line 234 [r1] (raw file):
This comment belongs above the traverse_preorder call below, like in the original code.


components/script/dom/htmlformelement.rs, line 238 [r1] (raw file):
Let's move this comment to the line following the .collect() like in the original code.


components/script/dom/htmlformelement.rs, line 244 [r1] (raw file):
Please indent this like the original code.


components/script/dom/htmlformelement.rs, line 246 [r1] (raw file):
nit: this should be at the same indentation level as the if


components/script/dom/htmlinputelement.rs, line 452 [r1] (raw file):
I think this code could be written more clearly as:

if ty == "radio" || ty == "checkbox" {
    if value.is_empty() {
        value = "on".to_owned();
    }
}
Some(FormDatum {
    ty: ty,
    name: name,
    value: value,
})

Comments from the review on Reviewable.io

@anthgur
Copy link
Contributor Author

anthgur commented Oct 7, 2015

@jdm thanks, fixed! Had to enclose the chained conditionals in parens for the compiler.

@jdm
Copy link
Member

jdm commented Oct 7, 2015

-S-awaiting-review +S-needs-code-changes


Reviewed 2 of 2 files at r2.
Review status: all files reviewed at latest revision, 1 unresolved discussion, all commit checks successful.


components/script/dom/htmlinputelement.rs, line 437 [r2] (raw file):
This should be ||, and that will allow us to remove the ()s.


Comments from the review on Reviewable.io

@anthgur
Copy link
Contributor Author

anthgur commented Oct 7, 2015

@jdm ah, is that a bitwise or when it's not in a match block?

@jdm
Copy link
Member

jdm commented Oct 7, 2015

Correct.

@jdm
Copy link
Member

jdm commented Oct 7, 2015

Looks good! Go ahead and squash the commits into one!
-S-awaiting-review +S-needs-squash


Reviewed 1 of 1 files at r3.
Review status: :shipit: all files reviewed at latest revision, all discussions resolved, all commit checks successful.


Comments from the review on Reviewable.io

@jdm jdm added S-needs-squash and removed S-awaiting-review labels Oct 7, 2015
Factor out FormDatum collection for <input>
Improve early return logic for getting the FormDatum from an <input>
Condense element type patterns
@anthgur anthgur force-pushed the anthgur:form-data-refactor branch from a3a1731 to 31980a7 Oct 7, 2015
@jdm
Copy link
Member

jdm commented Oct 7, 2015

@bors-servo
Copy link
Contributor

bors-servo commented Oct 7, 2015

📌 Commit 31980a7 has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Oct 7, 2015

Testing commit 31980a7 with merge 94dc987...

bors-servo pushed a commit that referenced this pull request Oct 7, 2015
Refactor html form dataset collection

Factor out FormDatum collection for `<input>`
Improve early return logic for getting the FormDatum from an `<input>`
Condense element type patterns

Proposed to close #7851

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7892)
<!-- Reviewable:end -->
@jdm jdm added the S-needs-squash label Oct 7, 2015
@jdm jdm removed the S-needs-squash label Oct 7, 2015
@bors-servo
Copy link
Contributor

bors-servo commented Oct 7, 2015

💔 Test failed - mac-rel-css

@jdm
Copy link
Member

jdm commented Oct 7, 2015

@bors-servo
Copy link
Contributor

bors-servo commented Oct 7, 2015

Previous build results for android, gonk, linux-dev, linux-rel, mac-dev-ref-unit, mac-rel-wpt are reusable. Rebuilding only mac-rel-css...

@bors-servo
Copy link
Contributor

bors-servo commented Oct 7, 2015

@bors-servo bors-servo merged commit 31980a7 into servo:master Oct 7, 2015
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

5 participants
You can’t perform that action at this time.