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 HTMLTableRowElement insertCell and deleteCell #7977
Conversation
| use dom::htmlelement::HTMLElement; | ||
| use dom::node::Node; | ||
| use std::iter; | ||
|
|
This comment has been minimized.
This comment has been minimized.
frewsxcv
Oct 12, 2015
Author
Member
So I'm not a huge fan with how these generic functions turned out. If anyone has any suggestions to clean these up, let me know
| } | ||
|
|
||
| let node = NodeCast::from_ref(this); | ||
| let tr = new_child(node); |
This comment has been minimized.
This comment has been minimized.
eefriedman
Oct 12, 2015
Contributor
It would be a bit simpler to just unconditionally build the child in the caller.
| match last_child.and_then(|node| node.inclusively_preceding_siblings() | ||
| .filter_map(ElementCast::to_root) | ||
| .filter(|elem| is_delete_type(elem)) | ||
| .next()) { |
This comment has been minimized.
This comment has been minimized.
eefriedman
Oct 12, 2015
Contributor
This would be a lot simpler in both the caller and callee if you could just write let last_child = get_items().LastItem();. (I know it doesn't exist at the moment, but it could be added.)
| .filter(|elem| is_delete_type(elem)) | ||
| .next()) { | ||
| Some(element) => element, | ||
| None => return Ok(()), |
This comment has been minimized.
This comment has been minimized.
eefriedman
Oct 12, 2015
Contributor
https://html.spec.whatwg.org/multipage/tables.html#dom-table-deleterow explicitly says this should throw.
This comment has been minimized.
This comment has been minimized.
eefriedman
Oct 12, 2015
Contributor
Err, oops, that isn't actually the algorithm you're implementing here... that said, I would tend towards the interpretation that it's an unintentional hole in the deleteRow/deleteCell definitions: "remove the last element in the rows collection" makes no sense if the rows collection is empty.
(For reference, it looks like Chrome throws, but Firefox doesn't.)
|
Do file a spec issue on the hole. |
|
Spec issue filed: whatwg/html#248 |
|
@eefriedman I've noticed you've been doing drive-by reviews in a bunch of PRs recently (thanks!). Would you be interested in doing a complete review of these changes in Reviewable? |
|
Review status: 0 of 9 files reviewed at latest revision, 4 unresolved discussions, all commit checks successful. tests/wpt/web-platform-tests/html/semantics/tabular-data/the-tr-element/deleteCell.html, line 52 [r1] (raw file): Comments from the review on Reviewable.io |
|
Reviewed 9 of 9 files at r1. Comments from the review on Reviewable.io |
|
|
|
components/script/dom/utils.rs, line 34 [r1] (raw file): Comments from the review on Reviewable.io |
|
tests/wpt/web-platform-tests/html/semantics/tabular-data/the-tr-element/deleteCell.html, line 52 [r1] (raw file): Comments from the review on Reviewable.io |
abbb54e
to
c3d8fdc
c3d8fdc
to
9e79cce
|
I did a little refactoring and got rid of the |
|
Reviewed 1 of 9 files at r1. tests/wpt/web-platform-tests/html/semantics/tabular-data/the-tr-element/deleteCell.html, line 52 [r1] (raw file): Comments from the review on Reviewable.io |
|
|
9e79cce
to
1f58169
|
Merge conflicts addressed in the latest force push. @eefriedman did you have any other comments? |
|
Maybe we should follow the predicted direction of whatwg/html#248 ? Otherwise looks good. |
|
I'd rather implement the current spec behaviour and update accordingly after the spec is changed. |
|
@bors-servo: r=eefriedman |
|
|
…ell, r=eefriedman Implement HTMLTableRowElement insertCell and deleteCell <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7977) <!-- Reviewable:end -->
|
|
|
@bors-servo retry |
|
|
|
|
frewsxcv commentedOct 12, 2015