M
Michael Winter
In an attempt to answer another question in this group, I've had to resort
to calling the DOM method, Node.removeChild(), using a reference to it
(long story...). That is, passing Node.removeChild.
In Opera (7.23/Win), the call appears to do nothing - the node remains -
but no errors are shown. In Netscape (7.0/Win), an exception results[1].
On IE (6.0/Win), the node is removed.
Strangly, if I pass another function reference, say window.alert or a
user-defined function, there is no problem.
This illustrates the problem:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<title>Function reference test</title>
<script type="text/javascript">
function executeRef( func, arg ) {
func( arg );
}
function performRefTest() {
var elem = document.getElementById('testDiv');
executeRef( elem.parentNode.removeChild, elem );
}
</script>
</head>
<body onload="performRefTest()">
<div id="testDiv">
Page content
</div>
<div>
This should be the only text remaining.
</div>
</body>
</html>
Any suggestions?
Mike
[1] The message:
Error: uncaught exception: [Exception... "Illegal operation on
WrappedNative prototype object" nsresult: "0x8057000c
(NS_ERROR_XPC_BAD_OP_ON_WN_PROTO)" location: "JS frame ::
file:///F:/Web/Blockquote/cite.js :: timerInstance_fire :: line 103"
data: no]
to calling the DOM method, Node.removeChild(), using a reference to it
(long story...). That is, passing Node.removeChild.
In Opera (7.23/Win), the call appears to do nothing - the node remains -
but no errors are shown. In Netscape (7.0/Win), an exception results[1].
On IE (6.0/Win), the node is removed.
Strangly, if I pass another function reference, say window.alert or a
user-defined function, there is no problem.
This illustrates the problem:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<title>Function reference test</title>
<script type="text/javascript">
function executeRef( func, arg ) {
func( arg );
}
function performRefTest() {
var elem = document.getElementById('testDiv');
executeRef( elem.parentNode.removeChild, elem );
}
</script>
</head>
<body onload="performRefTest()">
<div id="testDiv">
Page content
</div>
<div>
This should be the only text remaining.
</div>
</body>
</html>
Any suggestions?
Mike
[1] The message:
Error: uncaught exception: [Exception... "Illegal operation on
WrappedNative prototype object" nsresult: "0x8057000c
(NS_ERROR_XPC_BAD_OP_ON_WN_PROTO)" location: "JS frame ::
file:///F:/Web/Blockquote/cite.js :: timerInstance_fire :: line 103"
data: no]