[aur-dev] [PATCH v2 3/3] pkg_comments.php: Add JavaScript function to edit comments

Lukas Fleischer lfleischer at archlinux.org
Tue Jul 21 17:02:26 UTC 2015


On Tue, 21 Jul 2015 at 18:49:01, Marcel Korpel wrote:
> * Lukas Fleischer <lfleischer at archlinux.org> (Tue, 21 Jul 2015 18:34:27
> +0200):
> >> +                       _this = $(this);
> > 
> > Do we need an extra variable here?
> 
> Yes, we need to copy 'this' here to be able to use it within the
> callback function, where 'this' has a different meaning.
> 

Sounds sensible. Thanks for clarifying!

> > > +                        pkgbase_name: '<?=
> > > htmlspecialchars($pkgbase_name) ?>'},
> > 
> > Can we use htmlspecialchars() here? If it is the right function to
> > use, we need to add ENT_QUOTES at least...
> 
> Nope, we need json_encode() here.
> 

Okay!

> > 
> > > +                       function (data) {
> > 
> > Broken indentation?
> 
> Why? I indented all parameters with one tab, putting them on one line
> creates a very long line.
> 

Not sure. Looking at the existing JavaScript code in our code base, it
seems like we prefer the following indentation style:

    $.getJSON([...], {
    	[...] /* parameters here */
    }, function(data) {
    	[...] /* function body here */
    });

> You're correct about all the other things you mentioned.


More information about the aur-dev mailing list