Yes, on the caller. You assume the caller to be the same object that you
assigned the property to, but there is no requirement for that.
Examples are not normative. Besides, you are not citing an authoritative
source; I do not even need to visit the site to know that.
Not normative? I posted text that comes directly from the official
Ecma-262 spec. What's wrong with that?
Since the spec is in PDF, I put up a link to Bob Clary's HTML Edition.
It is directly relevant to this discussion (that you seem to be trying
to destroy) and it makes it easy for anyone to click on that link and
go directly to the section.
I don't have a problem with that link.
According to the citation from the Ecma-262 spec, window is the global
object.
Again, that is your assumption.
It is the expected behavior based on the Ecma 262 spec for the exact
reasons I provided.
As you are unable to see or do not want to
see the other possibilities explaining the outcome of your test case, it
would appear to be best to end this discussion now.
What other possibilities?
Such senseless rebuttal gives the impression that you are desperate to
"win" the argument. I don't see this with any other poster. The
discussion doesn't need to be ended. In fact, what would seem to be
the most benefit at this point would be some insight on what MSIE is
doing with the thisArg in a global method call.
There is no more benefit of "end the discussion now" than your earlier
post chiding "search the archives" and follow up of rebuking me "learn
how to search using appropriate keywords" and then providing
absolutely no example of such a search result with a relevant post.
Just search the archives for the any of the statement: "score
adjusted" and find a plethora of such posts.
[...]
Lets look at how [[Call]] works.
We are dealing with a scope chain, which items we do not know for sure, and
host objects here.
What items? Are you suggesting that there is a window property added
to the activation object in the call to foo?
If you are suggesting some form of shadowing, then you have provided
no evidence for that.
There is a - this - argument that is the global object.
There is a window object that is also the global object.
How can you distinguish that these objects are different?
I have already demonstrated that this.document == window.document. We
could take this further and explore the properties of the this object
and those of the window object:
<script type="text/javascript">
var fooVar = 1;
window.foo = function(p, g1, g2) {
if(!g1) g1 = this;
if(!g2) g2 = window;
alert(g1[p] !== g2[p] ? "different" : "same");
};
foo("Array");
foo("fooVar");
// foo("Array", this, top);
// foo("fooVar", self, top);
</script>
If we can get a 'different' result, then that would show that this and
global are different. Thomas, can you provide a value for - p - where
the result of calling the foo function will result in "different"?
That would back your claim up.
I am not able to observe a difference between the global object and
the window object. Only the Equals and Strict Equals operators.
<script>
alert([
this === top,
window === top,
this === window,
,'\n',
this === self,
window === self,
self === top,
]);
</script>
So far, you have provided no evidence that window and global are
different objects.
If it is exactly clear what is going on, then it has not been
demonstrated. Since it is your claim that it is, it is up to you to
provide evidence for this claim.
Garrett