Пример #1
0
Value DOMCSSValueListFunc::tryCall(ExecState *exec, Object &thisObj, const List &args)
{
  KJS_CHECK_THIS( KJS::DOMCSSValueList, thisObj );
  DOM::CSSValueList valueList = static_cast<DOMCSSValueList *>(thisObj.imp())->toValueList();
  switch (id) {
    case DOMCSSValueList::Item:
      return getDOMCSSValue(exec,valueList.item(args[0].toInteger(exec)));
    default:
      return Undefined();
  }
}
Пример #2
0
Value DOMCSSValueList::tryGet(ExecState *exec, const Identifier &p) const
{
    Value result;
    DOM::CSSValueList valueList = static_cast< DOM::CSSValueList >(cssValue);

    if(p == lengthPropertyName)
        return Number(valueList.length());
    else if(p == "item")
        return lookupOrCreateFunction< DOMCSSValueListFunc >(exec, p, this, DOMCSSValueList::Item, 1, DontDelete | Function);

    bool ok;
    long unsigned int u = p.toULong(&ok);
    if(ok)
        return getDOMCSSValue(exec, valueList.item(u));

    return DOMCSSValue::tryGet(exec, p);
}