Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #21751

Re: Importing multiple .js files

Message-ID <4401911.7nMNhKR3Lp@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2013-10-27 15:38 +0100
Subject Re: Importing multiple .js files
Newsgroups comp.lang.javascript
References (2 earlier) <m2ppqr1x7n.fsf@nntp.bednarz.nl> <3382075.QeW2rGUY4L@PointedEars.de> <m2hac31uku.fsf@nntp.bednarz.nl> <69167318.yBAuBtPbmc@PointedEars.de> <m261sjw12h.fsf@nntp.bednarz.nl>

Show all headers | View raw


Eric Bednarz wrote:

> Thomas 'PointedEars' Lahn <PointedEars@web.de> writes:
>> Eric Bednarz wrote:
>>> Thomas 'PointedEars' Lahn <PointedEars@web.de> writes:
>>>> How did you get that idea?  You are also not considering that the
>>>> number of parallel HTTP requests is limited,
>>> ... to an average of 6 to 8 requests per hostname, these days.
>>
>> How did you get that idea?
> 
> Since you have namedropped Steve Souders at Jukka in this thread, there
> you go:
> 
> http://www.browserscope.org/?category=network&v=top

The test results are flawed.  Unsurpringly, that site is _not_ authored by 
Steve Souders who consciously speaks about *servers* (or hosts, if you 
prefer), _not_ host *names*.

>>> We were talking about less than ten scripts.
>>
>> Were we?
> 
> If 'we' includes the OP, yes.

,-<C76dnbrbpPTL3vfPnZ2dnUVZ5smdnZ2d@giganews.com>
| 
| I might want to import anywhere between 5-10 Javascript files (*.js) into
| one document.

As far as I am concerned, 10 is _not_ less 10.

>>> Map that to 'usually'.
>>> 
>>> - one script can be parsed while another one downloads
>> No, in general it cannot.
> 
> Lazy parsers can, and do.

How, and where?

>> As I have had to realize with regard to my code,
>>
>>   /* part 1 */
>>   var f = function () {};
>>
>>   /* part 2 */
>>   var f2 = (function () {
>>     /* function */
>>     var _f = f;
>>
>>     return function () {
>>       return _f;
>>     };
>>   }());
>>
>> has a different result than
>>   
>>   /* part 1 */
>>   var f2 = (function () {
>>     /* undefined */
> 
> Try that in Chakra instead.

Why should I, and in which version exactly?

>>     var _f = f;
>>
>>     return function () {
>>       return _f;
>>     };
>>   }());
>>
>>   /* part 2 */
>>   var f = function () {};
> 
> But even implementations that won't start producing the AST before all
> pending scripts have been retrieved can benefit from parallel
> loading.

No doubt about that.  It is, however, all based on the assumption that 
parallel loading of scripts can take place; that is, all the conditions that 
make this possible are met.  That is assuming a lot.

> You have to take take care of correct execution order,

*After* loading, yes.

> of course, but that's not difficult these days.

It never was.  The scripts must executed in HTML source code order unless 
“defer” is used.  Before that, all declarations in the global execution 
context have to be processed.

>>> - meanwhile, the DOM can be parsed, too
>>
>> No, it (the _document_; the DOM is an *API* instead) cannot: Client-side
>> scripts can modify the document while it is being parsed.
> 
> Pardon? If you load script dynamically, […]

You are confusing the issues here.
 
>> There is one exception to this rule, and that is when the (formerly,
>> proprietary) “defer” attribute is specified on the “script” element,
>> *and* supported (but document.write() cannot be used there).
> 
> Ugh. Defer is utterly unsafe in Internet Explorer 9 and older if any but
> the last deferred script modifies the DOM.

I believe I have said that.

-- 
PointedEars

Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Importing multiple .js files "Robert Crandal" <rcranz143101@gmail.com> - 2013-10-25 03:09 -0700
  Re: Importing multiple .js files Stefan Weiss <krewecherl@gmail.com> - 2013-10-25 13:06 +0200
    Re: Importing multiple .js files Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-10-25 22:18 +0200
      Re: Importing multiple .js files "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2013-10-26 00:05 +0300
        Re: Importing multiple .js files Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-10-25 23:54 +0200
          Re: Importing multiple .js files John Harris <niam@jghnorth.org.uk.invalid> - 2013-10-27 14:05 +0000
            Re: Importing multiple .js files Christoph Michael Becker <cmbecker69@arcor.de> - 2013-10-27 17:05 +0100
              Re: Importing multiple .js files John Harris <niam@jghnorth.org.uk.invalid> - 2013-10-28 15:40 +0000
                Re: Importing multiple .js files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-10-28 15:49 +0000
                Re: Importing multiple .js files John Harris <niam@jghnorth.org.uk.invalid> - 2013-10-29 16:29 +0000
                Re: Importing multiple .js files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-10-29 20:41 +0000
                Re: Importing multiple .js files John Harris <niam@jghnorth.org.uk.invalid> - 2013-10-31 09:31 +0000
                Re: Importing multiple .js files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-10-31 13:30 +0000
                Re: Importing multiple .js files Christoph Michael Becker <cmbecker69@arcor.de> - 2013-10-29 22:13 +0100
                Re: Importing multiple .js files Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-10-30 00:50 +0100
                Re: Importing multiple .js files John Harris <niam@jghnorth.org.uk.invalid> - 2013-10-31 15:52 +0000
                Re: Importing multiple .js files Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-10-31 17:19 +0100
                Re: Importing multiple .js files John Harris <niam@jghnorth.org.uk.invalid> - 2013-11-01 15:27 +0000
                Re: Importing multiple .js files Christoph Michael Becker <cmbecker69@arcor.de> - 2013-10-31 18:34 +0100
                Re: Importing multiple .js files "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2013-10-31 20:36 +0200
                FAQ discussion (was: Importing multiple .js files) Christoph Michael Becker <cmbecker69@arcor.de> - 2013-10-31 20:33 +0100
                Re: FAQ discussion Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-11-06 12:20 +0100
                Re: FAQ discussion Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-11-06 14:33 +0100
                Re: Importing multiple .js files John Harris <niam@jghnorth.org.uk.invalid> - 2013-11-01 15:12 +0000
                "javascript" (was: Importing multiple .js files) Christoph Michael Becker <cmbecker69@arcor.de> - 2013-11-04 18:36 +0100
                Re: "javascript" (was: Importing multiple .js files) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-11-05 02:41 +0100
    Re: Importing multiple .js files Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2013-10-27 00:30 +0200
      Re: Importing multiple .js files Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-10-27 00:58 +0200
        Re: Importing multiple .js files Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2013-10-27 01:27 +0200
          Re: Importing multiple .js files Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-10-27 02:37 +0200
            Re: Importing multiple .js files Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2013-10-27 09:49 +0100
              Re: Importing multiple .js files Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-10-27 15:38 +0100
                Re: Importing multiple .js files Eric Bednarz <bednarz@fahr-zur-hoelle.org> - 2013-10-27 16:11 +0100
                Re: Importing multiple .js files Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-10-27 20:16 +0100
      Re: Importing multiple .js files Stefan Weiss <krewecherl@gmail.com> - 2013-10-27 02:01 +0100
        Re: Importing multiple .js files danca <cyberdanny@tiscalinet.it> - 2013-10-27 11:30 +0100
  Re: Importing multiple .js files nappysoft <nappysoft@gmail.com> - 2013-11-21 05:53 -0800
    Re: Importing multiple .js files Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-11-21 16:15 +0100

csiph-web