That "for( i in items )" loop isn't guaranteed to enumerate the items in any
particular order. If you need something to be in a particular order, don't
use an object with string property names. Use an array, e.g.
var items = [
"1010101001010102011010100010101020101020101010101100110
> Another thought is that you could just do a replace on 0, 1 and 2 in the
> string: replace each number with the div you want, then wrap that in a div.
Yeah, I was wondering whether the regexp engine would be faster.
Something like this:
for(var item in items){
html.push(
'',
process(
Another thought is that you could just do a replace on 0, 1 and 2 in the
string: replace each number with the div you want, then wrap that in a div.
- Jack
Jack Killpatrick wrote:
assuming that your json items are objects, try this. The console
statements are for Firebug output: comment them
assuming that your json items are objects, try this. The console
statements are for Firebug output: comment them out if you don't have
firebug. This uses a few speed tricks.
// sample data
//
var items = {};
items["1"] =
'101010100101010201101010001010
I'm not sure if it matters in javascript but I would do this:
var length = item.length;
for ( var g = 0; g < length; g++) {
Instead of this:
for (var g=0; g wrote:
>
> Not sure how much it'll speed up, but instead of:
> item.substr(g,1)
> try: item[g]
>
> Then, go through this post:
> h
Not sure how much it'll speed up, but instead of:
item.substr(g,1)
try: item[g]
Then, go through this post:
http://www.learningjquery.com/2009/03/43439-reasons-to-use-append-correctly
( http://groups.google.com/group/jquery-en/browse_thread/thread/9889ebd5e10c9122
)
Instead of concatenating stri
6 matches
Mail list logo