Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!takemy.news.telefonica.de!telefonica.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="ISO-8859-1" Message-ID: <4147811.bbFqFoj25p@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Tue, 21 Feb 2012 12:58:41 +0100 User-Agent: KNode/4.4.11 Content-Transfer-Encoding: 7Bit Subject: Re: onclick=function(){obj.meth()} Newsgroups: comp.lang.javascript References: <1fb5k75j7mbjn04fm251o1omb0u1l1rbqv@4ax.com> Followup-To: comp.lang.javascript MIME-Version: 1.0 Lines: 55 NNTP-Posting-Date: 21 Feb 2012 12:58:44 CET NNTP-Posting-Host: e0f3b46e.newsspool3.arcor-online.net X-Trace: DXC=:RikDJ\eXV<_A0jCfgHO6>McF=Q^Z^V384Fo<]lROoR18kF Puzzled wrote:> On Mon, 20 Feb 2012 23:17:42 +0100, >> This is what I'm trying to do: >> >> onclick = "this.some_method_identifier( arg, arg )" > > That is meaningless in javascript terms precisely because the value of > the - this - keyword is not decided at this point. Incorrect. `this' in an event-handler *attribute* value is and always has been a reference to the DOM object representing the element having that attribute value. However, issues arise if `some_method_identifier' is not a stand-in for a built-in method of that DOM object or an object in its prototype chain. A DOM object is a host object, and per the ECMAScript Language Specification the algorithms of the Specification, including the `[[Put]]' and `[[Get]]' algorithms to set and retrieve property values, respectively, do not need to be implemented as specified. IOW: With host objects, all bets are off. -- (attributed to) Lasse Reichstein Nielsen >> and should be able to grasp that when I use it in a binding, > > Presumably you are using "terp" as an abbreviation for interpreter. > > In javascript the value of the - this - keyword is (always and only) > decided at runtime, Which is precisely why the followed approach may work, given the right method call. > so the interpreter cannot know what the value will be at the time of > tokenising/parsing/compiling the code. It does not have to in this case. >> I thought the proxy and the anon function were the required magic, be >> evidently not so, so now I'm back where I started, neck deep in >> confusion and ignorance. > > Computer programming is about understand enough to take control, which > is the antithesis of 'magic'. ACK. PointedEars -- Anyone who slaps a 'this page is best viewed with Browser X' label on a Web page appears to be yearning for the bad old days, before the Web, when you had very little chance of reading a document written on another computer, another word processor, or another network. -- Tim Berners-Lee