jslint

Why using a source tag inside an audio tag prevents the loadeddata event from firing?

纵饮孤独 提交于 2019-12-04 06:13:17
For better accessibility we needed a second alternative set of play/pause controls and (with the help of user Kento Nishi) we successfully moved from DEMO A (with only 1 audio playback control) to DEMO B (with duplicated audio playback controls). PROBLEM1 The time duration (far right number) is broken in DEMO B. PROBLEM2 Every webpage has its own folder. Some pages have a spoken audio file ready made, *.mp3 but some pages dont. Would it be possible to hide all audio controls html if the spoken.mp3 (same file name for all pages) is absent in the page's own filder? So in summary: if the *.mp3

Why does jslint complain when I escape the < character in a RegEx?

限于喜欢 提交于 2019-12-04 05:43:57
The code: var foo = /\</; When I go to jslint.com and enter that in, I get: Problem at line 1 character 12: Unexpected '\'. It used to tell me Unexpected escaped character '<' in regular expression. but times have changed. So I'm just curious, why? If you try var foo = /\>/; it doesn't care, what's the deal with < ? If you have a two simple divs, the difference is clear: <div> < </div> <!--Missing right angle bracket, bad markup--> <div> > </div> <!--No problem, just a greater than text node--> JSLint does not assume that the script is a standalone file or inside a script tag of an HTML

Why does JSLint give strict violation error on this function?

余生颓废 提交于 2019-12-04 05:06:08
JSLint gives me the "strict violation" error, although I use the "this" context inside a function which hides it from the global scope. function test() { "use strict"; this.a = "b"; } For the record, I use the built-in JSLint parser in Webstorm. This is because JSLint doesn't recognize your function as a constructor. By convention, you must use uppercase letters. function Test() { "use strict"; this.a = "b"; } 来源: https://stackoverflow.com/questions/17770048/why-does-jslint-give-strict-violation-error-on-this-function

is it possible to run JSLint as commandline in windows with help of node.js?

允我心安 提交于 2019-12-04 04:23:27
I mean to run it like this: node.exe lint.js my_js_file.js And then get output to a console. What do I need to download ? Do I need just to save http://www.jslint.com/ to disk and then grab some attached js file or I need to look for special version for node.js ? Install jshint globally then you can use it from the command line. npm install -g jshint jshint testfile.js All this is assuming that you already have node and npm running on you windows machine. Edit I just noticed that I responded with an answer for jshint instead of jslint , the as the other answer points out, they are similar but

Expected ';' and instead saw ','. - JSLint multivar setting

帅比萌擦擦* 提交于 2019-12-04 02:27:26
As of about 14 January 2016, JSLint has started complaining about var or let declarations that have more than one variable per declaration, and has created a new directive, multivar that ignores this new "problem". This is a pretty significant change, as earlier versions would complain if you did have two var s in the same code block. That is, as of today (18 Jan 2016), this code now breaks in JSLint : /*jslint white:true, browser:true, devel:true */ function a(b) { "use strict"; var c, d; // <<< Now bad!! d = "test"; c = d + b; console.log(c); } The error reported is, Expected ';' and instead

Problems with jslint-v8 Ruby gem installation on Windows7 64-bit

淺唱寂寞╮ 提交于 2019-12-04 01:46:40
问题 There is a problem during Rally App SDK 2.0p environment setup on Windows 7 (64-bit). I have installed Ruby 1.8.7-p358 from rubyinstaller.org and managed to install rake Ruby gem. But I have problems installing jslint-v8 gem. It has dependencies on therubyracer and libv8 gems which need to be built using Ruby DevKit. During the installation I got the following error: C:\ruby> gem install jslint-v8 Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a

How to fix JSLint “missing new” error

人走茶凉 提交于 2019-12-04 00:53:38
Code below passed through JSLint causes an error: Problem at line 8 character 9: Missing 'new'. ResizeGrid(); How to fix? "use strict"; var ResizeGrid; function t() { var x; if (x) { ResizeGrid(); } } Tick Tolerate uncapitalized constructors or rename to resizeGrid(); to prevent lint from assuming its a function constructor (although calling an undefined var like that will raise other errors). You should name functions with a lower case initial letter, unless they are intended as constructors. If they are intended as constructors, you should be calling them with new . 来源: https://stackoverflow

Why does JSLint tell me to use “=== undefined” instead of “typeof … === 'undefined'”?

被刻印的时光 ゝ 提交于 2019-12-03 23:51:39
问题 I coded the following: showTitles = (typeof showTitles !== 'undefined') ? showTitles : 'Y'; showSelectGroup = (typeof showSelectGroup !== 'undefined') ? showSelectGroup : 'Y'; But JSLint is saying: Warning 3 JS Lint: Unexpected 'typeof'. Use '===' to compare directly with undefined. How should I change my code? 回答1: Note that whether this is best practice in general is debatable, but if you want to make it work with JSLint, you could do this showTitles = (showTitles !== undefined) ?

JSLint mixed spaces and tabs error

半城伤御伤魂 提交于 2019-12-03 22:16:17
I have run the following through JSLint: $(document).ready(function() { /* Add paragraph on page load */ // Get all header elements var header = document.getElementsByTagName('h1'), parent, newP, text; // Loop through the elements for (var i=0, m = header.length; i < m; i++) { parent = header[i].parentNode; newP = document.createElement("p"); text = document.createTextNode('This paragraph was inserted with JavaScript!'); newP.appendChild(text); // Insert the new P element after the header element in its parent node parent.insertBefore(newP, header[i].nextSibling); } // so much easier with

Purpose of JSLint “disallow insecure in regex” option

半世苍凉 提交于 2019-12-03 17:57:56
问题 I have a line of code that gets the following error when run through JSLint: Lint at line 604 character 48: Insecure '^'. numExp = parseInt(val[1].replace(/[^\-+\d]/g, ""), 10); This error seems to refer to the following description from JSLint's option page: "true if . and [^...] should not be allowed in RegExp literals. These forms should not be used when validating in secure applications." I don't quite understand how a client-side javascript application can really be considered secure.