本文整理汇总了C++中HTMLTableRowElement::parentNode方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLTableRowElement::parentNode方法的具体用法?C++ HTMLTableRowElement::parentNode怎么用?C++ HTMLTableRowElement::parentNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLTableRowElement
的用法示例。
在下文中一共展示了HTMLTableRowElement::parentNode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: insertRow
HTMLTableRowElement* HTMLTableElement::insertRow(
int index,
ExceptionState& exceptionState) {
if (index < -1) {
exceptionState.throwDOMException(
IndexSizeError,
"The index provided (" + String::number(index) + ") is less than -1.");
return nullptr;
}
HTMLTableRowElement* lastRow = nullptr;
HTMLTableRowElement* row = nullptr;
if (index == -1) {
lastRow = HTMLTableRowsCollection::lastRow(*this);
} else {
for (int i = 0; i <= index; ++i) {
row = HTMLTableRowsCollection::rowAfter(*this, lastRow);
if (!row) {
if (i != index) {
exceptionState.throwDOMException(
IndexSizeError,
"The index provided (" + String::number(index) +
") is greater than the number of rows in the table (" +
String::number(i) + ").");
return nullptr;
}
break;
}
lastRow = row;
}
}
ContainerNode* parent;
if (lastRow) {
parent = row ? row->parentNode() : lastRow->parentNode();
} else {
parent = lastBody();
if (!parent) {
HTMLTableSectionElement* newBody =
HTMLTableSectionElement::create(tbodyTag, document());
HTMLTableRowElement* newRow = HTMLTableRowElement::create(document());
newBody->appendChild(newRow, exceptionState);
appendChild(newBody, exceptionState);
return newRow;
}
}
HTMLTableRowElement* newRow = HTMLTableRowElement::create(document());
parent->insertBefore(newRow, row, exceptionState);
return newRow;
}
示例2: findRows
static inline RefPtr<HTMLCollection> findRows(const HTMLTableRowElement& row)
{
auto* parent = row.parentNode();
if (is<HTMLTableSectionElement>(parent))
return downcast<HTMLTableSectionElement>(*parent).rows();
if (is<HTMLTableElement>(parent))
return downcast<HTMLTableElement>(*parent).rows();
return nullptr;
}
示例3: toHTMLElement
static inline bool isInSection(HTMLTableRowElement& row, const HTMLQualifiedName& sectionTag)
{
// Because we know that the parent is a table or a section, it's safe to cast it to an HTMLElement
// giving us access to the faster hasTagName overload from that class.
return toHTMLElement(row.parentNode())->hasTagName(sectionTag);
}