mirror of
https://github.com/servo/servo.git
synced 2025-06-24 17:14:33 +01:00
Fix to avoid attribute name clash between Document/HTMLDocument
Use children() instead of traverse_preorder(), and avoid having GetHead() in both Document and HTMLDocument. Closes #1465.
This commit is contained in:
parent
728fb9a7de
commit
b5eba001ef
4 changed files with 14 additions and 10 deletions
|
@ -17,7 +17,7 @@ interface HTMLDocument : Document {
|
|||
// getter object (DOMString name);
|
||||
/*[SetterThrows]
|
||||
attribute HTMLElement? body;*/
|
||||
readonly attribute HTMLHeadElement? head;
|
||||
// readonly attribute HTMLHeadElement? head;
|
||||
readonly attribute HTMLCollection images;
|
||||
readonly attribute HTMLCollection embeds;
|
||||
readonly attribute HTMLCollection plugins;
|
||||
|
|
|
@ -306,12 +306,13 @@ impl Document {
|
|||
// http://www.whatwg.org/specs/web-apps/current-work/#dom-document-head
|
||||
pub fn GetHead(&self) -> Option<AbstractNode> {
|
||||
self.get_html_element().and_then(|root| {
|
||||
root.traverse_preorder().find(|child| {
|
||||
root.children().find(|child| {
|
||||
child.type_id() == ElementNodeTypeId(HTMLHeadElementTypeId)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// http://www.whatwg.org/specs/web-apps/current-work/#dom-document-body
|
||||
pub fn GetBody(&self, _: AbstractDocument) -> Option<AbstractNode> {
|
||||
match self.get_html_element() {
|
||||
None => None,
|
||||
|
|
|
@ -33,14 +33,6 @@ impl HTMLDocument {
|
|||
}
|
||||
|
||||
impl HTMLDocument {
|
||||
pub fn GetHead(&self) -> Option<AbstractNode> {
|
||||
self.parent.GetDocumentElement().and_then(|root| {
|
||||
root.traverse_preorder().find(|child| {
|
||||
child.type_id() == ElementNodeTypeId(HTMLHeadElementTypeId)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
pub fn Images(&self) -> @mut HTMLCollection {
|
||||
self.parent.createHTMLCollection(|elem| eq_slice(elem.tag_name, "img"))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue