git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: "J.H." <warthog9@eaglescrag.net>
Cc: git@vger.kernel.org, Kevin Cernekee <cernekee@gmail.com>
Subject: Re: [PATCH/RFC 0/3] gitweb: Split gitweb.js, improve JavaScript
Date: Sat, 26 Mar 2011 12:08:42 +0100	[thread overview]
Message-ID: <201103261208.44548.jnareb@gmail.com> (raw)
In-Reply-To: <4D8D112A.5020703@eaglescrag.net>

On Fri, 25 Mar 2011, J.H. wrote:

> The only thing I would comment on is that we may want to document (for
> the build process) a way to force a certain ordering of various files.
> Case in point we probably want to force the things like various global
> defs (what I'm proposing in the timezone stuff) at the top and let the
> function defs go below that.
 
Actually I don't think that matters, at least not if JavaScript files
contain only variables and functions, and do not include any code that
is actually run when file is loaded.  A very simple test (below) 
confirms that.

In JavaScript variable declarations ('var' keyword) and function 
definitions ('function' keyword) get "hoisted" at beginning.  

> Other than that this all looks good.

Thanks.
 
-- 8< --
<html>
<head>
<title>JavaScript test</title>
<script>
// -------------------------------------------
// B

var varB = 'varB';

function fooB() {
  fooA();
  alert('varB='+varB + '; varA='+varA);
  return 'fooB';
}


// -------------------------------------------
// A

var varA = 'varA';

function fooA() {
  alert('varA='+varA);
  return 'fooA';
}


// ===========================================
// main
fooB();
</script>
</head>
<body>
test
</body>
</html>
-- >8 --
-- 
Jakub Narebski
Poland

      reply	other threads:[~2011-03-26 11:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-25 21:46 [PATCH/RFC 0/3] gitweb: Split gitweb.js, improve JavaScript Jakub Narebski
2011-03-25 21:46 ` [PATCH/RFC 1/3] gitweb: Split JavaScript for maintability; concatenate on build Jakub Narebski
2011-03-25 21:46 ` [PATCH/RFC 2/3] gitweb: Update and improve comments in JavaScript files Jakub Narebski
2011-03-25 21:46 ` [PATCH/RFC 3/3] gitweb: Fix parsing of negative fractional timezones in JavaScript Jakub Narebski
2011-03-25 22:03 ` [PATCH/RFC 0/3] gitweb: Split gitweb.js, improve JavaScript J.H.
2011-03-26 11:08   ` Jakub Narebski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201103261208.44548.jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=cernekee@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=warthog9@eaglescrag.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).