[PATCH] hgweb: call process_dates() via DOM event listener
Anton Shestakov
av6 at dwimlabs.net
Thu Jan 12 00:43:49 EST 2017
On Wed, 11 Jan 2017 19:38:17 -0800
Gregory Szorc <gregory.szorc at gmail.com> wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1484110068 28800
> # Tue Jan 10 20:47:48 2017 -0800
> # Node ID 79314c9a79b3aa033b6f79d066b97d7157ecac33
> # Parent 9cb0bb0f29f06fa88ac4f41d8743871b33c48548
> hgweb: call process_dates() via DOM event listener
>
> All the hgweb templates include mercurial.js in their header. All
> the hgweb templates have the same <script> boilerplate to run
> process_dates(). This patch factors that function call into
> mercurial.js as part of a DOMContentLoaded event listener.
>
> diff --git a/mercurial/templates/static/mercurial.js b/mercurial/templates/static/mercurial.js
> --- a/mercurial/templates/static/mercurial.js
> +++ b/mercurial/templates/static/mercurial.js
> @@ -433,3 +433,7 @@ function ajaxScrollInit(urlFormat,
> window.addEventListener('resize', scrollHandler);
> scrollHandler();
> }
> +
> +document.addEventListener('DOMContentLoaded', function() {
> + process_dates();
> +}, false);
Nit: any particular reason for the third argument (false) to be here at
all? If I'm reading [1] correctly, useCapture already defaults to false.
[1]: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
More information about the Mercurial-devel
mailing list