On Thu, Oct 15, 2009 at 1:47 PM, Allen Wirfs-Brock <Allen.Wirfs-Brock@microsoft.com> wrote: > Is the Mozilla document.all optimization contingent upon the occurrence of the text "document.all"? No, but it's contingent on the property lookup being the truthyness-testing-expression. (I wouldn't call it an optimization; if anything it adds some cost to certain paths.) > What happens for: > var docAll = document.all; > if (docAll) alert("IE"); else alert("not IE"); "IE" var doc = document; if (doc.all) alert("IE"); else alert("not IE"); "not IE" It was something that was intentionally targetted at the common case of the simple feature test, which is almost always "document.all". This is done by the host object implementation, which is given access to limited context ("is this access one that's being used to detect the presence of a property, versus fetching the value?"). MikeReceived on Thursday, 15 October 2009 17:54:40 UTC
This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:02 UTC