本文整理汇总了C++中HTMLTableSectionElement::firstChild方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLTableSectionElement::firstChild方法的具体用法?C++ HTMLTableSectionElement::firstChild怎么用?C++ HTMLTableSectionElement::firstChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLTableSectionElement
的用法示例。
在下文中一共展示了HTMLTableSectionElement::firstChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rowIndex
int HTMLTableRowElement::rowIndex() const
{
ContainerNode* table = parentNode();
if (!table)
return -1;
table = table->parentNode();
if (!table || !table->hasTagName(tableTag))
return -1;
// To match Firefox, the row indices work like this:
// Rows from the first <thead> are numbered before all <tbody> rows.
// Rows from the first <tfoot> are numbered after all <tbody> rows.
// Rows from other <thead> and <tfoot> elements don't get row indices at all.
int rIndex = 0;
if (HTMLTableSectionElement* head = static_cast<HTMLTableElement*>(table)->tHead()) {
for (Node *row = head->firstChild(); row; row = row->nextSibling()) {
if (row == this)
return rIndex;
if (row->hasTagName(trTag))
++rIndex;
}
}
for (Node *node = table->firstChild(); node; node = node->nextSibling()) {
if (node->hasTagName(tbodyTag)) {
HTMLTableSectionElement* section = static_cast<HTMLTableSectionElement*>(node);
for (Node* row = section->firstChild(); row; row = row->nextSibling()) {
if (row == this)
return rIndex;
if (row->hasTagName(trTag))
++rIndex;
}
}
}
if (HTMLTableSectionElement* foot = static_cast<HTMLTableElement*>(table)->tFoot()) {
for (Node *row = foot->firstChild(); row; row = row->nextSibling()) {
if (row == this)
return rIndex;
if (row->hasTagName(trTag))
++rIndex;
}
}
// We get here for rows that are in <thead> or <tfoot> sections other than the main header and footer.
return -1;
}