From the Flattr Javascript API description:
<script type="text/javascript">
<!--//--><![CDATA[//><!--
(function() {
var s = document.createElement('script'), t = document.getElementsByTagName('script')[0];
s.type = 'text/javascript';
s.async = true;
s.src = 'http://api.flattr.com/js/0.5.0/load.js';
t.parentNode.insertBefore(s, t);
})();
//--><!]]>
</script>
I am a bit curious about the <!--//--><![CDATA[//><!--
and //--><!]]>
. I guess that are some hacks to trick old browsers who don't understand the <script>
-tag. But isn't the <!--
enough? What exactly is the CDATA
stuff about? And if I don't care about old browsers, all this is obsolete anyway, right? (Btw., does someone know any browser at all who would get confused if I would not put this stuff there?)
Then I wonder about the function definition. Why is it there? Why not call the code directly? Is it to not spam the global namespace? If so, aren't there easier, less hacky ways to do this, e.g. just putting the code into {}
?