当前位置: 首页>>代码示例>>C++>>正文


C++ HTMLCollection::length方法代码示例

本文整理汇总了C++中HTMLCollection::length方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLCollection::length方法的具体用法?C++ HTMLCollection::length怎么用?C++ HTMLCollection::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTMLCollection的用法示例。


在下文中一共展示了HTMLCollection::length方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: jsHTMLCollectionLength

JSValue jsHTMLCollectionLength(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSHTMLCollection* castedThis = static_cast<JSHTMLCollection*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    HTMLCollection* imp = static_cast<HTMLCollection*>(castedThis->impl());
    JSValue result = jsNumber(imp->length());
    return result;
}
开发者ID:mulriple,项目名称:Webkit-Projects,代码行数:8,代码来源:JSHTMLCollection.cpp

示例2: forms

void WebDocument::forms(WebVector<WebFormElement>& results) const {
  HTMLCollection* forms =
      const_cast<Document*>(constUnwrap<Document>())->forms();
  size_t sourceLength = forms->length();
  Vector<WebFormElement> temp;
  temp.reserveCapacity(sourceLength);
  for (size_t i = 0; i < sourceLength; ++i) {
    Element* element = forms->item(i);
    // Strange but true, sometimes node can be 0.
    if (element && element->isHTMLElement())
      temp.append(WebFormElement(toHTMLFormElement(element)));
  }
  results.assign(temp);
}
开发者ID:mirror,项目名称:chromium,代码行数:14,代码来源:WebDocument.cpp

示例3: insertCell

HTMLElement* HTMLTableRowElement::insertCell(int index,
                                             ExceptionState& exceptionState) {
  HTMLCollection* children = cells();
  int numCells = children ? children->length() : 0;
  if (index < -1 || index > numCells) {
    exceptionState.throwDOMException(
        IndexSizeError, "The value provided (" + String::number(index) +
                            ") is outside the range [-1, " +
                            String::number(numCells) + "].");
    return nullptr;
  }

  HTMLTableCellElement* cell = HTMLTableCellElement::create(tdTag, document());
  if (numCells == index || index == -1)
    appendChild(cell, exceptionState);
  else
    insertBefore(cell, children->item(index), exceptionState);
  return cell;
}
开发者ID:ollie314,项目名称:chromium,代码行数:19,代码来源:HTMLTableRowElement.cpp

示例4: deleteCell

void HTMLTableRowElement::deleteCell(int index,
                                     ExceptionState& exceptionState) {
  HTMLCollection* children = cells();
  int numCells = children ? children->length() : 0;
  // 1. If index is less than −1 or greater than or equal to the number of
  // elements in the cells collection, then throw "IndexSizeError".
  if (index < -1 || index >= numCells) {
    exceptionState.throwDOMException(
        IndexSizeError, "The value provided (" + String::number(index) +
                            ") is outside the range [0, " +
                            String::number(numCells) + ").");
    return;
  }
  // 2. If index is −1, remove the last element in the cells collection
  // from its parent, or do nothing if the cells collection is empty.
  if (index == -1) {
    if (numCells == 0)
      return;
    index = numCells - 1;
  }
  // 3. Remove the indexth element in the cells collection from its parent.
  Element* cell = children->item(index);
  HTMLElement::removeChild(cell, exceptionState);
}
开发者ID:ollie314,项目名称:chromium,代码行数:24,代码来源:HTMLTableRowElement.cpp

示例5: lengthAttrGetter

static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.HTMLCollection.length._get");
    HTMLCollection* imp = V8HTMLCollection::toNative(info.Holder());
    return v8::Integer::NewFromUnsigned(imp->length());
}
开发者ID:,项目名称:,代码行数:6,代码来源:


注:本文中的HTMLCollection::length方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。