[whatwg] <script> features

Aryeh Gregor ayg at aryeh.name
Sun Mar 25 12:45:17 PDT 2012


On Sun, Mar 25, 2012 at 4:29 AM, Jonas Sicking <jonas at sicking.cc> wrote:
> 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.

testharness.js also does that, I think -- it loads a CSS file from the
same directory as itself.  IIRC, it does so by looking for the first
<script> whose src ends in "testharness.js".  It would be more
reliable if it could record the actual URL it's being loaded from.

(For this use-case it would be enough for the script to get its own
URL.  In fact, this might be slightly more reliable, because there's
nothing to stop an earlier part of the script from inadvertently
changing the <script> element's src.  That wouldn't satisfy the first
use-case Jonas mentioned, though.)



More information about the whatwg mailing list