Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #19298
| Message-ID | <7387918.Ua4iKhALxg@PointedEars.de> (permalink) |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Organization | PointedEars Software (PES) |
| Date | 2013-04-16 23:13 +0200 |
| Subject | Re: trying to call onclick with document.getElement() - document.getElement() returns null |
| Newsgroups | comp.lang.javascript |
| References | (5 earlier) <kkbe2r$ioc$1@portraits.wsisiz.edu.pl> <1693880.XzSgBGLykG@PointedEars.de> <kkcam8$smf$1@portraits.wsisiz.edu.pl> <7595870.kvP59otsHy@PointedEars.de> <kkk3li$9ol$1@portraits.wsisiz.edu.pl> |
Cezary Tomczyk wrote: > W dniu 2013-04-13 21:31, Thomas 'PointedEars' Lahn pisze: >> Cezary Tomczyk wrote: > [...] >>>>>> Where “XMLHttpRequest” is not a property of the object referred to by >>>>>> “window”, but of another object in the scope chain. >>>>> >>>>> Even then isHostMethod will return true, >>>> >>>> No, it will return “false”. The point is _not_ that you should call >>> >>> Can you provide me an example of when this may occur? >> >> No, you just need to read more carefully. Hopefully a *working* >> implementation of isHostMethod() will return a false-value if the >> property in question does not exist. > > I am disappointed. Instead of simple example from real life you just > writing "No, you just need to read more carefully". Which is exactly what you should do. You have claimed that „where ‘XMLHttpRequest’ is not a property of the object referred to by ‘window’”, “isHostMethod will return true”. However, if it is any good, it will return a false-value (trivially, “false”). > Regarding "Where “XMLHttpRequest” is not a property of the object > referred to by “window”, but of another object in the scope chain." - > again, would be good to provide an example from real life, not just from > theory. Just for better understanding, not guessing what author of > response thought about. > >>>> isHostMethod(window, "XMLHttpRequest") >>>> >>>> or >>>> >>>> jsx.object.isHostMethod(jsx.global, "window", "XMLHttpRequest") >>>> >>>> instead – that would be equally wrong –, but that isHostMethod() >>>> implements the *algorithm* to detect host methods *safely*, without >>>> implicit type conversion. >>> >>> I know both of methods, but sometimes simple statement "if >>> (window.XMLHttpRequest)" just do the job and I never had any problems >>> with that. >> >> You were asking about possible scenarios; I have provided you with them. > > They are theoretical. Give me scenarios that occur in real life, not > theoretical. An old, weathered bridge was crossing a river from high above. Someone had placed a warning sign before the bridge, saying that if you want to live you should not cross it. One day, a wild animal ran across the bridge, not heeding the warning sign. The deck of the bridge crashed instantly, and the animal fell to its death. A month later, a novice saw the warning sign and asked the master whether anyone had actually seen the bridge failing. The master said they could not remember having heard of any incident. Being confident then that the bridge was safe, the novice walked across the bridge carelessly. Its old, weathered deck crashed almost instantly, and the novice fell to their death. An apprentice heard of that incident, and asked the master what precautions should be taken in order to cross such a bridge safely. The master told them. The apprentice walked across the bridge carefully; still, its deck crashed in the middle. But thanks to their precautions, the apprentice survived. Later that day, as it was in their habit, the master walked down to the river and crossed it by the boat they had secured there. They did not remember that they placed the warning sign before the bridge as an apprentice years ago, after they almost fell to their death. -- PointedEars Twitter: @PointedEars2 Please do not Cc: me. / Bitte keine Kopien per E-Mail.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
trying to call onclick with document.getElement() - document.getElement() returns null jorythompson@gmail.com - 2013-04-12 10:45 -0700
Re: trying to call onclick with document.getElement() - document.getElement() returns null Jordan Thompson <jorythompson@gmail.com> - 2013-04-12 11:01 -0700
Re: trying to call onclick with document.getElement() - document.getElement() returns null Mikael Andersson <qubex2@gmail.com> - 2013-04-12 21:31 +0200
Re: trying to call onclick with document.getElement() - document.getElement() returns null Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-13 10:29 +0200
Re: trying to call onclick with document.getElement() - document.getElement() returns null Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2013-04-13 11:10 +0200
Re: trying to call onclick with document.getElement() - document.getElement() returns null Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-13 11:45 +0200
Re: trying to call onclick with document.getElement() - document.getElement() returns null Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2013-04-13 13:04 +0200
Re: trying to call onclick with document.getElement() - document.getElement() returns null Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-13 13:26 +0200
Re: trying to call onclick with document.getElement() - document.getElement() returns null Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2013-04-13 21:12 +0200
Re: trying to call onclick with document.getElement() - document.getElement() returns null Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-13 21:31 +0200
Re: trying to call onclick with document.getElement() - document.getElement() returns null Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2013-04-16 20:01 +0200
Re: trying to call onclick with document.getElement() - document.getElement() returns null Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-16 23:13 +0200
Re: trying to call onclick with document.getElement() - document.getElement() returns null Mikael Andersson <qubex2@gmail.com> - 2013-04-13 18:35 +0200
csiph-web