mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-28 14:59:41 +03:00
implement Element::getAttribute
This commit is contained in:
parent
9b568abf96
commit
faddd8b035
@ -126,6 +126,29 @@ api finalise %{
|
||||
|
||||
/* interface Element in dom idl */
|
||||
|
||||
/* DOMString? Element::getAttribute(DOMString name); */
|
||||
operation getAttribute %{
|
||||
dom_string *value;
|
||||
dom_string *name_dom;
|
||||
dom_exception exc;
|
||||
|
||||
exc = dom_string_create((unsigned char*)name, name_len, &name_dom);
|
||||
if (exc != DOM_NO_ERR) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
exc = dom_element_get_attribute(private->node, name_dom, &value);
|
||||
dom_string_unref(name_dom);
|
||||
if (exc != DOM_NO_ERR) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
if (value != NULL) {
|
||||
jsret = JS_NewStringCopyN(cx, dom_string_data(value), dom_string_length(value));
|
||||
dom_string_unref(value);
|
||||
}
|
||||
%}
|
||||
|
||||
/*
|
||||
* DOM 3 has these as the element traversal extension
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user