THIS SEEMS TO BE A BUG !!

Watch this : (In C# )

IHTMLElement oElement = (IHTMLElement)myChildren.Current;

I have created an object of IHTMLELement interface.
Now when i do the following :

Line 1) oElement.setAttribute("uip_copyZeroLeft",oElement.style.pixelLeft, 0)
;

Line 2) oElement.setAttribute("uip_copyZeroTop",oElement.style.pixelTop,0);

i.e. i am making new attributes & assigning the already defined values to
them. The issue i get it after the first line is executed, a value of
pixelLeft say 112 is stored in uip_CopyZeroLeft.
Now, when the Line 2 is executed a new attribute is not created(i.e.
uip_CopyZeroTop) is not created rather the previous attribute
uip_CopyZeroLeft is overwritten with the latest value given(i.e. now
uip_CopyZeroLeft stores the value of pixelTop).

This is rather funny.

If anyone can have the will n time to get a fix/a corresponding suggestion
to this problem, i would be really grateful.

Thanking all,
SHYAM B

url:http://www.ureader.com/gp/1444-1.aspx

Re: FIND THIS INTERESTING BUG IN C# by Jon

Jon
Thu Mar 13 10:08:34 CDT 2008

Shyam B <shyam.b1985@keane.com> wrote:
> THIS SEEMS TO BE A BUG !!
>
> Watch this : (In C# )
>
> IHTMLElement oElement = (IHTMLElement)myChildren.Current;
>
> I have created an object of IHTMLELement interface.
> Now when i do the following :
>
> Line 1) oElement.setAttribute("uip_copyZeroLeft",oElement.style.pixelLeft, 0)
> ;
>
> Line 2) oElement.setAttribute("uip_copyZeroTop",oElement.style.pixelTop,0);
>
> i.e. i am making new attributes & assigning the already defined values to
> them. The issue i get it after the first line is executed, a value of
> pixelLeft say 112 is stored in uip_CopyZeroLeft.
> Now, when the Line 2 is executed a new attribute is not created(i.e.
> uip_CopyZeroTop) is not created rather the previous attribute
> uip_CopyZeroLeft is overwritten with the latest value given(i.e. now
> uip_CopyZeroLeft stores the value of pixelTop).
>
> This is rather funny.
>
> If anyone can have the will n time to get a fix/a corresponding suggestion
> to this problem, i would be really grateful.

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

Note that even if this is a bug, it's certainly not a bug in C#. It may
be a bug in IE however.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk