Skip to content

External scripts are evaluated async #331

Open
@brauliobo

Description

@brauliobo

As external scripts are removed from the content and then evaluated by inserting them into head, they end up being evaluated async which causes somes dependent symbols not to work. See this example

<script src='external_script_with_function'/>
<script type='text/javascript'>
  function_from_external_script_above();
</script>

function_from_external_script_above() won't work!

Commenting the line obj.scripts = findAll(obj.contents, 'script[src]').remove() workarounded the issue.

I understand that a sync evaluation may hang the application, but as this example demonstrate it is necessary on some cases. I suggest a configuration to support both behaviours or support only the sync behaviour.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions