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 deleteRow and insertRow for table section elements #7854
Conversation
1eb0360
to
2e2e972
|
-S-awaiting-review +S-needs-code-changes Reviewed 5 of 5 files at r1. components/script/dom/htmltablesectionelement.rs, line 12 [r1] (raw file): components/script/dom/htmltablesectionelement.rs, line 81 [r1] (raw file): components/script/dom/htmltablesectionelement.rs, line 92 [r1] (raw file): components/script/dom/htmltablesectionelement.rs, line 109 [r1] (raw file): Comments from the review on Reviewable.io |
|
components/script/dom/htmltablesectionelement.rs, line 109 [r1] (raw file):
What would be the best way of doing this? Make Comments from the review on Reviewable.io |
|
Review status: all files reviewed at latest revision, 4 unresolved discussions, all commit checks successful. components/script/dom/htmltablesectionelement.rs, line 109 [r1] (raw file): Comments from the review on Reviewable.io |
2e2e972
to
d439c8b
|
Addressed all the comments. |
|
Hm, it actually doesn't work in one case. I'll add a regression test. |
d439c8b
to
ade92b5
|
Okay, force pushed. Let me know how that looks. |
ade92b5
to
56a919d
| return Ok(HTMLElementCast::from_root(tr)); | ||
| } | ||
|
|
||
| return Err(Error::IndexSize) |
This comment has been minimized.
This comment has been minimized.
eefriedman
Oct 9, 2015
Contributor
The explicit for loop and indexing is a little difficult to understand at first glance... maybe something like this would be more clear? Or am I going too far down the path of iterator chaining?
let element = self.Rows()
.elements_iter()
.map(|r| Some(r)))
.chain(iter::once(None))
.nth(index);
match element {
None => Err(Error::IndexSize),
Some(None) => {
try!(self_node.AppendChild(NodeCast::from_ref(tr.r())));
Ok(HTMLElementCast::from_root(tr))
}
Some(element) => {
try!(self_node.InsertBefore(NodeCast::from_ref(tr.r()),
Some(NodeCast::from_root(element)).r()));
Ok(HTMLElementCast::from_root(tr))
}
}
This comment has been minimized.
This comment has been minimized.
frewsxcv
Oct 9, 2015
Author
Member
So I saw your solution, but decided I wasn't a fan of the nested Options, so I changed it up a little bit. Check out my latest force push and let me know what you think
This comment has been minimized.
This comment has been minimized.
5adb835
to
7a03666
|
-S-awaiting-review +I-spec-unclear +S-needs-code-changes Reviewed 3 of 4 files at r2. components/script/dom/htmlcollection.rs, line 163 [r2] (raw file): components/script/dom/htmltablesectionelement.rs, line 86 [r2] (raw file): components/script/dom/htmltablesectionelement.rs, line 87 [r2] (raw file): components/script/dom/htmltablesectionelement.rs, line 109 [r2] (raw file): let before_child = self.Rows().elements().nth(index).and_then(|row|{
NodeCast::from_ref(&row).GetNextSibling()
});
try!(node.InsertBefore(NodeCast::from_ref(&tr), before_child.r());
Ok(HTMLElementCast::from_root(tr))components/script/dom/htmltablesectionelement.rs, line 119 [r2] (raw file):
Not sure if that's intended or not. If it is, you can make all that code a Comments from the review on Reviewable.io |
|
Review status: 5 of 7 files reviewed at latest revision, 6 unresolved discussions, all commit checks successful. components/script/dom/htmltablesectionelement.rs, line 109 [r2] (raw file): Comments from the review on Reviewable.io |
|
Err, didn't review the latest revision… Fortunately, my remarks still stand. Reviewed 1 of 4 files at r2, 1 of 1 files at r3. Comments from the review on Reviewable.io |
7a03666
to
3d383f2
|
Comments have been addressed. |
|
@bors-servo r+ Reviewed 4 of 4 files at r4. Comments from the review on Reviewable.io |
|
|
…terow, r=nox Implement deleteRow and insertRow for <table> element Continued from #6936 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7854) <!-- Reviewable:end -->
|
|
frewsxcv commentedOct 4, 2015
Continued from #6936