Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #30184

JSlint complains for requestFullscreen

Path csiph.com!aioe.org!.POSTED!not-for-mail
From emf <emfril@gmail.com>
Newsgroups comp.lang.javascript
Subject JSlint complains for requestFullscreen
Date Fri, 1 Apr 2016 23:13:02 -0400
Organization Aioe.org NNTP Server
Lines 45
Message-ID <ndndbq$1nfl$1@gioia.aioe.org> (permalink)
NNTP-Posting-Host geprAYb1lz9he8Qph9tkEQ.user.gioia.aioe.org
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Complaints-To abuse@aioe.org
User-Agent Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Thunderbird/38.7.0
X-Notice Filtered by postfilter v. 0.8.2
X-Mozilla-News-Host news://news.aioe.org:119
Xref csiph.com comp.lang.javascript:30184

Show key headers only | View raw


in my Eye Exercises I am using this borrowed full-screen function:

function requestFullScreen() {
     "use strict";
     var el = document.body;
     // Supports most browsers and their versions.
     var requestMethod = el.requestFullScreen || el.webkitRequestFullScreen
             || el.mozRequestFullScreen || el.msRequestFullScreen;
     var wscript;

     if (requestMethod) {
         // Native full screen.
         requestMethod.call(el);
     } else if (window.ActiveXObject !== "undefined") {
         // Older IE.
         wscript = new window.ActiveXObject("WScript.Shell");
         if (wscript !== null) {
             wscript.SendKeys("{F11}");
         }
     }
}

It works fine, however JSlint complains for the last line of code:

Expected 'new' before 'wscript'.
             wscript.SendKeys("{F11}");

Sincerely I do not understand what the problem is and what JSlint wants 
me to change -- the variable has been declared and has been assigned a 
value -- and adding new in front creates more problems and doesn't make 
sense to me. Can someone explain what the problem is and how it can be 
solved to JSlint's satisfaction?

[BTW, the original code did not contain "window." before ActiveXObject; 
I added it to satisfy JSLint.]

also, I am curious, why did the author chose el as a variable name?

And do the experts of this newsgroup consider the code up-to-date?

Eustace

-- 
Eye exercises
http://emf.neocities.org/eyex.html

Back to comp.lang.javascript | Previous | NextNext in thread | Find similar | Unroll thread


Thread

JSlint complains for requestFullscreen emf <emfril@gmail.com> - 2016-04-01 23:13 -0400
  Re: JSlint complains for requestFullscreen "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-04-02 18:58 +0200
    Re: JSlint complains for requestFullscreen emf <emfril@gmail.com> - 2016-04-03 04:24 -0400
  Re: JSlint complains for requestFullscreen Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2016-04-02 18:54 +0100
    Re: JSlint complains for requestFullscreen Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-04-03 12:37 +0200
      Re: JSlint complains for requestFullscreen Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2016-04-04 10:52 +0100

csiph-web