Dear Javascript Experts,
Opera seems to have different ideas about the visibility of Javascript
functions than other browsers. For example, if I have this code:
if (1==2) {
function invisible() {
alert("invisibl e() called");
}
}
then most browsers will consider invisible() to be undefined. But in
Opera you can call it! You can try this online here:
http://chezphil.org/bugreps/funcdecl.html - with most browsers you'll
get an error (open your javascript console) but Opera will show the
alert.
So: is this an Opera bug, or is either behaviour acceptable? (I'd be
interested to know what Safari and any other less-common browsers do.)
--Phil.
Opera seems to have different ideas about the visibility of Javascript
functions than other browsers. For example, if I have this code:
if (1==2) {
function invisible() {
alert("invisibl e() called");
}
}
then most browsers will consider invisible() to be undefined. But in
Opera you can call it! You can try this online here:
http://chezphil.org/bugreps/funcdecl.html - with most browsers you'll
get an error (open your javascript console) but Opera will show the
alert.
So: is this an Opera bug, or is either behaviour acceptable? (I'd be
interested to know what Safari and any other less-common browsers do.)
--Phil.
Comment