[Greasemonkey] e4x
Stéphane Payrard
stef at stefp.dyndns.org
Fri Feb 10 16:15:24 EST 2006
How one can use e4x in a greasemonkey script?
What are the best ressources for scripting in firefox?
I have GreaseMonkey hacks but I have not fisnished reading it yes.
Mark Thx for that good book.
The best uptodate ressource I know for firefox is
http://developer.mozilla.org/ but is pretty short and cryptic on e4x :
http://developer.mozilla.org/en/docs/e4x
Here what it says :
Note: In Gecko 1.8 based browsers such as Firefox 1.5, E4X is already
partially enabled for web page authors. To fully enable E4X, the
<script> element needs to have the MIME type "text/javascript;e4x=1"
(i.e. have an attribute of the form type="text/javascript;e4x=1"). The
difference between the two modes is that without the "e4x=1" MIME
type, any statement-level XML/HTML comment literals (<!--...-->) are
ignored for backwards compatibility with the comment hiding trick, and
CDATA sections (<![CDATA[...]]>) are not parsed as CDATA literals
(which leads to a JS syntax error in HTML since HTML does not support
CDATA sections).
I don't know what they mean by partially enabled.
Also, I don't know enough about CDATA and comments to know
how they works on different browser.
Apparently it allows to write inline scripts without escaping
charactere like '<'.
http://blog.codingforums.com/index.php/main/blogentry/introduction_to_e4x_part_1_reading_xml/
shows a variation of the same trick.
<script type="application/x-javascript; e4x=1">
//<![CDATA[
//]]>
</script>
Finally, I can't see how to apply these idioms do greasemonkey.
Thx in advance for your help.
--
cognominal stef
More information about the Greasemonkey
mailing list