tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Onno Scheffers (JIRA)" <...@tapestry.apache.org>
Subject [jira] Commented: (TAPESTRY-2364) YSlow Recommendation: Write Scripts at bottom of page
Date Mon, 06 Oct 2008 19:37:44 GMT

    [ https://issues.apache.org/jira/browse/TAPESTRY-2364?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12637193#action_12637193

Onno Scheffers commented on TAPESTRY-2364:

> But the DOM isn't loaded any faster just because you put the script tag further up in
your document, you still need to load the entire page first.

Well, the DOM is loaded faster if you put the scripts tags outside of the HEAD tag, since
the browsers waits until everything in the HEAD is loaded, while it doesn't wait for resources
outside of the head. So it does give a speedup if you place the scripts at the bottom of the

> If I understand your concern, you want your user to see a blank page while waiting for
scripts in <head> to load, rather than your user seeing the full page while waiting
for scripts at the bottom of the page to load?

That's right. Usually css-files are placed in the HEAD to make sure they are loaded before
rendering. But often Javascript is used for toggling styles or hiding things as well, so it
should be possible to execute that Javascript before the page is shown to the user.

> I believe that's the opposite of what most others want so it should probably not be the
default behaviour.

I'm not sure I agree. If you look at any of the example pages of any of the Javascript-frameworks.
They pretty much all use a dom:loaded event to alter the HTML before the page gets rendered
and it's not just Prototype. It's also one of the first items the JQuery tutorial teaches
you for example:

> I believe putting scripts at the bottom so that the page renders faster is likely what
most people want. If someone actually wants the page to render slower or needs to execute
a script before the dom is loaded, there could be a simple workaround or a configuration option
for putting scripts at the top of the page.

It is really quite common to have the Javascript in the HEAD section and currently it is not
possible in Tapestry. It should at least be configurable. I still think it should be default
behavior as well since you are forcing people to change the configuration to do the most-common
thing, while usually you'll start configuring things only if you want to tweak the performance.

Also, the overhead of placing those files in the HEAD is minimal, since the browser caches
the js-files.

> YSlow Recommendation: Write Scripts at bottom of page
> -----------------------------------------------------
>                 Key: TAPESTRY-2364
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2364
>             Project: Tapestry
>          Issue Type: Improvement
>          Components: tapestry-core
>            Reporter: Howard M. Lewis Ship
>            Assignee: Howard M. Lewis Ship
>            Priority: Minor
>             Fix For: 5.0.12
> Tapestry is already doing a good job on this, by writing the dynamically generated <script>
block at the bottom of the page, but the external scripts should also be down there.
> http://developer.yahoo.com/performance/rules.html#js_bottom

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org

View raw message