What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 130 Stack Exchange communities.

I assume everyone has used the "interesting tags" feature. You select a tag and the questions with selected tag are highlighted by addition of the CSS class tagged-interesting.

The highlighting is done by JavaScript after the DOM is loaded (because it was not working when JS was disabled). So, until the DOM is completely loaded, there is no highlighting. Since I am on a slow connection, the highlighting takes place only after a long time (around 5-6 secs).

Why was JavaScript was used for this, when it could have been done server-side by simply adding the class? That wouldn't have caused much overhead to the server.

I want to know the rationale behind it (I am sure it exists) because, as recently I learned during my internship, JavaScript should strictly be used for user interaction purposes (like up-voting).

Am I thinking along the wrong lines?

share|improve this question

migrated from stackoverflow.com Feb 28 '10 at 18:50

This question came from our site for professional and enthusiast programmers.

    
one could argue that this is a strictly user interaction type functionality. –  Joseph Silvashy Feb 28 '10 at 18:48

2 Answers 2

up vote 7 down vote accepted

SO makes use of page cacheing that would be tossed out the window if they did this server-side. Consider that would require every users page would need to be cached, not so efficient.

share|improve this answer
    
can't the main page be cached and when it is served, the classes are added accordingly? –  nvl Feb 28 '10 at 19:00
    
@Joseph : could you please elaborate? :) thanks –  nvl Feb 28 '10 at 19:33
    
@nvl I suggest you read the blog a little, and also listen to the podcasts (especially the earlier ones). You'll get some interesting insights and behind-the-scene details about Stack Overflow. blog.stackoverflow.com –  balpha Feb 28 '10 at 19:38
    
@balpha : thanks will do that. –  nvl Mar 1 '10 at 0:08

My guess is that it simplifies caching html. No need to store both variants in cache.

share|improve this answer
    
Poor excuse - they all render per-user data at some point to know which questions to feature. They could instead render a per-user css file and adjust the html so each tag also has it's own css class that matches the tag name. That would work in at least the technical sense. I think the problem might be if google frowns on per-user css, because it could be used to hide data in a way that's hard for them to detect. –  Joel Coehoorn Mar 1 '10 at 2:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .