#33 ✓resolved
Rémy THEROUX

Prototype 1.6.0.2 - Element#update evaluation problem with <script src="path">

Reported by Rémy THEROUX | November 5th, 2008 @ 11:26 AM

Hi, It's my first contribution to prototype, i hope my first post will be well formated. I search for an existing ticket but i didn't see one on this subject.

The problem is that when i use the function Element.update() with a HTML content like that,


<script type="text/javascript" src="myfile.js"></script>
<script type="text/javascript">;
    alert('Hello');
</script>

The extern script (with attribute src) doesn't appear in the HTML element and isn't loaded. The other one (alert('Hello');) works.

I have the same behavior with FF2, FF3 and IE7. When using Element.innerHTML to update content the both script are loaded correctly.

This problem appears with an Ajax.Request call, and all Objects in myfile.js are not evaluated.


new Ajax.Request('index.php', {
      parameters: myParam,
      evalJS: true,
      mehtod: 'post',
      onComplete: function(oXmlHttpResponse) {
            $('myelement').update(oXmlHttpResponse.responseText);
      }
});

Hope this is a real problem and not an error from me. Thanks

Comments and changes to this ticket

  • Juriy Zaytsev

    Juriy Zaytsev November 5th, 2008 @ 03:03 PM

    • Milestone cleared.
    • State changed from “new” to “doc”
    • Assigned user set to “T.J. Crowder”

    Scripts with src (and without content) are not downloaded/parsed by prototype. I'll mark this as a documentation bug (it should be mentioned in evalScripts section of the API docs)

  • Rémy THEROUX

    Rémy THEROUX November 5th, 2008 @ 05:54 PM

    Ok thanks a lot for information, Just one thing: don't eval/load/download script with src is a fact but one problem is that the element

    For me it's two different things, i have my own function that load extern javascript (probably not a good practice...) so in this case i can't use Element#update.<\/p>

  • Rémy THEROUX

    Rémy THEROUX November 5th, 2008 @ 05:56 PM

    Sorry problem with script

    Ok thanks a lot for information, Just one thing: don't eval/load/download script with src is a fact but one problem is that the element script disapear from the code.

    For me it's two different things, i have my own function that load extern javascript (probably not a good practice...) so in this case i can't use Element#update.

  • T.J. Crowder

    T.J. Crowder November 14th, 2008 @ 05:26 PM

    • State changed from “doc” to “resolved”

    Updated both update and evalScripts to clarify that tags referencing external files are not supported.

    We might consider supporting them, though. We couldn't give a return value, but it's easy enough to extract them separately and add them to the header. Would require mucking about in a couple of places, though, for little real gain...

  • Tobie Langel

    Tobie Langel July 24th, 2009 @ 02:11 AM

    • Tag changed from element, javascripte, script, update to element, section:dom

    [not-tagged:"dom" tagged:"section:dom" bulk edit command]

  • Tobie Langel

    Tobie Langel July 24th, 2009 @ 02:12 AM

    • Tag changed from element, section:dom to section:dom

    [not-tagged:"element" bulk edit command]

  • Tobie Langel

    Tobie Langel November 29th, 2009 @ 07:18 PM

    • Milestone cleared.
    • Assigned user changed from “T.J. Crowder” to “Samuel Lebeau”
  • Tobie Langel

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.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

Pages