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); } ... ...
139
Douglas Crockford
douglascrock...
Aug 3, 2008 12:55 am
... var an = []; an.length = n + 1;...
140
riderpaulpaul
Aug 4, 2008 3:54 am
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...
141
Douglas Crockford
douglascrock...
Aug 4, 2008 10:51 pm
... 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...
142
Paul de Jong
riderpaulpaul
Aug 4, 2008 11:28 pm
The issue I was referring to is that the body tag needs to be completely loaded before a DOM script runs, especially if you have something like...
143
Andy Stevens
andystevens_...
Aug 5, 2008 2:36 pm
... 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...
144
Paul de Jong
riderpaulpaul
Aug 5, 2008 6:00 pm
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...
145
montago_2004
Aug 6, 2008 1:16 pm
... 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...
146
Klemen SlaviÄ
klemen.slavic
Aug 6, 2008 1:30 pm
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...
147
montago_2004
Aug 6, 2008 5:07 pm
... code ... comments still ... code leak ... If only JSLint would report it as an "Error"... JSLint stops completely, so its not even possible to simply...
148
Douglas Crockford
douglascrock...
Aug 6, 2008 5:15 pm
... upon ... http://groups.google.com/group/jquery-en/browse_thread/thread/e53f483dd67e4d08/f72f7832ead80dfb?lnk=gst&q=JSLint#f72f7832ead80dfb ... JSLint stops...
149
montago_2004
Aug 6, 2008 8:18 pm
/* Douglas ain't smart. */ Douglas is smart. //------------------------- Q: which of those two statements are more accurate ? A: the one, which is not a...
150
Douglas Crockford
douglascrock...
Aug 6, 2008 8:20 pm
... Yes it should, because sometimes syntax errors are hidden in comments. Again, I caution you to avoid programming conventions that depend on intentional...
151
Paul de Jong
riderpaulpaul
Aug 6, 2008 8:47 pm
... For the reasoning behind removing the comments may I recommend: JavaScript: The Good Parts, Douglas Crockford, O'Reilly, 2008....
152
Fred Lorrain
grumelo68
Aug 12, 2008 11:28 am
Hello, Here a piece of code: if (this.newsDetailHasAbstract) {HTML += '<div class="articleAbstract">' + this.myData.record[0][0][3].replace(/<\/?a[^>]*>/gi,'')...
153
Douglas Crockford
douglascrock...
Aug 12, 2008 11:46 am
... Fixed. Thanks for the report....
154
Fred Lorrain
grumelo68
Aug 12, 2008 2:59 pm
... Wow ! Incredible! Thank you so much for your quick update. Your tool really rocks....
155
Ben Collver
tylx
Aug 13, 2008 5:38 pm
Hi Doug, I wrote an example script and it appears to bind to the current value of the variable "i". The script is at the following URL. ...
156
Douglas Crockford
douglascrock...
Aug 13, 2008 6:31 pm
... 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...
157
DoNotSay
ghumham
Aug 14, 2008 1:26 pm
I have two functions: function blddrgable() { $j('div.blddrg').draggable("destroy").droppable("destroy"); ...
158
Fred Lorrain
grumelo68
Aug 14, 2008 1:26 pm
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...
159
Fred Lorrain
grumelo68
Aug 14, 2008 1:26 pm
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...
160
Douglas Crockford
douglascrock...
Aug 14, 2008 2:54 pm
... gboxJSON2("/swapbild",{"von":$j(this).attr("id"),"nach":$j(ui.draggable).attr("id")},function(erg){}); ... The global trick obviously only works if the...
161
Douglas Crockford
douglascrock...
Aug 14, 2008 3:33 pm
... I don't understand this....
162
Douglas Crockford
douglascrock...
Aug 14, 2008 3:35 pm
... JSLint does identify unused variables in the function report. Is hat not enough?...
163
Arthur Blake
blakesys
Aug 14, 2008 4:07 pm
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...
164
Douglas Crockford
douglascrock...
Aug 14, 2008 4:25 pm
... could help ... Thanks, I get it now. I think it is a good suggestion....
165
Douglas Crockford
douglascrock...
Aug 14, 2008 10:16 pm
JSLint is able to parse Yahoo Widgets .kon files. Is any using JSLint on widgets? Would anyone nice if I took that feature out?...
166
Fred Lorrain
grumelo68
Aug 15, 2008 3:41 pm
... 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...
167
Paul
dwtebriel
Aug 15, 2008 3:41 pm
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...