69
69
typedef int ExpectionCode;
71
JSValuePtr JSNode::insertBefore(ExecState* exec, const ArgList& args)
74
bool ok = impl()->insertBefore(toNode(args.at(exec, 0)), toNode(args.at(exec, 1)), ec, true);
75
setDOMException(exec, ec);
77
return args.at(exec, 0);
81
JSValuePtr JSNode::replaceChild(ExecState* exec, const ArgList& args)
84
bool ok = impl()->replaceChild(toNode(args.at(exec, 0)), toNode(args.at(exec, 1)), ec, true);
85
setDOMException(exec, ec);
87
return args.at(exec, 1);
91
JSValuePtr JSNode::removeChild(ExecState* exec, const ArgList& args)
94
bool ok = impl()->removeChild(toNode(args.at(exec, 0)), ec);
95
setDOMException(exec, ec);
97
return args.at(exec, 0);
101
JSValuePtr JSNode::appendChild(ExecState* exec, const ArgList& args)
103
ExceptionCode ec = 0;
104
bool ok = impl()->appendChild(toNode(args.at(exec, 0)), ec, true);
105
setDOMException(exec, ec);
107
return args.at(exec, 0);
111
JSValuePtr JSNode::addEventListener(ExecState* exec, const ArgList& args)
71
JSValue JSNode::insertBefore(ExecState* exec, const ArgList& args)
74
bool ok = impl()->insertBefore(toNode(args.at(0)), toNode(args.at(1)), ec, true);
75
setDOMException(exec, ec);
81
JSValue JSNode::replaceChild(ExecState* exec, const ArgList& args)
84
bool ok = impl()->replaceChild(toNode(args.at(0)), toNode(args.at(1)), ec, true);
85
setDOMException(exec, ec);
91
JSValue JSNode::removeChild(ExecState* exec, const ArgList& args)
94
bool ok = impl()->removeChild(toNode(args.at(0)), ec);
95
setDOMException(exec, ec);
101
JSValue JSNode::appendChild(ExecState* exec, const ArgList& args)
103
ExceptionCode ec = 0;
104
bool ok = impl()->appendChild(toNode(args.at(0)), ec, true);
105
setDOMException(exec, ec);
111
JSValue JSNode::addEventListener(ExecState* exec, const ArgList& args)
113
113
JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
114
114
if (!globalObject)
115
115
return jsUndefined();
117
if (RefPtr<JSEventListener> listener = globalObject->findOrCreateJSEventListener(args.at(exec, 1)))
118
impl()->addEventListener(args.at(exec, 0).toString(exec), listener.release(), args.at(exec, 2).toBoolean(exec));
117
if (RefPtr<JSEventListener> listener = globalObject->findOrCreateJSEventListener(args.at(1)))
118
impl()->addEventListener(args.at(0).toString(exec), listener.release(), args.at(2).toBoolean(exec));
120
120
return jsUndefined();
123
JSValuePtr JSNode::removeEventListener(ExecState* exec, const ArgList& args)
123
JSValue JSNode::removeEventListener(ExecState* exec, const ArgList& args)
125
125
JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
126
126
if (!globalObject)
127
127
return jsUndefined();
129
if (JSEventListener* listener = globalObject->findJSEventListener(args.at(exec, 1)))
130
impl()->removeEventListener(args.at(exec, 0).toString(exec), listener, args.at(exec, 2).toBoolean(exec));
129
if (JSEventListener* listener = globalObject->findJSEventListener(args.at(1)))
130
impl()->removeEventListener(args.at(0).toString(exec), listener, args.at(2).toBoolean(exec));
132
132
return jsUndefined();