To concatenate strings I use: // Concatenation of string 'str', n times. function repeatstr (n, str) { var an = new Array(1 + n); return an.join(str); } ... ...
One big issue in JavaScript is the onload issue. Many of the frameworks have a periodic check to see if the body has loaded using various methods. Since script...
... I don't see how it solves anything. There is a lot in the HTML recommendations that doesn't make sense, but the requirement that the tags all go either...
... Not always, I have inline scripts that work just fine so long as the parts of the DOM they are manipulating are ready & available. ... Seems reasonable to...
The issue with onload is that it is not ondomload, so if any file being downloaded takes too long the script does not fire and the user could be interacting...
... no.. its very good practise to code and debug... do you disagree ? this trick relies on a proper parser. I've made it work in my Editor... also works in...
IMHO, I don't think it's the domain of JSlint to handle these kind of comments, since the output of this algorithm is supposed to be clean code that is meant...
... code ... comments still ... code leak ... If only JSLint would report it as an "Error"... JSLint stops completely, so its not even possible to simply...
/* Douglas ain't smart. */ Douglas is smart. //------------------------- Q: which of those two statements are more accurate ? A: the one, which is not a...
... Yes it should, because sometimes syntax errors are hidden in comments. Again, I caution you to avoid programming conventions that depend on intentional...
Hello, Here a piece of code: if (this.newsDetailHasAbstract) {HTML += '<div class="articleAbstract">' + this.myData.record[0][0][3].replace(/<\/?a[^>]*>/gi,'')...
... Create a page with three buttons, a, b, and c. When you click on a button, it alerts its number. Modify your loop to get each element by id and attach an...
Hello, Is it a good practice to try to use a single 'var' statement per scope? For sure it help the compression of the script. If it's a best practice can an...
Hello, JSLint generate an error if a symbol is not declared. That's perfect! What about generating a warning if a symbol is declared but never used? A switch...
... gboxJSON2("/swapbild",{"von":$j(this).attr("id"),"nach":$j(ui.draggable).attr("id")},function(erg){}); ... The global trick obviously only works if the...
I think he's trying to ask if it is better to use this form: var x,y,z; versus var x; var y; var z; My opinion is yes, because it makes the script smaller and...
... used? ... It's fine to have it in the report (I haven't seen it) but imagine I have 100 methods in my object. For every unused symbol I will have to track...
Hey all, I currently have code that looks like the following: <script type="text/javascript"> //<![CDATA[ ... //]]> </script> Since I'm doing this in xhtml, my...