mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
use XML fragment serialization for outerHTML in XML documents
This commit is contained in:
parent
06759fd0fd
commit
c77b61193f
3 changed files with 7 additions and 299 deletions
|
@ -124,6 +124,7 @@ use xml5ever::serialize as xmlSerialize;
|
|||
use xml5ever::serialize::SerializeOpts as XmlSerializeOpts;
|
||||
use xml5ever::serialize::TraversalScope as XmlTraversalScope;
|
||||
use xml5ever::serialize::TraversalScope::ChildrenOnly as XmlChildrenOnly;
|
||||
use xml5ever::serialize::TraversalScope::IncludeNode as XmlIncludeNode;
|
||||
|
||||
// TODO: Update focus state when the top-level browsing context gains or loses system focus,
|
||||
// and when the element enters or leaves a browsing context container.
|
||||
|
@ -2103,7 +2104,11 @@ impl ElementMethods for Element {
|
|||
|
||||
// https://dvcs.w3.org/hg/innerhtml/raw-file/tip/index.html#widl-Element-outerHTML
|
||||
fn GetOuterHTML(&self) -> Fallible<DOMString> {
|
||||
self.serialize(IncludeNode)
|
||||
if document_from_node(self).is_html_document() {
|
||||
return self.serialize(IncludeNode);
|
||||
} else {
|
||||
return self.xmlSerialize(XmlIncludeNode);
|
||||
}
|
||||
}
|
||||
|
||||
// https://w3c.github.io/DOM-Parsing/#dom-element-outerhtml
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue