Search code examples
javascriptrevisions

Content (blogs, articles) revision: Serverside or JS?


What is the best place to calculate differences between two versions of a text (and add corresponding "removed" and "added" css classes)?

Should this be done at the server or is it better to have client-side JS handle this?


Solution

  • Unless you do something crazy, it shouldn't be possible to determine the revisions with just JS if you're looking at simple DOM content.

    You'll want to use a combination of server-side code and JS to handle the revision checking to create a system like this, but classes like removed and added should probably be created server-side.