Implement Element::hasAttribute().
This commit is contained in:
parent
ee5efa1349
commit
bfe3e6abbc
|
@ -466,7 +466,6 @@ method Element::getAttributeNodeNS();\n
|
|||
method Element::getAttributeNS();\n
|
||||
method Element::getElementsByClassName();\n
|
||||
method Element::getElementsByTagNameNS();\n
|
||||
method Element::hasAttribute();\n
|
||||
method Element::hasAttributeNS();\n
|
||||
method Element::hasAttributes();\n
|
||||
getter Element::localName(string);\n
|
||||
|
|
|
@ -318,6 +318,28 @@ method Element::setAttribute()
|
|||
return 0;
|
||||
%}
|
||||
|
||||
method Element::hasAttribute()
|
||||
%{
|
||||
dom_string *attr_name = NULL;
|
||||
dom_exception exc;
|
||||
duk_size_t slen;
|
||||
bool res;
|
||||
|
||||
const char *s = duk_safe_to_lstring(ctx, 0, &slen);
|
||||
exc = dom_string_create((const uint8_t *)s, slen, &attr_name);
|
||||
duk_pop(ctx);
|
||||
|
||||
exc = dom_element_has_attribute(priv->parent.node,
|
||||
attr_name, &res);
|
||||
dom_string_unref(attr_name);
|
||||
if (exc != DOM_NO_ERR) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
duk_push_boolean(ctx, res);
|
||||
return 1;
|
||||
%}
|
||||
|
||||
getter Element::className ()
|
||||
%{
|
||||
dom_string *classstr = NULL;
|
||||
|
|
Loading…
Reference in New Issue