mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 813034 - Implement table.createTBody(); r=mounir sr=smaug
This commit is contained in:
parent
1a40020bdd
commit
6648ee5590
@ -711,6 +711,35 @@ HTMLTableElement::DeleteCaption()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<nsGenericHTMLElement>
|
||||
HTMLTableElement::CreateTBody()
|
||||
{
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo =
|
||||
OwnerDoc()->NodeInfoManager()->GetNodeInfo(nsGkAtoms::tbody, nullptr,
|
||||
kNameSpaceID_XHTML,
|
||||
nsIDOMNode::ELEMENT_NODE);
|
||||
MOZ_ASSERT(nodeInfo);
|
||||
|
||||
nsCOMPtr<nsGenericHTMLElement> newBody =
|
||||
NS_NewHTMLTableSectionElement(nodeInfo.forget());
|
||||
MOZ_ASSERT(newBody);
|
||||
|
||||
nsIContent* referenceNode = nullptr;
|
||||
for (nsIContent* child = nsINode::GetLastChild();
|
||||
child;
|
||||
child = child->GetPreviousSibling()) {
|
||||
if (child->IsHTML(nsGkAtoms::tbody)) {
|
||||
referenceNode = child->GetNextSibling();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ErrorResult rv;
|
||||
nsINode::InsertBefore(*newBody, referenceNode, rv);
|
||||
|
||||
return newBody.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<nsGenericHTMLElement>
|
||||
HTMLTableElement::InsertRow(int32_t aIndex, ErrorResult& aError)
|
||||
{
|
||||
|
@ -93,6 +93,9 @@ public:
|
||||
already_AddRefed<nsGenericHTMLElement> CreateTFoot();
|
||||
|
||||
nsIHTMLCollection* TBodies();
|
||||
|
||||
already_AddRefed<nsGenericHTMLElement> CreateTBody();
|
||||
|
||||
nsIHTMLCollection* Rows();
|
||||
|
||||
already_AddRefed<nsGenericHTMLElement> InsertRow(int32_t aIndex,
|
||||
|
@ -10,7 +10,6 @@ relativesrcdir := @relativesrcdir@
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MOCHITEST_FILES := \
|
||||
test_createTBody.html.json \
|
||||
test_table-insertRow.html.json \
|
||||
test_table-rows.html.json \
|
||||
$(NULL)
|
||||
|
@ -1,16 +0,0 @@
|
||||
{
|
||||
"No child nodes": true,
|
||||
"One tbody child node": true,
|
||||
"Two tbody child nodes": true,
|
||||
"A thead and a tbody child node": true,
|
||||
"A tfoot and a tbody child node": true,
|
||||
"A tbody and a thead child node": true,
|
||||
"A tbody and a tfoot child node": true,
|
||||
"Two tbody child nodes and a div": true,
|
||||
"One HTML and one namespaced tbody child node": true,
|
||||
"Two nested tbody child nodes": true,
|
||||
"A tbody node inside a thead child node": true,
|
||||
"A tbody node inside a tfoot child node": true,
|
||||
"A tbody node inside a thead child node after a tbody child node": true,
|
||||
"A tbody node inside a tfoot child node after a tbody child node": true
|
||||
}
|
@ -24,7 +24,7 @@ interface HTMLTableElement : HTMLElement {
|
||||
HTMLElement createTFoot();
|
||||
void deleteTFoot();
|
||||
readonly attribute HTMLCollection tBodies;
|
||||
//HTMLElement createTBody();
|
||||
HTMLElement createTBody();
|
||||
readonly attribute HTMLCollection rows;
|
||||
[Throws]
|
||||
HTMLElement insertRow(optional long index = -1);
|
||||
|
Loading…
Reference in New Issue
Block a user