The first trick is interesting. This seems like a creative way to pass โglobalโ arguments from page layout to external scripts. There are ways to find the <script> element that runs the current code, and I would not be surprised if the internal text of this <script> element from the DOM were available, although the browser ignores it.
In your question, this template allows each external client side of the script to use (at least) its own localization parameters, and also allows the server code to display this parameter as a side effect of rendering the <script> the element itself. This is impressive.
The second trick, I'm not so sure. Basically, I think most browsers see an element named <g:plusone> as unknown or even invalid, so they should display its contents, but it wonโt do anything, of course, since this element is empty to start with.
However, client code may still be able to map an item to a namespace using DOM navigation and replace it with its own generated content.
Frรฉdรฉric Hamidi Jul 15 '11 at 21:33 2011-07-15 21:33
source share