[OpenAjaxIDE] Should macro substitution work on<require>JavaScript files?
Kin Blas
jblas at adobe.com
Tue Aug 5 11:19:55 PDT 2008
But what if the developer needs to configure/initialize something with
data related to a specific instance before something is included? How
would someone set something up like this?
<script type="text/javascript">
var GalleryConfiguration = {
autoStart: true,
selector: "#main .slideshow"
};
</script>
<script type="text/javascript" src="gallery.js"></script>
Where the selector was something the developer expected the user to
provide? Based on current location attribute values, it seems like the
assumption for <javascript> is that it will be inserted inside the
<body>. What mechanism does a developer have to insert a templated piece
of code into the head?
If you say that we can extend the <javascript> "location" attribute to
insert into the head, how do we say that we need it to go *before* a
specific <require> includeRef?
Other related questions I was going to bring up:
- Is the expectation that the content of a <javascript> tag be just the
JS code? That is there should be know <script>/</script> wrapper tags
around the code inside the <javascript> tag.
- I just wanted to confirm that <![CDATA[]]> is only needed for most
tags if special chars are included, right? So if I have some
<javascript> code and it never uses '<', '>', I don't need to wrap it
with <![CDATA[]]> right?
- <preload> and <postload> code ... can this code contain macros? (You
asked this one already.)
- <postload> code ... does this mean insert the code immediately after
the <script> or <link> tag? What happens if the asset is an image or
other non CSS/JS asset? Some browsers like Safari load CSS async.
--== Kin ==--
-----Original Message-----
From: ide-bounces at openajax.org [mailto:ide-bounces at openajax.org] On
Behalf Of Lori Hylan-Cho
Sent: Tuesday, August 05, 2008 10:27 AM
To: Jon Ferraiolo; ide at openajax.org
Subject: Re: [OpenAjaxIDE] Should macro substitution work
on<require>JavaScript files?
That's my opinion, too. Localizable/substitutable properties can be
extracted into a single group of js variables and included as a
<javascript> block. (In fact, that would make things oh so much easier
for tools in general. :-P)
> -----Original Message-----
> From: ide-bounces at openajax.org
> [mailto:ide-bounces at openajax.org] On Behalf Of Jon Ferraiolo
> Sent: Tuesday, August 05, 2008 1:21 PM
> To: ide at openajax.org
> Subject: [OpenAjaxIDE] Should macro substitution work on
> <require>JavaScript files?
>
> Right now, we have decided that macro substitution:
>
> * property substitution such as @@foo@@
> * localization substitution such as %%bar%%
> * Gadget-related substitution such as __GID__
>
> applies to the following elements: <content>, <javascript>,
> <description>, <title>, <remarks>, <example>, <license>,
> <author>, <aboutMe> and <quote>
>
> The question for today is question macro substitution should
> also occur on <require> content. One significant use case is
> <require type="javascript">, where the JavaScript might
> contain __GID__ strings.
>
> My guess is that we should *NOT* do macro substitution on
> <require> and tell developers that if they need to have
> JavaScript that uses __GID__ or localized content or
> whatever, they should use the <javascript> element instead of
> the <require> element.
>
> Jon
>
>
> ============ EARLIER EMAIL ================
>
> Javier responds to Jon:
> --------------------
> I had always assumed that the variable substitution only
> worked on the content inside the spec XML file itself. From
> what I can tell, this is how Google Gadgets work.
>
> However, I can see how this would be a valuable feature,
> especially for localization bundles. Bring this up in the
> meeting today, and see what everyone agrees on. Either way,
> whatever the spec says we'll implement...
> --------------------
>
> Jon asks:
> --------------------
> I noticed that if I use __GID__ within some JavaScript inside
> of a <content> element, macro substitution works, but if I
> take the same JavaScript and put it into a separate JS file
> that is loaded via <require type="javascript" src="..."/>,
> the macro substitution does not seem to occur. Does this
> sound right? I just wanted to see what you thought. There is
> always the <javascript src="..."/> option, which (I assume)
> would trigger macro substitution. (<javascript src=> is not
> yet implemented in the refimpl)
>
> Whatever, the spec needs to be clear on all of this.
> --------------------
>
>
>
_______________________________________________
IDE mailing list
IDE at openajax.org
http://openajax.org/mailman/listinfo/ide
More information about the IDE
mailing list