Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

fix empty script tags

#119

Loading a page with an empty script tag causes errors:

<script type='text/javascript'></script>

ERROR: [Thu Mar 18 2010 10:07:05 GMT-0500 (CDT)] {ENVJS} Error loading script. Line: null
ERROR: [Thu Mar 18 2010 10:07:05 GMT-0500 (CDT)] {ENVJS} TypeError: Cannot read property "length" from null

Reported by Brian Moschel · March 18th, 2010 @ 05:09 AM

State: resolved
Milestone: none
Assigned to: nickg nickg

Activity

  1. nickg
    nickg
    • Tag set to script

    I will look into this too. I believe my yet-to-accepted patch fixes this.

    March 18th, 2010 @ 05:36 AM

  2. Thatcher
    Thatcher

    Ah good catch, definitely shouldn't barf. empty script tags still do some
    crazy stuff in browsers (empty tags with src attributes wont load for
    example)

    March 18th, 2010 @ 07:03 AM

  3. nickg
    nickg

    My commit which rejiggered how [before|after]ScriptLoad is invoked does not have this problem.

    http://github.com/client9/env-js/commit/9d5bdb6accb90a9668ec639fe5b...

    or cutnpaste the file from

    http://github.com/client9/env-js/blob/9d5bdb6accb90a9668ec639fe5b4a...

    I understand this might not be the end-all be all of the API, but it's better and solves Brians problem.

    March 18th, 2010 @ 06:49 PM

  4. nickg
    nickg
    • State changed from new to resolved
    • Assigned user changed from Thatcher to nickg

    Thanks for filling this since it uncovered some juicy bugs!

    The problem is actually with HTMLScriptElement in that ascript.text can return NULL when it should return ''. Also it could return a partial script fragment instead of the whole script (unlikely but possible with very large scripts).

    setting script.text was also incorrect.

    Corrected, with lots of notes from spec, and a few unit tests. See commit http://github.com/thatcher/env-js/commit/d07dbde5c11bb4c80e9147bcc8... for more info (not happy with how git does diffs, but oh well).

    Let me know if this doesn't fix the issues.

    March 21st, 2010 @ 07:35 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.