YUI3 update - impact on inputEx

3 views
Skip to first unread message

mingfai

unread,
Nov 25, 2008, 11:44:53 AM11/25/08
to inputex
hi,

Whoever hasn't subscribe to the YUI mail list, please find the latest
information about YUI3 at:
http://tech.groups.yahoo.com/group/yui3/message/242

The current target release date of YUI3 PR2 is mid-Dec.

I had little exp with YUI3 PR1 before. The following are some items
that i found very useful / improved:
- provision of a base class that manages attributes, events etc.
- some very useful lang/util api like bind, each, queue etc.
- the language syntax more concise, in fluent api, (and looks like
JQuery?! :-) ) etc.

The widget base class is recently announced. I suppose our Field and
mainly items will turn to extend the widget class. it will sth we
should closely look at.

Eric has done a very good job to make the current inputEx very
extensible (easy to make new fields), and i think it's opportunity to
make further improvement to upgrade to YUI3. Given the improvement in
syntax, it will make the lib much easier to maintain. The following
are some areas that we may work on during the upgrade:
- *standardize the way to define configuration/property/attributes,
and ensure the attributes will be generated in the docs.
- review and docs events
- handle progressive enhancement
- review/improve the handling of group and form, introduce concepts
of TabView Form, AccordionView Form, Wizard Form etc.
- introduce conepts of validator and template
- enhance the form/group to support using dataSource to load data
- separate construction and render()
etc.

Please help to raise any important issue that we should cater for the
upgrade.

regards,
mingfai

bkc

unread,
Nov 25, 2008, 12:10:29 PM11/25/08
to inputex
On Nov 25, 11:44 am, mingfai <mingfai...@gmail.com> wrote:

> Please help to raise any important issue that we should cater for the
> upgrade.

Could we start running the inputEx code through jslint to clean it up
some?


Mingfai

unread,
Nov 25, 2008, 8:37:06 PM11/25/08
to inp...@googlegroups.com
good idea. I tried to paste the code of Field.js to the jslint box and it has quite a number of suggestions.

is it good to follow jslint exactly? which options we should enable? (e.g. Assume a Yahoo Widget) And do you know any way to run it other than copy-and-paste to the box? i have no experience about it but i agree there should be a coding convention to follow.

btw, it stimulates me the think about the following ideas:
  • unit test with YUI (there was actually an issue fired already)
  • introduce / utilize Yahoo logger
    • recently, i learnt about a way to use a Bookmarklet to create the logger panel, and that's a better approach that start one in the code;
    • and for YUI3 logger, it automatically send the log the to FF3 console
  • build script / process
    • not sure if there is a way to automatically run unit test with a shell script
    • in java, there are mature build script frameworks that automatically run unit test and generate report / alerts.
regards,
mingfai

Patrick Donelan

unread,
Nov 25, 2008, 9:02:19 PM11/25/08
to inp...@googlegroups.com
Hi Mingfai,

You can run jslint locally with rhino. e.g. in ubuntu:

sudo apt-get install rhino
wget http://jslint.com/rhino/jslint.js
rhino jslint.js myfile.js

And you can put your jslint options into the file as /*jslint ... */ comments (see http://jslint.com/lint.html for full list of options).

In my build environment I have a perl unit test that locates all the js files in my project, runs them through rhino and then looks at the output to make sure they passed cleanly.

Some IDEs have jslint support built-in which is handy for instant feedback while you're developing.

Cheers,

Patrick
http://patspam.com

Mingfai

unread,
Nov 25, 2008, 9:25:04 PM11/25/08
to inp...@googlegroups.com
looks like Intellij IDEA 8 doesn't support jslint, and I do development on Windows. perhaps that could be integrated to the build script. for myself, i use the web form with the Yahoo Widget option first.

If Eric read this thread by chance, could you share what IDE u use, if any? My IDE has a code formating function but i dare not to format the inputEx code.  If we could establish a standard, i could configure my IDE for that. (it would be the best if we take the Intellij IDEA 8 default for Javascript as the standard! :-) ) Jetbrains offer free license to open source project.

regards,
mingfai

bkc

unread,
Nov 25, 2008, 10:14:00 PM11/25/08
to inputex
You didn't ask me, but I am using eclipse on ubuntu.

I also run jslint via rhino from the command line. I think you can do
that on windows easily as well.

Regarding "is it good to follow". Sometimes it seems too picky to me
but I do my best to resolve all the issues it reports.

I think some of the the biggest changes needed for inputEx will be not
assigning values to method/function parameters, not declaring a
variable more than once and putting braces around one-liner "if"
brances.

As far as automating it's use in a build script.. I think it'd be
acceptable to have a script that checks all the modules, a developer
could run before generating a patch or committing to svn.

You can also use rhino for unit tests, though I'm not sure how much
that is worth it on this project since much of it relies on YUI
interaction. I do not know how easy it is to test that.

Alberto Santini

unread,
Nov 26, 2008, 3:57:25 AM11/26/08
to inputex


On Nov 26, 2:37 am, Mingfai <mingfai...@gmail.com> wrote:
> is it good to follow jslint exactly? which options we should enable? (e.g.
> Assume a Yahoo Widget) And do you know any way to run it other than
> copy-and-paste to the box? i have no experience about it but i agree there
> should be a coding convention to follow.

I follow strictly the advices of the JSLint, but I am a strong fan of
JSLint.

I have been using good parts options:

bitwise: true,
eqeqeq: true,
nomen: true,
onevar: true,
passfail: false,
plusplus: true,
regexp: true,
undef: true,
white: true


With the following snippet

/*global ActiveXObject, WScript, */
/*members Arguments, Close, Count, OpenTextFile, Quit, ReadAll,
StdErr,
WriteLine, bitwise, eqeqeq, errors, length, line, nomen, onevar,
passfail, plusplus, reason, regexp, undef, white
*/
(function () {
if (WScript.Arguments.Count() !== 1) {
WScript.StdErr.WriteLine("Usage: cscript fulljslint.js
{file.js}");
WScript.Quit(1);
}

var filename = WScript.Arguments(0);
var objFSO = new ActiveXObject("Scripting.FileSystemObject");
var objTextFile = objFSO.OpenTextFile(filename);
var sReadAll = objTextFile.ReadAll();
objTextFile.Close();

// Customize the options to change the behaviour of the validation
// See allOptions about the options available
var options = { // good part options
bitwise: true,
eqeqeq: true,
nomen: true,
onevar: true,
passfail: false,
plusplus: true,
regexp: true,
undef: true,
white: true
};

if (!JSLINT(sReadAll, options)) {
var e = JSLINT.errors;
for (var i = 0; i < e.length; i = i + 1) {
// Customize the output to integrate JSlint in your editor
// See JSLINT.errors about object members
if (e[i] !== null) {
WScript.StdErr.WriteLine(filename +
':' + (e[i].line + 1) + ': ' + e[i].reason);
}
}
//~ WScript.StdErr.WriteLine(JSLINT.report(false, '\r\n'));

WScript.Quit(1);
}
})();

I integrated JSLint with SciTE and Eclipse.

Regards,
Alberto
Reply all
Reply to author
Forward
0 new messages