Last modified: 2006-11-15 08:01:17 UTC
Will shortly attach a diff of a patch used to make JS-lint ( http://www.jslint.com/ ) happier with wikibits.js Mostly it just adds braces around every if and else statement, in order to be explicit. There are also a few var declarations added, and a few semi-colons added. There are a few other additional things that it complains about, and which aren't addressed in this patch, e.g.: =========================== Problem at line 183 character 21: Use the array literal notation []. var sections = new Array(); Problem at line 194 character 25: Use the object literal notation {}. sections[seci] = new Object(); ===========================
Created attachment 2161 [details] Make js-lint happier with Wikibits.js
Done in r17697 (for the minor things that can be done quickly and hopefully painlessly). There are still a few remaining things; To reproduce the remaining errors, go to http://www.jslint.com/ , and: Tick: "Lax line break ending" Tick: "Detect undefined variables" Tick: "Tolerate eval" Tick: "Assume a browser" Then open the contents of wikibits.js in a browser, and copy/paste the contents of wikibits.js into the box, and click "JsLint". Example output of what remains: =============================================== Problem at line 39 character 12: Undefined variable: stylepath if (typeof stylepath != 'undefined' && typeof skin != 'undefined') { Problem at line 39 character 47: Undefined variable: skin if (typeof stylepath != 'undefined' && typeof skin != 'undefined') { Problem at line 200 character 31: Undefined variable: uncoversection a.onmousedown = a.onclick = uncoversection; Problem at line 282 character 19: JavaScript URL. toggleLink.href = 'javascript:toggleToc()'; Problem at line 283 character 50: Undefined variable: tocHideText toggleLink.appendChild(document.createTextNode(tocHideText)); Problem at line 294 character 4: Undefined function: toggleToc toggleToc(); Problem at line 313 character 26: Undefined variable: tocHideText changeText(toggleLink, tocHideText); Problem at line 317 character 26: Undefined variable: tocShowText changeText(toggleLink, tocShowText); Problem at line 351 character 3: Undefined function: insertTags insertTags(item.tagOpen, item.tagClose, item.sampleText); Problem at line 386 character 9: Undefined function: escapeQuotesHTML return escapeQuotesHTML(text); Problem at line 472 character 13: Undefined variable: ta if (typeof ta == "undefined" || !ta) { Problem at line 530 character 5: Undefined function: addRightClickEditHandler addRightClickEditHandler(el); Problem at line 575 character 4: Undefined function: addCheckboxClickHandlers addCheckboxClickHandlers(uls[i]); Problem at line 606 character 19: Undefined variable: checkboxMouseupHandler cb.onmouseup = checkboxMouseupHandler; Problem at line 729 character 21: Undefined variable: allmessages_prev if ( text.length > allmessages_prev.length ) { Problem at line 731 character 8: Undefined function: allmessagesforeach j = allmessagesforeach(items, i, j); Problem at line 773 character 2: Undefined variable: allmessages_modified allmessages_modified = !allmessages_modified; Problem at line 797 character 2: Undefined variable: allmessages_prev allmessages_prev = ''; Problem at line 798 character 2: Undefined variable: allmessages_modified allmessages_modified = false; ===============================================