aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/servoparser/html.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2019-01-03 16:24:49 -0500
committerGitHub <noreply@github.com>2019-01-03 16:24:49 -0500
commit7c34a70ca8d2087e5d1b7b29ae128b803cecacf9 (patch)
tree356ef8245943b16168fdd18f6bbd84948aa090d0 /components/script/dom/servoparser/html.rs
parentde09c8fb6ef87dec5932d5fab4adcb421d291a54 (diff)
parenta2d5d4f3da809a5dcb6a4f73278a64660235cdfe (diff)
downloadservo-7c34a70ca8d2087e5d1b7b29ae128b803cecacf9.tar.gz
servo-7c34a70ca8d2087e5d1b7b29ae128b803cecacf9.zip
Auto merge of #22542 - georgeroman:serialize_children_of_void_as_empty_strings, r=jdm
Serialize the children of void html elements as empty strings <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #22502 (GitHub issue number if applicable) <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22542) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/servoparser/html.rs')
-rw-r--r--components/script/dom/servoparser/html.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/components/script/dom/servoparser/html.rs b/components/script/dom/servoparser/html.rs
index 3ebf4b391b6..62fe26153ed 100644
--- a/components/script/dom/servoparser/html.rs
+++ b/components/script/dom/servoparser/html.rs
@@ -210,6 +210,12 @@ impl<'a> Serialize for &'a Node {
) -> io::Result<()> {
let node = *self;
+ if let TraversalScope::ChildrenOnly(_) = traversal_scope {
+ if node.downcast::<Element>().map_or(false, |e| e.is_void()) {
+ return Ok(());
+ }
+ }
+
let iter = SerializationIterator::new(node, traversal_scope != IncludeNode);
for cmd in iter {