Path: csiph.com!news.mixmin.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: Give alert if form checkbox array is empty Date: Thu, 21 Jan 2016 10:52:35 +0100 Organization: PointedEars Software (PES) Lines: 48 Message-ID: <2757422.ibQTPl4PXH@PointedEars.de> References: <5888602.Nj0jmESFCg@PointedEars.de> <405a9$569fab1d$11450e97$16733@nntpswitch.blueworldhosting.com> <3964788.uURLdzOTfL@PointedEars.de> <19572$56a08e96$520da86c$20767@nntpswitch.blueworldhosting.com> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1453369956 23938 eJwFwQERADEIAzBLo1Dg5ex46l/CEnpaTkUyg6IgYHZZciu2hqr+4X3g9nWENmss/OJcch8SlRB7 (21 Jan 2016 09:52:36 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Thu, 21 Jan 2016 09:52:36 +0000 (UTC) User-Agent: KNode/4.14.2 X-User-ID: eJwNy8EBwCAIA8CVjEDQcQgt+4/Q3v/CCHY6gx4TA5/i3Op3TBLZZ5fyormOYgxIPR3idC7V7Gv4C+C2W+cDfH8WQg== Cancel-Lock: sha1:B75ffOVsfnR9aji41pcTQ3xX8Wg= X-NNTP-Posting-Host: eJwFwYEBACAEBMCV1Hs0TsT+I3RH2LJyNZpyODcIycQ4VBQrIFGy88J0v2ycgaNiGC3++gMGABCa Xref: csiph.com comp.lang.javascript:29392 Cezary Tomczyk wrote: > On 20/01/2016 16:15, Thomas 'PointedEars' Lahn wrote: >> Cezary Tomczyk wrote: >>> As for compatibility - in some old environments that may not be >>> supported, but again, if somebody have to support those environments >>> then different solution can be considered. >> >> The problem with document.querySelector() is that it depends not only on >> the layout engine’s DOM support but also on the degree of its CSS >> support. You need a fallback in case you get a false negative from lack ^^^^^^^^^^^^^^^^^^^^^^^^ >> of support (for example, support for “:checked” is not a given if ^^^^^^^^^^ >> document.querySelector() is supported), but then you should have >> implemented the fallback approach that does not use >> document.querySelector() in the first place. > > document.querySelector has been implemented couple of years already and > I strongly suppose when some environment is not supporting it than it > has to be very old environment. Apparently I am not making myself clear. The *support* of document.querySelector() does _not_ imply support of certain *selectors* *because* certain selectors were not yet specified/supported when document.querySelector() was introduced. For example, the “:checked” pseudo class was standardized with CSS3 Selectors in 2011 [1]; document.querySelector() was standardized with Selectors API Level 1 in 2013 [2]. [1] [2] >> The point here is that your call of event.preventDefault() is independent >> of “isOneInputChecked”, in contrast to how the OP’s code was supposed to >> work. > > Fair enough. > > return window.alert should be instead. What is that supposed to accomplish? -- PointedEars FAQ: | SVN: Twitter: @PointedEars2 | ES Matrix: Please do not cc me. / Bitte keine Kopien per E-Mail.