[PATCH 3 of 4 V2] hgweb: add selector argument to process_dates

Martin Geisler martin at geisler.net
Mon Aug 19 02:37:13 CDT 2013


Alexander Plavin <alexander at plav.in> writes:

> # HG changeset patch
> # User Alexander Plavin <alexander at plav.in>
> # Date 1374681754 -14400
> #      Wed Jul 24 20:02:34 2013 +0400
> # Node ID 988392ad5f1e39a099a1b00c4595628420d19991
> # Parent  122061a7a549d6e3faa84a0657699b5ed705f413
> hgweb: add selector argument to process_dates
>
> Allow specifying elements to process with selector, useful for
> incremental page updates.
>
> diff -r 122061a7a549 -r 988392ad5f1e mercurial/templates/static/mercurial.js
> --- a/mercurial/templates/static/mercurial.js	Wed Jul 24 20:13:52 2013 +0400
> +++ b/mercurial/templates/static/mercurial.js	Wed Jul 24 20:02:34 2013 +0400
> @@ -168,7 +168,7 @@
>  }
>  
>  
> -function process_dates(){
> +function process_dates(selector){
>  
>  	// derived from code from mercurial/templatefilter.py
>  
> @@ -245,7 +245,11 @@
>  		}
>  	}
>  
> -    var nodes = document.querySelectorAll('.age');
> +    if (typeof selector === 'undefined') {
> +        selector = '';
> +    }
> +
> +    var nodes = document.querySelectorAll(selector + ' .age');

I think parentSelector would be a better name. At first I expected that
selector would be a general selector one could use instead of '.age'.
But then I saw that it is combined like above, meaning that selector is
specifically a parent element seletor for the '.age' elements.

Patch looks good otherwise!

>      var dateclass = new RegExp('\\bdate\\b');
>      for (var i=0; i<nodes.length; ++i){
>          var node = nodes[i];
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

-- 
Martin Geisler


More information about the Mercurial-devel mailing list