Permalink
Browse files

FIREBREATH-170: Added return value to appendChild() to match javascri…

…pt convention.
  • Loading branch information...
1 parent da906f0 commit 2b4b8e7576e4690e76855e091bc7341f1c039f2c Roee Shenberg committed with taxilian Feb 24, 2012
@@ -26,13 +26,14 @@ Node::~Node()
{
}
-void Node::appendChild(FB::DOM::NodePtr node) {
+FB::DOM::NodePtr Node::appendChild(FB::DOM::NodePtr node) {
CComPtr<IHTMLDOMNode> newNode;
NodePtr actualNode = FB::ptr_cast<Node>(node);
if (SUCCEEDED(m_axNode->appendChild(actualNode->m_axNode, &newNode))) {
actualNode->m_axNode = newNode; // set the node to point to the real IHTMLDOMNode
} else {
throw std::runtime_error("failed to appendChild!");
}
+ return node;
}
@@ -40,7 +40,7 @@ namespace FB { namespace ActiveX {
virtual ~Node();
public:
- virtual void appendChild(FB::DOM::NodePtr node);
+ virtual FB::DOM::NodePtr appendChild(FB::DOM::NodePtr node);
protected:
CComQIPtr<IHTMLDOMNode> m_axNode;
CComPtr<IWebBrowser> m_webBrowser;
@@ -48,7 +48,8 @@ void FB::DOM::Node::setProperty(const int idx, const FB::variant& val) const
m_element->SetProperty(idx, val);
}
-void FB::DOM::Node::appendChild(FB::DOM::NodePtr node)
+FB::DOM::NodePtr FB::DOM::Node::appendChild(FB::DOM::NodePtr node)
{
- m_element->Invoke("appendChild", FB::variant_list_of(node->getJSObject()));
+ FB::JSObjectPtr result = callMethod<FB::JSObjectPtr>("appendChild", FB::variant_list_of(node->getJSObject()));
+ return Node::create(result);
}
@@ -203,7 +203,7 @@ namespace FB { namespace DOM {
/// @overload
virtual void setProperty(const int idx, const variant& val) const;
- virtual void appendChild(NodePtr node);
+ virtual NodePtr appendChild(NodePtr node);
protected:
JSObjectPtr m_element; // The JSObject that this object wraps

0 comments on commit 2b4b8e7

Please sign in to comment.