J
_JM_
Guest
I wrote a piece of code that shows the problem.
When you delete a member of an object with a delete operator, you should be
able to see the prototype's value of the same property name if it exists
(because of chaining).
This works fine unless you try to do a for in statement of the object after
the delete, in which case the value of the prototype is not returned, in fact
it's never retrieved at all.
The example has two instances of Bar, both of them should have 3 members
before and after the delete, but after the delete only 2 members are found on
one of the instances.
This very example works fine in all other browsers (Firefox, Chrome, Opera).
If you do almost anything with the bar variable after the delete an before
the for in (for example uncomment the comparation bar==0) then the for in
statement works fine, just like it should always work.
This bug could produce some very serious problems on code that would seem to
work under most common cirumstances.
Here's the code:
str="";
var display = function(nombre, obj)
{
var i = 0;
str+=("
"+nombre+"
");
for (var a in obj){
str+=("   "+a + "="+ obj[a]+"
");
i++;
}
str+=("
"+i+"
");
}
var Bar = function()
{
this.instMember = "bar";
}
Bar.prototype.name = "proto";
Bar.prototype.id = 3;
bar = new Bar();
bar2 = new Bar();
bar.name = "inst";
//display objects before delete
display("bar", bar);
display("bar2", bar2);
str+=("
----- delete bar.name
");
delete bar.name;
//bar==0;
//display objects after delete
display("bar", bar);
display("bar2", bar2);
document.write(str);
----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.
http://www.microsoft.com/communitie...&dg=microsoft.public.internetexplorer.general
When you delete a member of an object with a delete operator, you should be
able to see the prototype's value of the same property name if it exists
(because of chaining).
This works fine unless you try to do a for in statement of the object after
the delete, in which case the value of the prototype is not returned, in fact
it's never retrieved at all.
The example has two instances of Bar, both of them should have 3 members
before and after the delete, but after the delete only 2 members are found on
one of the instances.
This very example works fine in all other browsers (Firefox, Chrome, Opera).
If you do almost anything with the bar variable after the delete an before
the for in (for example uncomment the comparation bar==0) then the for in
statement works fine, just like it should always work.
This bug could produce some very serious problems on code that would seem to
work under most common cirumstances.
Here's the code:
str="";
var display = function(nombre, obj)
{
var i = 0;
str+=("
"+nombre+"
");
for (var a in obj){
str+=("   "+a + "="+ obj[a]+"
");
i++;
}
str+=("
"+i+"
");
}
var Bar = function()
{
this.instMember = "bar";
}
Bar.prototype.name = "proto";
Bar.prototype.id = 3;
bar = new Bar();
bar2 = new Bar();
bar.name = "inst";
//display objects before delete
display("bar", bar);
display("bar2", bar2);
str+=("
----- delete bar.name
");
delete bar.name;
//bar==0;
//display objects after delete
display("bar", bar);
display("bar2", bar2);
document.write(str);
----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.
http://www.microsoft.com/communitie...&dg=microsoft.public.internetexplorer.general