developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Opened 12 years ago

Closed 12 years ago

#525 closed bug (fixed)

2 javascript errors in jforms.js (optimized)

Reported by: catsoup Owned by:
Priority: high Milestone: Jelix 1.1 beta 1
Component: jelix:forms Version: trunk
Severity: blocker Keywords:
Cc: Blocked By:
Blocking: Documentation needed: no
Hosting Provider: Php version:

Description

the minified version of jforms.js generate 2 errors (viewed with firebug)

  • missing ; before statement
  • JForms is not defined

It might be some syntax to check in the jforms.js source looking at http://www.crockford.com/javascript/jsmin.html

A minified script made by yuicompressor work right

Change History (6)

comment:1 follow-ups: Changed 12 years ago by catsoup

I made a mistake, the compressor used is JavaScriptPacker?

This issue is fixed with the replacement of the compressor by jsmin:

Changes in build/lib/jManifest.class.php :

13 // require_once(dirname(__FILE__).'/class.JavaScriptPacker.php');
14 require_once(dirname(__FILE__).'/jsmin-1.1.1.php');
90  //  $script = file_get_contents($sourcefile);
91  //  $packer = new JavaScriptPacker($script, 0, true, false);
92  //  file_put_contents($destfile, $packer->pack());
93              
94  $packer = JSMin::minify(file_get_contents($sourcefile));
95  file_put_contents($destfile, $packer);  

comment:2 in reply to: ↑ 1 Changed 12 years ago by catsoup

Note:

  • old jforms.js size is 6,4K
  • new jforms.js size is 6,5K

But on an apache 2.2.4 server (Ubuntu), served gzipped file size is 6K against 7K for the old jforms.js file (according to firebug)

comment:3 in reply to: ↑ 1 Changed 12 years ago by catsoup

Note 2: jsmin and yuicompressor generate exactly the same files

comment:4 in reply to: ↑ 1 Changed 12 years ago by catsoup

(sorry for the blabla) In fact, I made a mistake above, jforms.js compressed with yui is 5,9K and that's why the server show a size of 6K (I thought it was the one generated by jsmin)

Finally here are all sizes possibles:

  • JavaScriptPacker? (dist jforms) 6,4 K (one line)
  • yuicompressor 5,9 K bytes (one line)
  • jsmin generated by php 6,5 K (multiples lines)

and the generated by jsmin is NOT the same as the one generated by YUI (sorry)

comment:5 in reply to: ↑ 1 Changed 12 years ago by catsoup

Last note:

About the gzipped sizes, I just was completely wrong, my server wasn't properly set.

All tested files have a size of 2 K gzipped

comment:6 Changed 12 years ago by laurentj

  • Resolution set to fixed
  • Status changed from new to closed

I added missed ";" in jforms.js.

Note: See TracTickets for help on using tickets.