<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
	<title>jQuery Grid Plugin - jqGrid - Topic: some bugs found with respect of JSLint tool</title>
	<link>http://www.trirand.com/blog/?page_id=393/bugs/some-bugs-found-with-respect-of-jslint-tool</link>
	<description><![CDATA[Grid plugin]]></description>
	<generator>Simple:Press Version 5.7.5.3</generator>
	<atom:link href="http://www.trirand.com/blog/?page_id=393/bugs/some-bugs-found-with-respect-of-jslint-tool/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on some bugs found with respect of JSLint tool</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/some-bugs-found-with-respect-of-jslint-tool#p16346</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/some-bugs-found-with-respect-of-jslint-tool#p16346</guid>
        	        	<description><![CDATA[<p>Hello Oleg,</p>
<p>Thanks. Most of them done.</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Sun, 11 Apr 2010 11:54:27 +0300</pubDate>
        </item>
        <item>
        	<title>OlegK on some bugs found with respect of JSLint tool</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/some-bugs-found-with-respect-of-jslint-tool#p16344</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/some-bugs-found-with-respect-of-jslint-tool#p16344</guid>
        	        	<description><![CDATA[<p>Hello Tony!</p>
</p>
<p>I tested the current version from GitHub and found till now only one small problem.</p>
<p>I have one Grid where a column has formatter: &#39;showlink&#39;. The data send from server have sometime <em>null</em> values. Previous version on jqGrid formated this value like an empty string. The current version from GitHub instead format &#39;null&#39; value like clickable <span style="text-decoration: underline;">null</span>. It seems to me that the line 235</p>
<p><input type='button' class='sfcodeselect' name='sfselectit8490' value='Select Code' data-codeid='sfcode8490' /></p>
<div class='sfcode' id='sfcode8490'>cellval = cellval+&#34;&#34;;</div>
<p>shortly added inside of <em>$.fn.fmatter.showlink</em> function in the file <strong>jquery.fmatter.js</strong> should be removed. At least I don&#39;t undestand it&#39;s meaning.</p>
<p>Now you undestand, that working with JSLint tooks not so little fime. I hope you will not regret, that begin modifing of jqGrid corresponds of JSLint recomendations.</p>
<p>Inspide of large number of changes in jqGrid I found, that some bugs is not yet changed. For example, the line 160 of <strong>grid.custom.js</strong> looks the same as before:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit7723' value='Select Code' data-codeid='sfcode7723' /></p>
<div class='sfcode' id='sfcode7723'>if($t.p.footerrow) { $(&#34;.ui-jqgrid-sdiv&#34;,&#34;#gbox_&#34;+<span style=&#34;&#34;&#34;&#34;&#34;&#34;color:&#34;&#34;&#34;&#34;&#34;><strong>$s</strong></span>.p.id).slideUp(&#34;fast&#34;); }</div>
<p>but it should be fixed to</p>
<p><input type='button' class='sfcodeselect' name='sfselectit744' value='Select Code' data-codeid='sfcode744' /></p>
<div class='sfcode' id='sfcode744'>if($t.p.footerrow) {  $(&#34;.ui-jqgrid-sdiv&#34;,&#34;#gbox_&#34;+<strong>$t</strong>.p.id).slideUp(&#34;fast&#34;); }</div>
<p>One more clear bug, which I described befor (see /blog/?page_id=393/bugs/more-bug-fixes-and-other-suggestions-found-with-respect-of-jslint-tool/) is in the lines 203-204 of <strong>grid.jqueryui.js</strong>. The code</p>
<p><input type='button' class='sfcodeselect' name='sfselectit3823' value='Select Code' data-codeid='sfcode3823' /></p>
<div class='sfcode' id='sfcode3823'>if (opts.classname) {<br />&#160;&#160;&#160; selector.addClass(classname);<br />&#160;&#160;&#160; select.addClass(classname);<br />}</div>
<p>should be fixed to</p>
<p><input type='button' class='sfcodeselect' name='sfselectit6333' value='Select Code' data-codeid='sfcode6333' /></p>
<div class='sfcode' id='sfcode6333'>if (opts.classname) {<br /> &#160;&#160;&#160; selector.addClass(<strong>opts.</strong>classname);<br /> &#160;&#160;&#160; select.addClass(<strong>opts.</strong>classname);<br /> }</div>
<p>The line 19 of <strong>grid.subgrid.js</strong>:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit280' value='Select Code' data-codeid='sfcode280' /></p>
<div class='sfcode' id='sfcode280'>for(i=0; &#8230;</div>
<p>should be fixed to</p>
<p><input type='button' class='sfcodeselect' name='sfselectit9024' value='Select Code' data-codeid='sfcode9024' /></p>
<div class='sfcode' id='sfcode9024'>for(var i=0; &#8230;</div>
<p>and the line 280 of <strong>grid.treegrid.js</strong>:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit9171' value='Select Code' data-codeid='sfcode9171' /></p>
<div class='sfcode' id='sfcode9171'>len = result.length;</div>
<p>should be fixed to</p>
<p><input type='button' class='sfcodeselect' name='sfselectit3341' value='Select Code' data-codeid='sfcode3341' /></p>
<div class='sfcode' id='sfcode3341'>var len = result.length;</div>
<p>The line 237 of <strong>jquery.fmatter.js</strong>:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit3133' value='Select Code' data-codeid='sfcode3133' /></p>
<div class='sfcode' id='sfcode3133'>idUrl = op.baseLinkUrl &#8230;</div>
<p>should be also changed to</p>
<p><input type='button' class='sfcodeselect' name='sfselectit1095' value='Select Code' data-codeid='sfcode1095' /></p>
<div class='sfcode' id='sfcode1095'>var idUrl = op.baseLinkUrl &#8230;</div>
<p>It&#39;s only the main not yet fixed problems described in my previous long post.</p>
<p>Moreover if we stay on <strong>grid.base.js</strong> and try to make this the most important file more clear, we could reduce JSLint recomendation if we change the order of functions in the <strong>grid.base.js</strong> file. For example, inside of <em>addCell</em> function (lines 392-397) in the line 394 will be used <em>formatter</em> function defined in the line 398. If one swap the order this two functions in the <strong>grid.base.js </strong>file one receive less warnings. It seems to me, that for all JavaScript engine and JSLink also it would be easyer to analyse the code after such changes. In one a little change position of the functions <em>formatter</em>, <em>cellVal</em>, <em>updatepager</em>, <em>sortArrayData</em>, <em>beginReq</em>, <em>endReq</em> in the code one receive much fewer warnings.</p>
<p>Function <em>IntNum</em> from the <strong>grid.base.js</strong>, used inside of <strong>grid.base.js </strong>only, has first capital character, which should be used for constructors only corresponds to the JavaScript name conversion. The same problem exists only with the function <em>DaysArray</em> from <strong>grid.common.js</strong> (defined in the line 591). I find the JSLint recomendation good. One can rename <em>IntNum</em> to <em>intNum </em>and <em>DaysArray</em> to <em>daysArray</em> and make all jqGrid function in the same name conversion.</p>
<p>Another small problem exists in lines 967-968:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit9566' value='Select Code' data-codeid='sfcode9566' /></p>
<div class='sfcode' id='sfcode9566'>date = date.split(/[/:_;.tTs-]/);<br />format = format.split(/[/:_;.tTs-]/);</div>
<p>JSLint comment these line so: Unescaped &#39;-&#39;. It seems to me here we have almost the same problem like missing semicolon. All JavaScript engine which I knows will interpret these lines without any errors, but generally &#39;-&#39; character between &#39;[&#39; and &#39;]&#39; is used for difinition of ranges (like [A-Z]). So one &#39;-&#39; should be escaped to prevent it from being confused with a range hyphen. Of cause here we have no other characters after &#39;-&#39; before &#39;]&#39;, so we have not a real bug. Nevetherless the lines</p>
<p><input type='button' class='sfcodeselect' name='sfselectit7492' value='Select Code' data-codeid='sfcode7492' /></p>
<div class='sfcode' id='sfcode7492'>date = date.split(/[/:_;.tTs-]/);<br />format = format.split(/[/:_;.tTs-]/);</div>
<p>I personally find more readable.</p>
<p>One more LSLint recommendation about lines 196 and 252:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit3435' value='Select Code' data-codeid='sfcode3435' /></p>
<div class='sfcode' id='sfcode3435'>document.onselectstart=new Function (&#34;return false&#34;);</div>
<p>and</p>
<p><input type='button' class='sfcodeselect' name='sfselectit196' value='Select Code' data-codeid='sfcode196' /></p>
<div class='sfcode' id='sfcode196'>document.onselectstart=new Function (&#34;return true&#34;);</div>
<p>I find also OK. The fixed lines</p>
<p><input type='button' class='sfcodeselect' name='sfselectit6543' value='Select Code' data-codeid='sfcode6543' /></p>
<div class='sfcode' id='sfcode6543'>document.onselectstart=function(){return false;};</div>
<p>and</p>
<p><input type='button' class='sfcodeselect' name='sfselectit1848' value='Select Code' data-codeid='sfcode1848' /></p>
<div class='sfcode' id='sfcode1848'>document.onselectstart=function(){return true;};</div>
<p>will looks more like the rest of the jqGrid code.</p>
<p>These lines probably come in jqGrid after the suggestion from the discussion /blog/?page_id=393/discussion/jqgrid-data-loading-performace/. One could improve these lines later if one bind onselectstart not to document, but to an element (see. <a onclick="     javascript:pageTracker._trackPageview(&#39;/outbound/article/http://plugins.jquery.com/files/jquery.event.drag-1.0.js.txt&#39;);" href="http://plugins.jquery.com/files/jquery.event.drag-1.0.js.txt" target="_blank"></a><a href="http://plugins.jquery.com/file" rel="nofollow" target="_blank">http://plugins.jquery.com/file</a>.....1.0.js.txt) or use different technic depend on browser (like</p>
<p><input type='button' class='sfcodeselect' name='sfselectit5393' value='Select Code' data-codeid='sfcode5393' /></p>
<div class='sfcode' id='sfcode5393'>if($.browser.mozilla){     $(this).css(&#39;MozUserSelect&#39;,&#39;none&#39;); }else{&#8230;}</div>
<p>etc. see, for example, <a onclick="javascript:pageTracker._trackPageview(&#39;/outbound/article/http://mediavrog.net/blog/2007/10/24/browser/markieren-von-text-abschalten-ohne-javascript-per-css/&#39;);" href="http://mediavrog.net/blog/2007/10/24/browser/markieren-von-text-abschalten-ohne-javascript-per-css/" target="_blank"></a><a href="http://mediavrog.net/blog/2007" rel="nofollow" target="_blank">http://mediavrog.net/blog/2007</a>.....t-per-css/ or functions disableSelection and enableSelection in lines 117-129 of jquery.ui.core.js).</p>
<p>One more small comment about the JSLint suggestion to the last line of <strong>grid.base.js</strong> code. How I interpret the recommendation is to replace code</p>
<p><input type='button' class='sfcodeselect' name='sfselectit1058' value='Select Code' data-codeid='sfcode1058' /></p>
<div class='sfcode' id='sfcode1058'>;<strong>(</strong>function ($) {<br />$.jgrid = $.jgrid &#124;&#124; {};<br />$.extend($.jgrid,{<br /> &#160;&#160;&#160;&#160;&#160; &#8230;<br /> });<br /> }<strong>)(jQuery);</strong></div>
<p>to the code</p>
<p><input type='button' class='sfcodeselect' name='sfselectit2726' value='Select Code' data-codeid='sfcode2726' /></p>
<div class='sfcode' id='sfcode2726'><strong>(</strong>function ($) {<br /> $.jgrid = $.jgrid &#124;&#124; {};<br /> $.extend($.jgrid,{<br /> &#160;&#160;&#160;&#160;&#160; &#8230;<br /> });<br />}<strong>(jQuery));</strong></div>
<p>You can deceide youself whether to follow this recomendation.</p>
<p>Sorry my post will be longer and longer. Better we can discuss other subjects later.</p>
<p>Best regards<br />Oleg</p>
]]></description>
        	        	<pubDate>Sat, 10 Apr 2010 22:48:54 +0300</pubDate>
        </item>
        <item>
        	<title>tony on some bugs found with respect of JSLint tool</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/some-bugs-found-with-respect-of-jslint-tool#p16331</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/some-bugs-found-with-respect-of-jslint-tool#p16331</guid>
        	        	<description><![CDATA[<p>Hello Oleg,</p>
<p>I have updated a lot of thing. We need to test it in order prevent unwantend behaviour.</p>
<p>Also Have found a lot of mistakes and etc.</p>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Fri, 09 Apr 2010 19:59:57 +0300</pubDate>
        </item>
        <item>
        	<title>OlegK on some bugs found with respect of JSLint tool</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/some-bugs-found-with-respect-of-jslint-tool#p16278</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/some-bugs-found-with-respect-of-jslint-tool#p16278</guid>
        	        	<description><![CDATA[<p>Hello Tony!</p>
<p>My main goal was to show you, that the usage of JSLint can be really very helpful. So it would be good if you include JSLint in the process of the future release builds of jqGrid.</p>
<p>I also think (like you) that one should be very careful if one makes a lot of changes in a working code. But nevertheless please don&#8217;t forget to fix some clear bugs which I described in my two posts: like usage <strong>$s</strong> or <strong>ts</strong> instead of <strong>$t</strong> in <strong>grid.custom.js</strong> (see /blog/?page_id=393/bugs/more-bug-fixes-and-other-suggestions-found-with-respect-of-jslint-tool/) or missing "<strong>var</strong>" declarations. (Otherwise I had spend a lot of my time for nothing)</p>
<p>One more remark: I war at the beginning much more careful with changes of the "Equal" and "Not Equal" operators ("==" and "!==") to "Identically Equal" and "Not Identically Equal" ("===" and "!==="), which makes comparison without any type conversion.&#160; Then I make one test. I changed all "Equal" and "Not Equal" operators to "Identically Equal" and "Not Identically Equal" in grid.base.js. Then I tested my current program. Till now I didn&#8217;t found any problems! Now I am much more optimistic in the subject.</p>
<p>I see now a trend in JavaScript to usage more strict dialect of the language (see "strict more" in ECMAScript 5, for example, or <a href="http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/" rel="nofollow" target="_blank"><a href="http://ejohn.org/blog/ecmascri" rel="nofollow">http://ejohn.org/blog/ecmascri</a>.....-and-more/</a>). I find that jqGrid is now the best Grid plugin for jQuery. But to stay the best jqGrid in the future, you have to use the newest technology and look after (or sometimes follow) the last development trends.</p>
<p>Best regards<br />Oleg</p>
]]></description>
        	        	<pubDate>Wed, 07 Apr 2010 14:29:55 +0300</pubDate>
        </item>
        <item>
        	<title>tony on some bugs found with respect of JSLint tool</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/some-bugs-found-with-respect-of-jslint-tool#p16260</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/some-bugs-found-with-respect-of-jslint-tool#p16260</guid>
        	        	<description><![CDATA[<p>Hello Oleg,</p>
<p>Thanks again for this. I will use this link to do the changes.</p>
<p><a href="http://www.jslint.com/" rel="nofollow" target="_blank">http://www.jslint.com/</a></p>
<p>Of course we need to make these very carefully and apply them to the next jqGrid release.</p>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Tue, 06 Apr 2010 18:01:59 +0300</pubDate>
        </item>
        <item>
        	<title>OlegK on some bugs found with respect of JSLint tool</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/some-bugs-found-with-respect-of-jslint-tool#p16240</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/some-bugs-found-with-respect-of-jslint-tool#p16240</guid>
        	        	<description><![CDATA[<p><!--  /* Font Definitions */  @font-face 	{font-family:"MS Mincho"; 	panose-1:2 2 6 9 4 2 5 8 3 4;} @font-face 	{font-family:"MS Mincho"; 	panose-1:2 2 6 9 4 2 5 8 3 4;} @font-face 	{font-family:Calibri; 	panose-1:2 15 5 2 2 2 4 3 2 4;} @font-face 	{font-family:"@MS Mincho"; 	panose-1:2 2 6 9 4 2 5 8 3 4;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{margin-top:0cm; 	margin-right:0cm; 	margin-bottom:10.0pt; 	margin-left:0cm; 	line-height:115%; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif";} code 	{font-family:"Courier New";} .MsoChpDefault 	{font-family:"Calibri","sans-serif";} .MsoPapDefault 	{margin-bottom:10.0pt; 	line-height:115%;} @page WordSection1 	{size:595.3pt 841.9pt; 	margin:70.85pt 70.85pt 2.0cm 70.85pt;} div.WordSection1 	{page:WordSection1;} --></p>
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hello Tony,</span></p>
<p class="MsoNormal"><span lang="EN-US">I add here some more LS Lint suggestions which I forgot to include in my first post.</span></p>
<p class="MsoNormal"><span lang="EN-US">In the file <strong>grid.base.js</strong> in the line 713 are used function </span><strong><span style="font-size:10.0pt; line-height:115%;font-family:" lang="EN-US">IntNum</span></strong><span lang="EN-US"> which should be better renamed to </span><strong><span style="font-size: 10.0pt;line-height:115%;font-family:" lang="EN-US">intNum</span></strong><span lang="EN-US">. The function with the first capital letter in the name looks like more as a name of a class.</span></p>
<p class="MsoNormal"><span lang="EN-US">Assignment in the line 967 looks a little strange because of "+=":</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;line-height:115%; font-family:" lang="EN-US">&#160;&#160;&#160; h = (h !== 12) ? h <strong><span style="color:red">+=</span></strong> 12 : h;</span></p>
<p class="MsoNormal"><span lang="EN-US">The Line 2304 looks like also strange because of assignment "=" inside:</span></p>
<p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height: normal;text-autospace:none"><span style="font-size:10.0pt; font-family:" lang="EN-US">&#160;&#160;&#160; mathopr ? sum += parseFloat(val) :</span></p>
<p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height: normal;text-autospace:none"><span style="font-size:10.0pt; font-family:" lang="EN-US">&#160;&#160;&#160;&#160;&#160;&#160;&#160; obj ? ret.push({id:$t.rows[i].id,value:val}) : ret[i]<strong><span style="color:red">=</span></strong>val;</span></p>
<p class="MsoNormal"><span lang="EN-US">Variable</span><span style="font-size: 10pt; line-height: 115%;" lang="EN-US"> <strong>bs</strong></span> declared in the first line of the function updatepager (the line 689) is never used.</p>
<p><span lang="EN-US">Variable</span><span style="font-size: 10pt; line-height: 115%;" lang="EN-US"> <strong>imgs</strong></span> declared in the line 1117 is never used.</p>
<p class="MsoNormal"><span lang="EN-US">Variable</span><span style="font-size: 10pt; line-height: 115%;" lang="EN-US"> <strong>ht</strong></span> declared and assigned in the line 1364 is never used later.</p>
<p class="MsoNormal"><span lang="EN-US">Variable</span><span style="font-size: 10pt; line-height: 115%;" lang="EN-US"> <strong>rowslen</strong></span> <span lang="EN-US"> declared and assigned in the function (the line 1887) is never used later. Instead of </span> <strong><span style="font-size:10.0pt; line-height:115%" lang="EN-US">rowslen</span></strong> <span lang="EN-US"> variable </span> <strong><span style="font-size: 10pt; line-height: 115%;" lang="EN-US">t.rows.length</span></strong> is used in the lines 1910, 1935, 1940, 1958 and two times in the line 1966.</p>
<p class="MsoNormal"><span lang="EN-US">Variable</span><span style="font-size: 10pt; line-height: 115%;" lang="EN-US"> <strong>ind</strong></span> declared in the line 1987 is never used.</p>
<p class="MsoNormal"><span lang="EN-US">Variable</span><span style="font-size: 10pt; line-height: 115%;" lang="EN-US"> <strong>tn</strong></span> declared and assigned in the line 2139 is never used later.</p>
</p>
<p class="MsoNormal"><span lang="EN-US">Best regards<br /> Oleg</span></p>
</div>
]]></description>
        	        	<pubDate>Mon, 05 Apr 2010 19:53:34 +0300</pubDate>
        </item>
        <item>
        	<title>OlegK on some bugs found with respect of JSLint tool</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/some-bugs-found-with-respect-of-jslint-tool#p16193</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/some-bugs-found-with-respect-of-jslint-tool#p16193</guid>
        	        	<description><![CDATA[<p>Hello Tony,</p>
</p>
<p>now some suggestions to improve grid.common.js:</p>
<p>Replace the line 234</p>
<p>&#160;&#160;&#160; var curleft = curtop = 0;</p>
<p>with the line</p>
<p>&#160;&#160;&#160; var curleft = 0, curtop = 0;</p>
<p>Line 254</p>
<p>&#160;&#160;&#160; if(options.defaultValue) delete options[&#39;defaultValue&#39;];</p>
<p>with the line</p>
<p>&#160;&#160;&#160; if(options.defaultValue) delete options.defaultValue;</p>
<p>the lines 260-261</p>
<p>&#160;&#160;&#160; delete opt[&#39;id&#39;];<br /> &#160;&#160;&#160; delete opt[&#39;dataInit&#39;];</p>
<p>with the lines</p>
<p>&#160;&#160;&#160; delete opt.id;<br /> &#160;&#160;&#160; delete opt.dataInit;</p>
<p>and the line 270</p>
<p>&#160;&#160;&#160; delete opt[&#39;dataEvents&#39;];</p>
<p>with the line</p>
<p>&#160;&#160;&#160; delete opt.dataEvents;</p>
<p>the line 308</p>
<p>&#160;&#160;&#160; try {delete options[&#39;value&#39;];} catch (e){}</p>
<p>to the line</p>
<p>&#160;&#160;&#160; try {delete options.value;} catch (e){}</p>
<p>the line 327</p>
<p>&#160;&#160;&#160; try {delete options[&#39;dataUrl&#39;];delete options[&#39;value&#39;];} catch (e){}</p>
<p>to the line</p>
<p>&#160;&#160;&#160; try {delete options.dataUrl;delete options.value;} catch (e){}</p>
<p>the line 332</p>
<p>&#160;&#160;&#160; delete options[&#39;buildSelect&#39;];</p>
<p>to</p>
<p>&#160;&#160;&#160; delete options.buildSelect;</p>
<p>In the line 341 are missing semicolon. One should replace</p>
<p>&#160;&#160;&#160; ovm = jQuery.map(ovm,function(n){return jQuery.trim(n)});</p>
<p>to</p>
<p>&#160;&#160;&#160; ovm = jQuery.map(ovm,function(n){return jQuery.trim(n);});</p>
<p>Because the same reason one should replace</p>
<p>&#160;&#160;&#160; ovm = jQuery.map(ovm,function(n){return jQuery.trim(n)});</p>
<p>to</p>
<p>&#160;&#160;&#160; ovm = jQuery.map(ovm,function(n){return jQuery.trim(n);});</p>
<p>line 374. Don&#39;t make functions within a loop.</p>
<p>In the line 386 are used variable ov</p>
<p>&#160;&#160;&#160; ov = document.createElement("option");</p>
<p>which is defined out of scope (see line 370). So it would be better insert for example in the line 360</p>
<p>&#160;&#160;&#160; var i;</p>
<p>definition of ov variable</p>
<p>&#160;&#160;&#160; var i, ov;</p>
<p>and remove it from the line 370</p>
<p>&#160;&#160;&#160; var oSv = options.value<span style="text-decoration: line-through;">, ov</span>;</p>
<p>Lines 386-391 (for-body) should be placed inside of the body of the following if-block</p>
<p>&#160;&#160;&#160; If (oSv.hasOwnProperty(key)) { }</p>
<p>to filter unwanted properties from the prototype.</p>
<p>The line 446</p>
<p>&#160;&#160;&#160; for( i =0, len=g.p.colModel.length;i&#60;len; i++){</p>
<p>has len variable, which is not defined. So one could modify the line 444</p>
<p>&#160;&#160;&#160; var edtrul,i, nm;</p>
<p>to</p>
<p>&#160;&#160;&#160; var edtrul,i, nm, len;</p>
<p>In the line 546-547 are missing semicolon.</p>
<p>&#160;&#160;&#160; if(yln.indexOf("m") != -1) {mln=i}<br />&#160;&#160;&#160; if(yln.indexOf("d") != -1) {dln=i}</p>
<p>So one should replace these lines to the following</p>
<p>&#160;&#160;&#160; if(yln.indexOf("m") != -1) {mln=I;}<br />&#160;&#160;&#160; if(yln.indexOf("d") != -1) {dln=I;}</p>
<p>Moreover in the line 374</p>
<p>&#160;&#160;&#160; sv[1] = jQuery.map(sv,function(n,i){if(i&#62;0){return n;}}).join(":")</p>
<p>the function &#8220;function(n,i)&#8221; is defined within a loop (see line 371). If would be better to define it outside the loop and use it only in the line 371. The corresponding change could be following. We insert a new line which looks like</p>
<p>&#160;&#160;&#160; var myMapFunc = function(n,i){if(i&#62;0){return n;}};</p>
<p>(please, verify what should this function returns if i=0) after the line 370 and change line 374 to</p>
<p>&#160;&#160;&#160; sv[1] = jQuery.map(sv, myMapFunc).join(":");</p>
</p>
<p>Best regards<br /> Oleg</p>
]]></description>
        	        	<pubDate>Sat, 03 Apr 2010 15:44:52 +0300</pubDate>
        </item>
        <item>
        	<title>OlegK on some bugs found with respect of JSLint tool</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/some-bugs-found-with-respect-of-jslint-tool#p16175</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/some-bugs-found-with-respect-of-jslint-tool#p16175</guid>
        	        	<description><![CDATA[<p>Hello Tony,</p>
</p>
<p>with the line "if (p.gridComplete = complete) {" I was not sure myself.</p>
<p>If you want I could check other jqGrid-files (not only grid.base.js) when I found a little time for it.</p>
</p>
<p>Regards<br />Oleg</p>
]]></description>
        	        	<pubDate>Sat, 03 Apr 2010 12:55:42 +0300</pubDate>
        </item>
        <item>
        	<title>tony on some bugs found with respect of JSLint tool</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/some-bugs-found-with-respect-of-jslint-tool#p16170</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/some-bugs-found-with-respect-of-jslint-tool#p16170</guid>
        	        	<description><![CDATA[<p>Hello Oleg,</p>
<p>First of all thank you for this.</p>
<p>We have missed this checking since 3.5 version.</p>
<p>The most of your suggestions are allready done. Will be published soon.</p>
<p>Just one note</p>
<p>Line 336</p>
<p>&#160;&#160; &#160;if (p.gridComplete = complete) {</p>
</p>
<p>this is a valid instead and can be rewritten like this</p>
<p>p.gridComplete = complete;</p>
<p>if(p.gridComplete) {</p>
</p>
<p>It is written so to save the place <img class="spSmiley" style="margin:0" title="Wink" src="/blog/wp-content/forum-smileys/sf-wink.gif" alt="Wink" /></p>
</p>
<p>your fix will break the code.</p>
<p>Again thanks</p>
<p>Best Regards</p>
<p>Tony</p></p>
]]></description>
        	        	<pubDate>Sat, 03 Apr 2010 11:48:25 +0300</pubDate>
        </item>
        <item>
        	<title>OlegK on some bugs found with respect of JSLint tool</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/some-bugs-found-with-respect-of-jslint-tool#p16155</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/some-bugs-found-with-respect-of-jslint-tool#p16155</guid>
        	        	<description><![CDATA[<p><!--  /* Font Definitions */  @font-face 	{font-family:"MS Mincho"; 	panose-1:2 2 6 9 4 2 5 8 3 4;} @font-face 	{font-family:"MS Mincho"; 	panose-1:2 2 6 9 4 2 5 8 3 4;} @font-face 	{font-family:Calibri; 	panose-1:2 15 5 2 2 2 4 3 2 4;} @font-face 	{font-family:"@MS Mincho"; 	panose-1:2 2 6 9 4 2 5 8 3 4;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{margin-top:0cm; 	margin-right:0cm; 	margin-bottom:10.0pt; 	margin-left:0cm; 	line-height:115%; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif";} a:link, span.MsoHyperlink 	{color:blue; 	text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed 	{color:purple; 	text-decoration:underline;} .MsoChpDefault 	{font-family:"Calibri","sans-serif";} .MsoPapDefault 	{margin-bottom:10.0pt; 	line-height:115%;} @page WordSection1 	{size:595.3pt 841.9pt; 	margin:70.85pt 70.85pt 2.0cm 70.85pt;} div.WordSection1 	{page:WordSection1;} --></p>
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hello Tony</span></p>
<p class="MsoNormal"><span lang="EN-US">short time before I fix some bugs in my own javascripts with respect of JSLint tool (<a onclick="javascript:pageTracker._trackPageview(&#39;/outbound/article/http://www.jslint.com/lint.html&#39;);" href="http://www.jslint.com/lint.html" target="_blank">http://www.jslint.com/lint.html</a>). This tool is written by Douglas Crockford, the author of &#8220;The Good Parts&#8221; book and founder of <a onclick="javascript:pageTracker._trackPageview(&#39;/outbound/article/http://www.json.org/&#39;);" href="http://www.json.org/" target="_blank">JSON</a>. How one can see in <a onclick="javascript:pageTracker._trackPageview(&#39;/outbound/article/http://github.com/jquery/jquery/tree/master/build/&#39;);" href="http://github.com/jquery/jquery/tree/master/build/" target="_blank"></a><a href="http://github.com/jquery/jquer" rel="nofollow" target="_blank">http://github.com/jquery/jquer</a>.....ter/build/ John Resig uses JSLint also during development of jQuery. I am not fan of Crockford, but he is a greatest specialist in JavaScript and his tool could really help to makes javascript code better.</span></p>
<p class="MsoNormal"><span lang="EN-US">For example, If one try analyze only one <strong>grid.base.js</strong> file, one could find following </span></p>
<p class="MsoNormal"><span lang="EN-US">Line 52</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;line-height:115%; font-family:" lang="EN-US">&#160;&#160;&#160; xmlDoc[<span style="color:#A31515">"loadXM"</span>+<span style="color: #a31515;">"L"</span>](xmlString);</span></p>
<p class="MsoNormal"><span lang="EN-US">can be changed to</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;line-height:115%; font-family:" lang="EN-US">&#160;&#160;&#160; xmlDoc.loadXML(xmlString);</span></p>
<p class="MsoNormal"><span lang="EN-US">Line 336</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;line-height:115%; font-family:" lang="EN-US">&#160;&#160; &#160;if</span><span style="font-size: 10pt; line-height: 115%; font-family: &#34;Courier New&#34;;" lang="EN-US"> (p.gridComplete = complete) {</span></p>
<p class="MsoNormal"><span lang="EN-US">Can be fixed</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;line-height:115%; font-family:" lang="EN-US">&#160;&#160;&#160; if</span><span style="font-size: 10pt; line-height: 115%; font-family: &#34;Courier New&#34;;" lang="EN-US"> (p.gridComplete === complete) {</span></p>
<p class="MsoNormal"><span lang="EN-US">On can also find two places (line 614 and line 1905) where missed &#8220;var&#8221; declaration:</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;line-height:115%; font-family:" lang="EN-US">&#160;&#160;&#160; len = drows.length, i=0;</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;line-height:115%; font-family:" lang="EN-US">and</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;line-height:115%; font-family:" lang="EN-US">&#160;&#160;&#160; data = rdata[k];</span></p>
<p class="MsoNormal"><span lang="EN-US">which seems should be fixed to</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;line-height:115%; font-family:" lang="EN-US">&#160;&#160;&#160; var</span><span style="font-size: 10pt; line-height: 115%; font-family: &#34;Courier New&#34;;" lang="EN-US"> len = drows.length, i=0;</span></p>
<p class="MsoNormal"><span lang="EN-US">and</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;line-height:115%;font-family:">&#160;&#160;&#160; var</span><span style="font-size:10.0pt; line-height:115%;font-family:"> data = rdata[k];</span></p>
<p class="MsoNormal"><span lang="EN-US">The line 1406</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;line-height:115%; font-family:" lang="EN-US">&#160;&#160;&#160; if</span><span style="font-size: 10pt; line-height: 115%; font-family: &#34;Courier New&#34;;" lang="EN-US"> (!ts.p.viewsortcols[2]) { r=<span style="color:blue">true</span>,d=t.attr(<span style="color: #a31515;">"sort"</span>) }</span></p>
<p class="MsoNormal"><span lang="EN-US">Should be probably fixed to</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;line-height:115%; font-family:" lang="EN-US">&#160;&#160; if</span><span style="font-size: 10pt; line-height: 115%; font-family: &#34;Courier New&#34;;" lang="EN-US"> (!ts.p.viewsortcols[2]) { r=<span style="color:blue">true</span>;d=t.attr(<span style="color: #a31515;">"sort"</span>); }</span></p>
<p class="MsoNormal"><span lang="EN-US">The lines 1896-1897</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;line-height:115%; font-family:" lang="EN-US">&#160;&#160;&#160; if</span><span style="font-size: 10pt; line-height: 115%; font-family: &#34;Courier New&#34;;" lang="EN-US"> (!ts.p.viewsortcols[2]) { r=<span style="color:blue">true</span>;d=t.attr(<span style="color: #a31515;">"sort"</span>); }<br /> &#160;&#160;&#160; cmn = t.p.colModel[t.p.keyIndex+gi+si+ni].name;<br /> <span style="color:blue">&#160;&#160;&#160; if</span>(<span style="color:blue">typeof</span> rdata[0][cmn] != <span style="color:#A31515">"undefined"</span>) rowid = rdata[0][cmn];</span></p>
<p class="MsoNormal"><span lang="EN-US">should be fixed to</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;line-height:115%; font-family:" lang="EN-US">&#160;&#160;&#160; cnm = t.p.colModel[t.p.keyIndex+gi+si+ni].name;<span style="color: blue;"><br /> &#160;&#160;&#160; if</span>(<span style="color:blue">typeof</span> rdata[0][cnm] != <span style="color: #a31515;">"undefined"</span>) rowid = rdata[0][cnm];</span></p>
<p class="MsoNormal"><span lang="EN-US">because in the line 1876 is defined variable </span><strong><span style="font-size:10.0pt;line-height:115%; font-family:" lang="EN-US">cnm</span></strong><span lang="EN-US"> (and used later in the line 1908) and not </span><strong><span style="font-size:10.0pt; line-height:115%;font-family:" lang="EN-US">cmn</span></strong><span lang="EN-US">.</span></p>
<p class="MsoNormal"><span lang="EN-US">JSLint tool could help to find some missing semicolon. For example, line 339 or line 384</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;line-height:115%; font-family:" lang="EN-US">&#160;&#160; result += <span style="color:#A31515">"width: "</span>+grid.headers[pos].width+<span style="color:#A31515">"px;"</span></span></p>
<p class="MsoNormal"><span lang="EN-US">(which should be fixed to "</span><span style="font-size: 10pt; line-height: 115%; font-family: &#34;Courier New&#34;;" lang="EN-US">result += <span style="color:#A31515">"width: "</span>+grid.headers[pos].width+<span style="color: #a31515;">"px;"</span>;</span><span lang="EN-US">") . &#160;See also lines 441, 696, 788, 833, 1182, 1402, 1643, 1668 for the same problems.</span></p>
<p class="MsoNormal"><span lang="EN-US">Multiple definitions of variables (compare line 614 with 592 in the same scope) could be also detected.</span></p>
<p class="MsoNormal"><span lang="EN-US">Some places where expected an assignment or function call and instead saw an expression: Lines 555, 661, 696, 1370, 1947, 2304.</span></p>
<p class="MsoNormal"><span lang="EN-US">Some unimportant places like line 1851 with double &#8220;;&#8221; and the end of statement are also nice to find.</span></p>
<p class="MsoNormal"><span lang="EN-US">Unescaped &#39;-&#39; in regex in the lines 961 and 962.</span></p>
<p class="MsoNormal"><span lang="EN-US">Recommendation to replace line 1982</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;line-height:115%; font-family:" lang="EN-US">function</span><span style="font-size: 10pt; line-height: 115%; font-family: &#34;Courier New&#34;;" lang="EN-US"> isEmpty(obj) { <span style="color:blue">for</span>(<span style="color:blue">var</span> i <span style="color:blue">in</span> obj) { <span style="color:blue">return</span> <span style="color:blue">false</span>; } <span style="color:blue">return</span> <span style="color:blue">true</span>; }</span></p>
<p class="MsoNormal"><span lang="EN-US">with a code like</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;line-height:115%; font-family:" lang="EN-US">function</span><span style="font-size: 10pt; line-height: 115%; font-family: &#34;Courier New&#34;;" lang="EN-US"> isEmpty(obj) {<br /> &#160;&#160;&#160; <span style="color:blue">for</span>(<span style="color:blue">var</span> i <span style="color: blue;">in</span> obj) {<br /> &#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue">if</span> (obj.hasOwnProperty(i)) { <span style="color: blue;">return</span> <span style="color:blue">false</span>; }<br /> &#160;&#160;&#160; }<br /> &#160;&#160; &#160;<span style="color:blue">return</span> <span style="color:blue">true</span>;<br /> }</span></p>
<p class="MsoNormal"><span lang="EN-US">to filter unwanted properties from the prototype.</span></p>
<p class="MsoNormal"><span lang="EN-US">Suggestion to replace Function constructor line 196</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;line-height:115%; font-family:" lang="EN-US">document.onselectstart=<span style="color:blue">new</span> Function (<span style="color:#A31515">"return false"</span>);</span></p>
<p class="MsoNormal"><span lang="EN-US">with a standard </span><span style="font-size: 10pt; line-height: 115%; font-family: &#34;Courier New&#34;; color: blue;" lang="EN-US">function</span><span style="font-size: 10pt; line-height: 115%; font-family: &#34;Courier New&#34;;" lang="EN-US">() {&#8230;}</span><span lang="EN-US"> construction. (The same problem exists in the line 252.)</span></p>
<p class="MsoNormal"><span lang="EN-US">Line break errors: for example lines 61-63</span></p>
<p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height: normal;text-autospace:none"><span style="font-size:10.0pt; font-family:" lang="EN-US">msg = ($.jgrid.useJSON===<span style="color:blue">true</span> &#38;&#38; <span style="color:blue">typeof</span> (JSON) === <span style="color: #a31515;">&#39;object&#39;</span> &#38;&#38; <span style="color:blue">typeof</span> (JSON.parse) === <span style="color:#A31515">&#39;function&#39;</span>)</span></p>
<p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height: normal;text-autospace:none"><span style="font-size:10.0pt; font-family:" lang="EN-US">&#160;&#160;&#160; ? JSON.parse(js)</span></p>
<p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height: normal;text-autospace:none"><span style="font-size:10.0pt; font-family:" lang="EN-US">&#160;&#160;&#160; : eval(<span style="color:#A31515">&#39;(&#39;</span> + js + <span style="color:#A31515">&#39;)&#39;</span>);</span></p>
</p>
<p class="MsoNormal"><span lang="EN-US">One should be replaced these lines to</span></p>
<p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height: normal;text-autospace:none"><span style="font-size:10.0pt; font-family:" lang="EN-US">msg = ($.jgrid.useJSON===<span style="color:blue">true</span> &#38;&#38; <span style="color:blue">typeof</span> (JSON) === <span style="color: #a31515;">&#39;object&#39;</span> &#38;&#38; <span style="color:blue">typeof</span> (JSON.parse) === <span style="color:#A31515">&#39;function&#39;</span>) ?</span></p>
<p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height: normal;text-autospace:none"><span style="font-size:10.0pt; font-family:" lang="EN-US">&#160;&#160;&#160; JSON.parse(js) :</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;line-height:115%; font-family:" lang="EN-US">&#160;&#160;&#160; eval(<span style="color:#A31515">&#39;(&#39;</span> + js + <span style="color:#A31515">&#39;)&#39;</span>);</span></p>
<p class="MsoNormal"><span lang="EN-US">Very strange places commented as &#8220;Expected an assignment or function call and instead saw an expression&#8221;: lines 555, 661, 2303-2304 (better to use if-statement), 1370 and 1947.</span></p>
<p class="MsoNormal"><span lang="EN-US">One can continue these suggestions.</span></p>
<p class="MsoNormal"><span lang="EN-US">So for me I decide to use JSLint tool in my project. Because I develop in Visual Studio, I use now mostly JSLint.VS (<a onclick="javascript:pageTracker._trackPageview(&#39;/outbound/article/http://jslint.codeplex.com/&#39;);" href="http://jslint.codeplex.com/" target="_blank">http://jslint.codeplex.com/</a>). But I think also use the original <a onclick="javascript:pageTracker._trackPageview(&#39;/outbound/article/http://www.jslint.com/fulljslint.js&#39;);" href="http://www.jslint.com/fulljslint.js" target="_blank">fulljslint.js</a> with a way like described in <a onclick="javascript:pageTracker._trackPageview(&#39;/outbound/article/http://jason.diamond.name/weblog/2008/08/09/verifying-javascript-with-jslint-and-visual-studio/&#39;);" href="http://jason.diamond.name/weblog/2008/08/09/verifying-javascript-with-jslint-and-visual-studio/" target="_blank"></a><a href="http://jason.diamond.name/webl" rel="nofollow" target="_blank">http://jason.diamond.name/webl</a>.....al-studio/ (or some modification of this way). Another possible way is to use <a href="http://www.javascriptlint.com/" rel="nofollow" target="_blank">http://www.javascriptlint.com/</a>). Other Plugin jslint.vim (<a href="http://github.com/hallettj/jslint.vim" target="_blank">http://github.com/hallettj/jslint.vim</a>) can be also interesting.<br /></span></p>
<p class="MsoNormal"><span lang="EN-US">I recommend you Tony to invest a little time in JSLint tool. It will help to make the code of jqGrid better.</span></p>
<p class="MsoNormal"><span lang="EN-US">Best regards<br /> Oleg</span></p>
</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 1210px; width: 1px; height: 1px; overflow: hidden;"><span style="font-size: 10pt;  line-height: 115%; font-family: &#34;Courier New&#34;; color: blue;" lang="EN-US">function</span></div>
]]></description>
        	        	<pubDate>Fri, 02 Apr 2010 00:40:51 +0300</pubDate>
        </item>
</channel>
</rss>