本文整理汇总了C++中JSElement类的典型用法代码示例。如果您正苦于以下问题:C++ JSElement类的具体用法?C++ JSElement怎么用?C++ JSElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JSElement类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: jsElementPrototypeFunctionSetAttributeNodeNS
JSValue* jsElementPrototypeFunctionSetAttributeNodeNS(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
if (!thisValue->isObject(&JSElement::s_info))
return throwError(exec, TypeError);
JSElement* castedThisObj = static_cast<JSElement*>(thisValue);
return castedThisObj->setAttributeNodeNS(exec, args);
}
示例2: jsElementPrototypeFunctionBlur
JSValue* jsElementPrototypeFunctionBlur(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
if (!thisValue->isObject(&JSElement::s_info))
return throwError(exec, TypeError);
JSElement* castedThisObj = static_cast<JSElement*>(thisValue);
Element* imp = static_cast<Element*>(castedThisObj->impl());
imp->blur();
return jsUndefined();
}
示例3: jsElementPrototypeFunctionScrollByPages
JSValue* jsElementPrototypeFunctionScrollByPages(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
if (!thisValue->isObject(&JSElement::s_info))
return throwError(exec, TypeError);
JSElement* castedThisObj = static_cast<JSElement*>(thisValue);
Element* imp = static_cast<Element*>(castedThisObj->impl());
int pages = args[0]->toInt32(exec);
imp->scrollByPages(pages);
return jsUndefined();
}
示例4: jsElementPrototypeFunctionGetElementsByClassName
JSValue* jsElementPrototypeFunctionGetElementsByClassName(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
if (!thisValue->isObject(&JSElement::s_info))
return throwError(exec, TypeError);
JSElement* castedThisObj = static_cast<JSElement*>(thisValue);
Element* imp = static_cast<Element*>(castedThisObj->impl());
const UString& name = args[0]->toString(exec);
KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->getElementsByClassName(name)));
return result;
}
示例5: jsElementPrototypeFunctionContains
JSValue* jsElementPrototypeFunctionContains(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
if (!thisValue->isObject(&JSElement::s_info))
return throwError(exec, TypeError);
JSElement* castedThisObj = static_cast<JSElement*>(thisValue);
Element* imp = static_cast<Element*>(castedThisObj->impl());
Element* element = toElement(args[0]);
KJS::JSValue* result = jsBoolean(imp->contains(element));
return result;
}
示例6: jsElementPrototypeFunctionHasAttribute
JSValue* jsElementPrototypeFunctionHasAttribute(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
if (!thisValue->isObject(&JSElement::s_info))
return throwError(exec, TypeError);
JSElement* castedThisObj = static_cast<JSElement*>(thisValue);
Element* imp = static_cast<Element*>(castedThisObj->impl());
const UString& name = args[0]->toString(exec);
KJS::JSValue* result = jsBoolean(imp->hasAttribute(name));
return result;
}
示例7: jsElementPrototypeFunctionGetAttributeNodeNS
JSValue* jsElementPrototypeFunctionGetAttributeNodeNS(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
if (!thisValue->isObject(&JSElement::s_info))
return throwError(exec, TypeError);
JSElement* castedThisObj = static_cast<JSElement*>(thisValue);
Element* imp = static_cast<Element*>(castedThisObj->impl());
const UString& namespaceURI = valueToStringWithNullCheck(exec, args[0]);
const UString& localName = args[1]->toString(exec);
KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->getAttributeNodeNS(namespaceURI, localName)));
return result;
}
示例8: jsElementPrototypeFunctionRemoveAttribute
JSValue* jsElementPrototypeFunctionRemoveAttribute(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
if (!thisValue->isObject(&JSElement::s_info))
return throwError(exec, TypeError);
JSElement* castedThisObj = static_cast<JSElement*>(thisValue);
Element* imp = static_cast<Element*>(castedThisObj->impl());
ExceptionCode ec = 0;
const UString& name = args[0]->toString(exec);
imp->removeAttribute(name, ec);
setDOMException(exec, ec);
return jsUndefined();
}
示例9: lock
JSValueRef DumpRenderTreeSupport::computedStyleIncludingVisitedInfo(JSContextRef context, JSValueRef value)
{
JSLock lock(SilenceAssertionsOnly);
ExecState* exec = toJS(context);
if (!value)
return JSValueMakeUndefined(context);
JSValue jsValue = toJS(exec, value);
if (!jsValue.inherits(&JSElement::s_info))
return JSValueMakeUndefined(context);
JSElement* jsElement = static_cast<JSElement*>(asObject(jsValue));
Element* element = jsElement->impl();
RefPtr<CSSComputedStyleDeclaration> style = CSSComputedStyleDeclaration::create(element, true);
return toRef(exec, toJS(exec, jsElement->globalObject(), style.get()));
}
示例10: jsElementPrototypeFunctionQuerySelectorAll
JSValue* jsElementPrototypeFunctionQuerySelectorAll(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
if (!thisValue->isObject(&JSElement::s_info))
return throwError(exec, TypeError);
JSElement* castedThisObj = static_cast<JSElement*>(thisValue);
Element* imp = static_cast<Element*>(castedThisObj->impl());
ExceptionCode ec = 0;
const UString& selectors = valueToStringWithUndefinedOrNullCheck(exec, args[0]);
KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->querySelectorAll(selectors, ec)));
setDOMException(exec, ec);
return result;
}
示例11: jsElementPrototypeFunctionRemoveAttributeNode
JSValue* jsElementPrototypeFunctionRemoveAttributeNode(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
if (!thisValue->isObject(&JSElement::s_info))
return throwError(exec, TypeError);
JSElement* castedThisObj = static_cast<JSElement*>(thisValue);
Element* imp = static_cast<Element*>(castedThisObj->impl());
ExceptionCode ec = 0;
Attr* oldAttr = toAttr(args[0]);
KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->removeAttributeNode(oldAttr, ec)));
setDOMException(exec, ec);
return result;
}
示例12: jsElementPrototypeFunctionScrollIntoViewIfNeeded
JSValue* jsElementPrototypeFunctionScrollIntoViewIfNeeded(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
if (!thisValue->isObject(&JSElement::s_info))
return throwError(exec, TypeError);
JSElement* castedThisObj = static_cast<JSElement*>(thisValue);
Element* imp = static_cast<Element*>(castedThisObj->impl());
int argsCount = args.size();
if (argsCount < 1) {
imp->scrollIntoViewIfNeeded();
return jsUndefined();
}
bool centerIfNeeded = args[0]->toBoolean(exec);
imp->scrollIntoViewIfNeeded(centerIfNeeded);
return jsUndefined();
}