Detecting Track Changes Markup In Documents
Before a document is published outside of a content management system, it is good policy to ensure that all track changes data has been handled - either accepting or rejecting the changes. While it's easy for users to select "Accept All" before publishing, it is often useful to include a check before publishing to ensure that changes haven't slipped through.
Detecting the presence of change information is simple, any document with track changes data includes a "trackchanges" element in a hidden div at the end of the body. In nearly all cases you can just check if the string "<trackchanges " is present in the document. In rare cases where there is a custom tag called "trackchanges" in the document, you may need to additionally check for the presence of the DIV before the trackchanges element.
In JavaScript you can implement this check with the code:
var hasChangeData = documentContent.indexOf("<trackchanges ") >= 0;
where the documentContent variable contains the content of the document. We'll be publishing a tip on stripping out the track changes data automatically when publishing, without having to first load it into the editor.


April 24th, 2007 at 1:12 pm
[...] have been accepted, before you push the document out to the world. We've previously shown how you can detect that change information is present, but we can go one step further and remove that information and publish the document as if all the [...]
May 1st, 2007 at 5:07 pm
[...] previous installments we've looked at ways to detect the presence of track changes data and accept the changes using XSLT. This time round, we'll use JavaScript string parsing to [...]
October 8th, 2007 at 5:06 pm
[...] Detecting Track Changes Markup In Documents [...]