HighDots Forums  

re: "this" object

Javascript JavaScript language (comp.lang.javascript)


Discuss re: "this" object in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Armel Asselin
 
Posts: n/a

Default re: "this" object - 09-19-2003 , 12:19 PM






in fact I was testing in IE, and I misinterpreted the innerHTML : as it gave
"<input ...>" I thought it was my widget but it was the FORM as you said.
but how IE can then the "location" if the global object is the FORM ? is
there some horror/mechanism that make some "special default object" from the
window, that would be searched for if global object does not contain the
searched member ?



Reply With Quote
  #2  
Old   
Martin Honnen
 
Posts: n/a

Default Re: "this" object - 09-20-2003 , 04:39 AM








Armel Asselin wrote:
Quote:
in fact I was testing in IE, and I misinterpreted the innerHTML : as it gave
"<input ...>" I thought it was my widget but it was the FORM as you said.
but how IE can then the "location" if the global object is the FORM ? is
there some horror/mechanism that make some "special default object" from the
window, that would be searched for if global object does not contain the
searched member ?
I think the global object with IE as with other browsers is the window
object. What is different with IE is the this object set in the nested
local function. That is in my view a bug.


--

Martin Honnen
http://JavaScript.FAQTs.com/



Reply With Quote
  #3  
Old   
Dom Leonard
 
Posts: n/a

Default Re: "this" object - 09-20-2003 , 03:45 PM



Armel Asselin wrote:
Quote:
in fact I was testing in IE, and I misinterpreted the innerHTML : as it gave
"<input ...>" I thought it was my widget but it was the FORM as you said.
but how IE can then the "location" if the global object is the FORM ? is
there some horror/mechanism that make some "special default object" from the
window, that would be searched for if global object does not contain the
searched member ?


May I present an alternative line of reasoning?

ECMAScript function objects record a scope chain in their internal
[[scope]] property, and must convert a null 'this' value supplied in
call to the global object, as per ECMA 10.2.3.

Suppose an implementation recorded the value of the global object as an
internal property of a function object for later use. So a function
object would record both [[scope]] and a global object value passed at
construction. Under this model, and assuming global object and the
global scope chain looked like

{window, [null, window]}

imagine the effect of substituting

{formObject, [null, window, formObject]}

instead. I used "new Function()" in testing instead of inner function
declarations, because the scope chain should be the global object
according to ECMA 15.3.2.1. My interpretation of results is that
something akin to the above hypothesis is occuring in JSCRIPT and that
function construction is affecting values later used for both the global
object and the global scope chain.


If you are writing an ECMAScript interpreter, I would suggest
implementing the ECMA standard. For code that works across browsers, I
would be looking at calling out to a function defined within a SCRIPT
element.

Dom





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.