Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SORT_ATTRIBUTES by default #196

Closed
epa opened this issue Feb 4, 2016 · 1 comment
Closed

SORT_ATTRIBUTES by default #196

epa opened this issue Feb 4, 2016 · 1 comment

Comments

@epa
Copy link
Contributor

epa commented Feb 4, 2016

(following on from issue 106)

There is a flag $CGI::Util::SORT_ATTRIBUTES to make CGI.pm output HTML elements in deterministic order. Without it, under recent perl versions, the HTML output will change randomly from one run to the next. The test suite has been fixed to set the flag where necessary. But I suggest that the most useful course of action all round is to set the flag by default.

Most applications will benefit from making the HTML output deterministic (as it always used to be, at least within a single machine and perl version). For example, sites such as the Internet Archive monitor a page to see whether it is different from the previous version.

I think the 'cost' of sorting hash keys is really a non-issue. The hash of attributes in an HTML element contains at most a dozen elements, and the sorting is done in C code. It is not going to make any real world difference to the performance of the page. (Indeed, if the attributes appear in a regular order the HTML will be more compressible by gzip, so is likely to load slightly faster in the case where Deflate compression is used in the HTTP request.) So please could I ask that sorting keys be turned on by default.

@leejo leejo closed this as completed in b54f4f4 Feb 4, 2016
@leejo
Copy link
Owner

leejo commented Feb 4, 2016

v4.26 on its way to CPAN. Ta!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants