blob: 159ff569c4df1256a067e00fbf8007d21a2e42e5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#include "JSCNode.h"
#include "JSCNamedNodeMap.h"
namespace Arabica {
namespace DOM {
JSValueRef JSCNode::attributesCustomAttrGetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef* exception) {
struct JSCNodePrivate* privData = (struct JSCNodePrivate*)JSObjectGetPrivate(thisObj);
if (!privData->nativeObj->hasAttributes()) {
return JSValueMakeUndefined(ctx);
}
Arabica::DOM::NamedNodeMap<std::string>* retVal = new Arabica::DOM::NamedNodeMap<std::string>(privData->nativeObj->getAttributes());
JSClassRef retClass = JSCNamedNodeMap::getTmpl();
struct JSCNamedNodeMap::JSCNamedNodeMapPrivate* retPrivData = new JSCNamedNodeMap::JSCNamedNodeMapPrivate();
retPrivData->dom = privData->dom;
retPrivData->nativeObj = retVal;
JSObjectRef retObj = JSObjectMake(ctx, retClass, retPrivData);
return retObj;
}
}
}
|