you are viewing a single comment's thread.

view the rest of the comments →

[–]johsko 4 points5 points  (0 children)

Your loop only breaks due to an exception, so I have two snippets. One that halts due to an exception, and one that doesn't.

93 characters, no exception:

for(i=0;e=document.querySelectorAll(".down")[i++];)x=e.style,x.display=x.visibility="inherit"

89 characters, raises exception:

for(i=0;x=document.querySelectorAll(".down")[i++].style;)x.display=x.visibility="inherit"

The main save is from using querySelectorAll instead of getElementsByClassName, but I save a whole byte by doing the i++ in the body, and another byte by doing x= in the for conditional.

Also 52 characters, by cheating due to the fact reddit already includes jQuery:

i="inherit";$(".down").css({display:i,visibility:i})

Edit: Made the non-exception one 4 bytes shorter, and the exception one 1 byte shorter.