Marketpress Javascript CDATA Commenting

I was doing some prep/investigation on a web site and I noticed that the MP JavaScript uses the new style of commenting around CDATA:

<script type='text/javascript'>
/* <![CDATA[ */
var MP_Ajax = {
	ajaxUrl: "http://domain.com/wp-admin/admin-ajax.php",
	emptyCartMsg: "Are you sure you want to remove all items from your cart?",
	successMsg: "Item(s) Added!",
	imgUrl: "http://domain.com/wp-content/plugins/marketpress/marketpress-includes/images/loading.gif",
	addingMsg: "Adding to your cart...",
	outMsg: "Out of Stock"
};
/* ]]> */
</script>

Wouldn't it make more sense to use the mixed commenting as mentioned in the article linked to below?

http://www.giantisland.com/Resources/JavaScript_and_CDATA.aspx

It's potentially an issue waiting to bite someone using older browsers...

cheers
G

  • Philip John
    • DEV MAN’s Apprentice

    Hiya Gary,

    Not sure when that was written but it seems a little old. XHTML is effectively dying off now with the advent of HTML5 and so this issue with the XML parser isn't likely to be such an issue.

    Besides, any browser that wouldn't cope with that Javascript would have even more problems with WordPress itself in all likelyhood.

    Phil

  • Gary
    • Design Lord, Child of Thor

    As an aside - paste the link (http://outbackaromas.wahmboozle.com.au) the Facebook status update box - you don't need to post it, the preview comes up before you commit the post.

    The preview shows the CDATA block.

    Now do the same in Google+ and it shows real text from the page.

    So Facebook seems to be a good example of an "older browser" that can be impacted - obviously Facebook might roll out new url preview functionality soon, or they might not. While that behaviour exists, people with Marketpress on their sites might get a bit miffed at having CDATA blocks showing when they post a link to their site on Facebook?

    In another twist though... http://wp-ecommerce.org/ doesn't trigger the same issue on Facebook.

    Think I'm confusing the hell out of myself now... time to sleep methinks.

  • Gary
    • Design Lord, Child of Thor

    Cheers Mason - the more I think look at it, I wonder if it's some sort of plugin/theme interplay issue.

    Still, if a developer happened to spot something that thus far has eluded me - that'd be awesome lol

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.