[PATCH 2 of 2] paper: call ajaxScrollInit in shortlog

Martin Geisler martin at geisler.net
Fri Sep 20 01:34:24 CDT 2013


Alexander Plavin <alexander at plav.in> writes:

> 19.09.2013, 10:59, "Martin Geisler" <martin at geisler.net>:
>> Alexander Plavin <alexander at plav.in> writes:
>>
>>>  # HG changeset patch
>>>  # User Alexander Plavin <alexander at plav.in>
>>>  # Date 1378459857 -14400
>>>  #      Fri Sep 06 13:30:57 2013 +0400
>>>  # Node ID 0032f7b54b7bb23b35574f774d37ba763a8e5199
>>>  # Parent  0a792989e90204557812427f02ba2f176f08d8c1
>>>  paper: call ajaxScrollInit in shortlog
>>>
>>>  This just calls ajaxScrollInit at the shortlog page template with
>>> all needed
>>>  agruments. So, infinite scrolling is working now there.
>>>
>>>  diff -r 0a792989e902 -r 0032f7b54b7b
>>> mercurial/templates/paper/shortlog.tmpl
>>>  --- a/mercurial/templates/paper/shortlog.tmpl Wed Sep 18 22:44:12
>>> 2013 +0400
>>>  +++ b/mercurial/templates/paper/shortlog.tmpl Fri Sep 06 13:30:57
>>> 2013 +0400
>>>  @@ -71,6 +71,18 @@
>>>   | rev {rev}: {changenav%navshort}
>>>   </div>
>>>
>>>  +<script type="text/javascript">
>>>  +    ajaxScrollInit(
>>>  +            '{url|urlescape}shortlog/%hash%',
>>>  +            '{nextentry%"{node}"}', <!-- NEXTHASH
>>
>> I'm missing something here... This HTML comment looks unclosed to me?
>> Would '//' not be more appropriate for a comment inside JavaScript?
>
> It's valid JS code, such one-line comments are allowed (look
> http://www.javascripter.net/faq/comments.htm for example).

Wow, that's... strange. I found this answer on SO:

  http://www.javascripter.net/faq/comments.htm

which says it's a non-standard feature always implemented by browsers
and JavaScript engines. The answer pointed to this definition:

  http://javascript.spec.whatwg.org/#comment-syntax

The section about comments in the ECMA script 5.1 spec doesn't mention
this syntax:

  http://ecma-international.org/ecma-262/5.1/#sec-7.4

> I used <!--' instead of '//' because with '//' it's possible (through
> very unlikely) that such sequence (like "'abc', // NEXTHASH") appears
> in a commit message, but the same is impossible for '<!--' as '<' is
> always replaced with corresponding html entity on the page.

Surely such a commit message is JSON encoded before being put into the
page? If so, then I don't understand why you cannot use the normal
normal comment syntax.

-- 
Martin Geisler


More information about the Mercurial-devel mailing list