mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
HTMLTableSectionElement improvements
'thead' and 'tfoot' now create instances of HTMLTableSectionElement HTMLTableSectionElement.rows has been implemented
This commit is contained in:
parent
e40dd3843f
commit
adbcb5345c
10 changed files with 109 additions and 43 deletions
|
@ -4,14 +4,17 @@
|
|||
|
||||
use cssparser::RGBA;
|
||||
use dom::attr::Attr;
|
||||
use dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding;
|
||||
use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLTableSectionElementDerived};
|
||||
use dom::bindings::js::Root;
|
||||
use dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding::{self, HTMLTableSectionElementMethods};
|
||||
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
||||
use dom::bindings::codegen::InheritTypes::NodeCast;
|
||||
use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLTableRowElementDerived, HTMLTableSectionElementDerived};
|
||||
use dom::bindings::js::{Root, RootedReference};
|
||||
use dom::document::Document;
|
||||
use dom::element::{AttributeMutation, ElementTypeId};
|
||||
use dom::element::{AttributeMutation, Element, ElementTypeId};
|
||||
use dom::eventtarget::{EventTarget, EventTargetTypeId};
|
||||
use dom::htmlcollection::{CollectionFilter, HTMLCollection};
|
||||
use dom::htmlelement::{HTMLElement, HTMLElementTypeId};
|
||||
use dom::node::{Node, NodeTypeId};
|
||||
use dom::node::{Node, NodeTypeId, window_from_node};
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
use std::cell::Cell;
|
||||
use util::str::{self, DOMString};
|
||||
|
@ -54,6 +57,22 @@ impl HTMLTableSectionElement {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(JSTraceable)]
|
||||
struct RowsFilter;
|
||||
impl CollectionFilter for RowsFilter {
|
||||
fn filter(&self, elem: &Element, root: &Node) -> bool {
|
||||
elem.is_htmltablerowelement()
|
||||
&& NodeCast::from_ref(elem).GetParentNode().r() == Some(root)
|
||||
}
|
||||
}
|
||||
|
||||
impl HTMLTableSectionElementMethods for HTMLTableSectionElement {
|
||||
// https://html.spec.whatwg.org/multipage/#dom-tbody-rows
|
||||
fn Rows(&self) -> Root<HTMLCollection> {
|
||||
HTMLCollection::create(&window_from_node(self), NodeCast::from_ref(self), box RowsFilter)
|
||||
}
|
||||
}
|
||||
|
||||
impl VirtualMethods for HTMLTableSectionElement {
|
||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||
let htmlelement: &HTMLElement = HTMLElementCast::from_ref(self);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue