Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: comp.lang.javascript Subject: Re: I don't get it Date: Sat, 10 Apr 2021 15:47:17 +0100 Organization: A noiseless patient Spider Lines: 43 Message-ID: <8735vytcwa.fsf@bsb.me.uk> References: <1e965vkgenq7l$.hqmrkifgr4m5$.dlg@40tude.net> <586d1b88-77d5-42b0-ae5b-7506307df499n@googlegroups.com> <957a79db-946e-4f23-931a-ef7d4f0dbb3cn@googlegroups.com> <305fecc4-43da-4378-8430-ed10ac4dbe5bn@googlegroups.com> <20917gl3dv8shs6qqf1dqginq69e50aa54@4ax.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="69a28ed7f554c2fd6adcf981e90179d7"; logging-data="26834"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/DUVgPdRBzspsfCjNF3sTYgr6fKVitGR8=" Cancel-Lock: sha1:YrS66Je4VVTjQG/fYoxlmjM7H8I= sha1:J4bjKpiXLpNQh/WbzXypBjVKjvA= X-BSB-Auth: 1.2352f46859239ed769af.20210410154718BST.8735vytcwa.fsf@bsb.me.uk Xref: csiph.com comp.lang.javascript:39883 The Natural Philosopher writes: > On 09/04/2021 20:01, John G Harris wrote: >> On Fri, 9 Apr 2021 10:03:13 +0100, The Natural Philosopher >> wrote: >> >> >>> After spending two days some years ago I discovered that IE and Firefox >>> differed in their handling of comparisons of numerical and string data, >>> and that something like >>> >>> if('1'== 1) >>> >>> was handled differently in each browser. >>> >>> As with all loosely typed languages, bugs in your code are trumped by >>> bugs in the language itself. >> >> Was that before or after they claimed to conform to ECMA 262? If >> after, one or both browsers had a bug, not the language. If before, >> that's what you get with USPs. > > It was around 2007 give or take. IE6 and XP was current. I coded for > firefox, it broke in IE6. > > I actually checked the language spec. As far as I cam remember the > spec was explicit, that you converted to whatever the target of an > assignement was in a mixed type operation, but in a conditional there > was no assignment type... So you looked in the wrong place. I don't think that adds much useful information. ECMA 262, 3rd edition (2000) is very clear about the conversions required by the == operator (section 11.9.1 and 11.9.3). For the record, the string should be converted to a number (and the algorithm for doing that is given in great detail too). So it's not an issue with the specification. Testing in IE6 running on XP I find that the conversion is done correctly. Did Mozilla really have such a crude bug, and if so, did you really code for that despite the specification being clear? -- Ben.