-
21 May 2010 8:28 AM #1
Curious on the order of files
Curious on the order of files
I don't know the internals of webkit as well as I do Gecko, so I'm curious why in the getting started guide it is recommended to interleave the CSS and JS files in this order: CSS, JS, JS, CSS?
I would have expected the CSS together and then the JS together, but perhaps that is not the optimized order? Again, just curious...Code:<!-- Ext Touch CSS -- > <link rel="stylesheet" href="../../resources/css/ext-touch.css" type="text/css" > <!-- Ext Touch JS -- > <script type="text/javascript" src="../../ext-touch-debug.js" > </script > <!-- Application JS -- > <script type="text/javascript" src="src/index.js" > </script > <!-- Application CSS -- > <link rel="stylesheet" href="css/guide.css" type="text/css" >
-
21 May 2010 8:49 AM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,167
- Vote Rating
- 28
I wonder if the well-known paradigm of CSS up top and javascript at the bottom works for the mobile world.

Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
We are also working on Video-based Sencha Touch training: Check it out here.
-
21 May 2010 10:34 AM #3
Not sure how much the order affects mobile WebKit, but we probably should keep them up top for consistency. Thanks for highlighting.
-
24 May 2010 7:58 AM #4
i've noticed a noticeable slowdown in rendering when js files are included in the <head> in mobile safari.
i've since moved all js files to just before the closing </body> tag.
all my css includes remain in the <head>.Last edited by mystix; 24 May 2010 at 8:10 AM. Reason: added clarification
Sencha Docs / Ext 3.x - ( Docs | Examples )
Learning Center / Saki's Examples (for 2.x) / HOWTO - ( Report Bugs | Post Proper Code )
-
24 May 2010 7:59 AM #5Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,167
- Vote Rating
- 28
Is the mobile browser optimized to handle JS files in the head better than non mobile?

Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
We are also working on Video-based Sencha Touch training: Check it out here.
-
24 May 2010 8:11 AM #6
Sencha Docs / Ext 3.x - ( Docs | Examples )
Learning Center / Saki's Examples (for 2.x) / HOWTO - ( Report Bugs | Post Proper Code )
-
24 May 2010 8:13 AM #7Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,167
- Vote Rating
- 28
the rules are the same.
Includ all JS in the head, the body never gets rendered until the JS is loaded and parsed.
Include CSS in the head and JS at the bottom, the body is loaded and formatted (rendered) and then the JS is loaded
These are standard web optimization rules.
Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
We are also working on Video-based Sencha Touch training: Check it out here.
-
24 May 2010 8:15 AM #8Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,167
- Vote Rating
- 28

Put Scripts at the Bottom
tag: javascript
The problem caused by scripts is that they block parallel downloads. The HTTP/1.1 specification suggests that browsers download no more than two components in parallel per hostname. If you serve your images from multiple hostnames, you can get more than two downloads to occur in parallel. While a script is downloading, however, the browser won't start any other downloads, even on different hostnames.
In some situations it's not easy to move scripts to the bottom. If, for example, the script uses document.write to insert part of the page's content, it can't be moved lower in the page. There might also be scoping issues. In many cases, there are ways to workaround these situations.
An alternative suggestion that often comes up is to use deferred scripts. The DEFER attribute indicates that the script does not contain document.write, and is a clue to browsers that they can continue rendering. Unfortunately, Firefox doesn't support the DEFER attribute. In Internet Explorer, the script may be deferred, but not as much as desired. If a script can be deferred, it can also be moved to the bottom of the page. That will make your web pages load faster.
Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
We are also working on Video-based Sencha Touch training: Check it out here.
-
24 May 2010 8:21 AM #9
i used to think so, which is why i started developement by including everything in the head.
unfortunately, safari mobile doesn't behave the way we'd like it to.
i'm currently working on an iPad app using just ext-core and a handrolled unminified 9.7k css file (sorry devs -- started this a week before you all launched the Ext.Touch beta).
if i include ext-core,js in the <head>, there's a noticeable 0.5s - 1s delay before my styles kick in.
if i move that include to just before the closing <body> tag, that delay is gone.
Sencha Docs / Ext 3.x - ( Docs | Examples )
Learning Center / Saki's Examples (for 2.x) / HOWTO - ( Report Bugs | Post Proper Code )
Similar Threads
-
[CLOSED][3.??] Byte-order marks inside ext-lang-*.js files
By renku in forum Ext 3.x: BugsReplies: 2Last Post: 2 Dec 2009, 6:42 AM -
Curious (non-)behaviour
By neonfly in forum Ext 2.x: Help & DiscussionReplies: 2Last Post: 19 Feb 2009, 5:49 AM -
Next Revision - Curious
By patspats in forum Ext 2.x: Help & DiscussionReplies: 7Last Post: 28 Mar 2007, 10:39 AM -
Curious about examples
By baggins2000 in forum Ext 1.x: Help & DiscussionReplies: 8Last Post: 15 Nov 2006, 8:19 AM


Reply With Quote
