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 upAdd is_mathml_annotation_xml_integration_point method #186
Conversation
| for it in 0..attrs.len() { | ||
| match attrs[it].name { | ||
| qualname!(html, "encoding") => { | ||
| return new_node(Element(name, AnnotationXml(attrs[it].value.to_lowercase() == "text/html"), attrs)); |
This comment has been minimized.
This comment has been minimized.
| @@ -45,6 +45,7 @@ pub enum ElementEnum { | |||
| /// A template element and its template contents. | |||
| /// https://html.spec.whatwg.org/multipage/#template-contents | |||
| Template(Handle), | |||
| AnnotationXml(bool), | |||
This comment has been minimized.
This comment has been minimized.
SimonSapin
Jan 5, 2016
Member
What does it mean for an element to "be" this variant? Is it exclusive with other variants? What does the boolean mean? Consider using a struct-like variant in order to name the boolean. Please add a doc-comment with a link to the relevant section of spec.
This comment has been minimized.
This comment has been minimized.
GuillaumeGomez
Jan 5, 2016
Author
Contributor
I didn't add comments yet, it was just supposed to be a first shot to get help. on some details before finishing it. I should have precised, my bad.
|
|
||
| // Returns true if the adjusted current node is an HTML integration point | ||
| // and the token is a start tag | ||
| fn is_mathml_annotation_xml_integration_point(&self) -> bool; |
This comment has been minimized.
This comment has been minimized.
nox
Jan 5, 2016
Member
This should take a Self::Handle and that's the thing on which you check whether it is an integration point or not.
| @@ -303,6 +312,13 @@ impl TreeSink for RcDom { | |||
| panic!("not a script element!"); | |||
| } | |||
| } | |||
|
|
|||
| fn is_mathml_annotation_xml_integration_point(&self) -> bool { | |||
| match (**self.document).borrow().node { | |||
This comment has been minimized.
This comment has been minimized.
nox
Jan 5, 2016
Member
The thing you need to check is the given Handle that needs to be passed to the method.
|
Ok, I updated the current code @nox. |
| fn is_mathml_annotation_xml_integration_point(&self, handle: &Self::Handle) -> bool { | ||
| match (**handle).borrow().node { | ||
| Element(_, AnnotationXml(ret), _) => ret, | ||
| _ => false, |
This comment has been minimized.
This comment has been minimized.
| } | ||
| _ => continue, | ||
| } | ||
| } |
This comment has been minimized.
This comment has been minimized.
nox
Jan 6, 2016
Member
This should be in the match expression defining info below, for qualname!(mathml, "annotation-xml") elements.
|
Anything else to add/update? |
| @@ -901,11 +901,15 @@ impl<Handle, Sink> TreeBuilderActions<Handle> | |||
|
|
|||
| if let qualname!(mathml, "annotation-xml") = name { | |||
| if let TagToken(Tag { kind: StartTag, name: atom!("svg"), .. }) = *token { | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
||
| // Returns true if the adjusted current node is an HTML integration point | ||
| // and the token is a start tag | ||
| fn is_mathml_annotation_xml_integration_point(&self, handle: &Self::Handle) -> bool { |
This comment has been minimized.
This comment has been minimized.
nox
Jan 10, 2016
Member
This should take Self::Handle, and you should clone handles when passing them.
|
@bors-servo r+ |
|
|
Add is_mathml_annotation_xml_integration_point method r? @nox <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/html5ever/186) <!-- Reviewable:end -->
|
|
GuillaumeGomez commentedJan 4, 2016
r? @nox
#119