[whatwg] <script> features

On Fri, Mar 23, 2012 at 9:41 PM, Ian Hickson <ian at hixie.ch> wrote:
> On Fri, 23 Mar 2012, Jonas Sicking wrote:
>>
>> The whole point of this feature is to enable the js-code inside a loaded
>> script to use the .currentScript property in order to find the <script>
>> element in the DOM which loaded it.
>
> Ah, ok. What's the use case for that?

One use case is to be able to pass parameters to a script library by
sticking the information in the markup. data-* attributes would work
great for this. I seem to recall jQuery doing something like this, but
can't find information about that right now.

In the case of ReSpec it uses it to get its own url and then use that
as a base url to load dependent scripts as needed.

/ Jonas

Received on Sunday, 25 March 2012 01:29:54 UTC