Mac 10.4.4
I am running into an issue where I can't remove a DOM node from another DOM node. Basically, the node is there, but when I access it via its parent's child nodes, it comes back undefined.
Here is the exception I get:
----
Error: uncaught exception: [Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMHTMLDivElement.removeChild]" nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)" location: "JS frame :: http://weblogs.macromedia.com/mesh/file ... NAWatch.js :: anonymous :: line 865" data: no]
----
Here is the code snippet
- Code: Select all
MXNAWatch.prototype._removeChildrenFromNode = function(node)
{
if(!this._hasValue(node))
{
return;
}
var len = node.childNodes.length;
for(var i = 0; i < len; i++)
{
node.removeChild(node.childNodes[i]);
}
}
Basically, it chokes on this line:
node.removeChild(node.childNodes[i]);
because when it hits the node that contains the View All link, node.childNodes[i] returns undefined, and not the node.
You can view the app / widget here:
http://weblogs.macromedia.com/mesh/file ... /ajax_dom/
and the source here:
http://weblogs.macromedia.com/mesh/file ... NAWatch.js
Basically, when you click the little green arrow icon in the top item, i loop through and room all of the child items (basically the post description and view all link).
However, trying to remove the view all link results in the error above.
I had actually ran into this issue when trying to update a Firefox extension to work in Firefox 1.5. I was never able to figure out the issue or a workaround.
Anyone have any idea what might be going on? and how I might be able to work around it?
mike chambers
