Tapestry core can benefit from using less library code as possible.Use few
utility functions from the days crossbrowser libraries just started,
and those that are not too much to implement.


high level stuff from jquery protoype dojo yui etc. are all different in the
approach.

a list should be made what utilities are of essence for tapestry js.
some tapestry functions that use library a lot but solve a specific problem
could be left for plugin lib to reimplement.

a good point to start would be removing this prototype centric stuff I
mentioned,
element.getFieldEventManager()
with something like:
Tapestry.getFieldEventManager(element)

although changing the prototype of the Function class and adding the bind
to it no big deal you might consider changing the code like this:
this.repositionBubble.bind(this)
to
Tapestry.bind(this.repositionBubble,this);

it is longer, and bit uglier but more neutral I guess.


One may think this is pretty:
        this.form.getElements().each(function(element)
        {
            var fem = $T(element).fieldEventManager;

            if (fem != undefined)
            {
                // Ask the FEM to validate input for the field, which fires
                // a number of events.
                var error = fem.validateInput();

                if (error && ! firstErrorField)
                {
                    firstErrorField = element;
                }
            }
        });

but why not just replace the first line with:
        var elems = Tapestry.form.getElements(this.form);
        for(element in elems)


The impl of the func would be obviously
Tapestry.form.getElements = function(form){return form.getElements();}


Davor Hrg



On Thu, Feb 12, 2009 at 1:27 AM, Howard Lewis Ship <hls...@gmail.com> wrote:

> These are all good points.  When this last flared up, at least a year
> back, I didn't want to tackle it because I could not then say what the
> "minimal set of functionality" would be.  I think we're closer now.
> Coding in such a way that we can easily swap out or mix-n-match
> Prototype and jQuery will make people very happy.
>
> On Wed, Feb 11, 2009 at 2:07 PM, Davor Hrg <hrgda...@gmail.com> wrote:
> > One small example from tapestry.js
> > when looking at this as prototype centric app
> > it is totaly ok, but from the angle of enabling other libs this approach
> > is completely unnecessary and easily fixed.
> >
> > again this is one example (rewriting all may not be as easy)..
> >
> > this code is called (tapestry.js:551)
> > Element.addMethods(['INPUT', 'SELECT', 'TEXTAREA'],
> > ...
> >    getFieldEventManager : function(field)
> > ...
> >
> > searching whole source for tapestry core reveals that this function is
> only
> > used in tapestry.js
> >
> > tapestry.js:588
> >        element.getFieldEventManager().showValidationMessage(message);
> >
> > the code can easily be rewriten to use
> >
> > Tapestry.getFieldEventManager(element).showValidationMessage(message);
> >
> > this removes need for prototype and extending dome nodes for this example
> >
> > You can argue that other projects might rely on tapestry doing things
> like
> > this,
> > but an compatible version for prototype can be left like this and version
> > for other libs
> > with the new approach (the other libs don't like prototype.js anyway).
> This
> > can mean
> > that people with other js libs are fixed to tapestry core only but this I
> > suppose is ok for many....
> >
> >
> > Davor Hrg
> >
> >
> >
> >
> > On Wed, Feb 11, 2009 at 10:14 PM, Davor Hrg <hrgda...@gmail.com> wrote:
> >
> >> I was even willing to do this wrapper thing almost a year ago,all this
> is
> >> from going through tapestry js code last spring....
> >> some things are just thoughts on what should not be done, and some may
> be
> >> comments on tap.js ....
> >>
> >> the Tapestry js code is not so complicated,
> >> and uses only a portion of prototype
> >>
> >> there can even be something like prototype slimmed for it to work as
> well.
> >>
> >> the components are not remotely close in complexity to any framework
> >> even prototype is overkill for tapestry.
> >>
> >> It definitely extensively used Function.bind which is a five-liner and
> >> is similar dojo.hitch, it also uses $ function which is a simple as well
> >>
> >> It should avoid prototype specific approach of expecting dom nodes
> >> prototypes upgraded and fallback to plain old utility functions
> >>
> >> why call :
> >> $("element").hide()
> >> when you can as well call (not saying code like this exists in tap.js) :
> >> Tapestry.hide($('elem'));
> >> and be more portable
> >>
> >> Tapestry core just needs to define a set of minimal js utility functions
> >> and use prototype for bas on how the funcs should work.
> >>
> >> example funcs:
> >> Tapestry.addClassName
> >> Tapestry.effect.fadeIn - total light version of js might do no fade and
> >> just display content
> >> Tapestry.calcPos - absolute pos for element so a floated one can be
> aligned
> >> to it
> >> some subset of jquery like funcs to more easily find nodes (but search
> >> only)
> >> no magic calls to change all nodes properties and shit.
> >>
> >> if a submit button can not get context why do crazy stuff in js that is
> not
> >> necessary
> >>
> >> after that adding/using other js frameworks would be no problem for
> those
> >> that like them.
> >>
> >> unfortunately I lost a bit of interest after some of my patches not
> making
> >> in
> >> the framework for a long time :(:(
> >>
> >> I don't mean to bash on T5, and I do hope I make more time for it in
> >> following moths.
> >>
> >> The blame could be on me as well, a year has almost passed since I
> looked
> >> into this, and haven't done much since. :(:(
> >>
> >> Davor Hrg
> >>
> >>
> >> On Wed, Feb 4, 2009 at 8:17 AM, Peter Stavrinides <
> >> p.stavrini...@albourne.com> wrote:
> >>
> >>> >it would be nice if a component could indicate
> >>> >that the scripts should be at the top for the entire page
> >>> Vote for this Jira, which requests exactly that:
> >>> https://issues.apache.org/jira/browse/TAP5-369
> >>>
> >>> Peter
> >>>
> >>> ----- Original Message -----
> >>> From: "Joachim Van der Auwera" <joac...@progs.be>
> >>> To: "Tapestry users" <users@tapestry.apache.org>
> >>> Sent: Monday, 2 February, 2009 17:22:06 GMT +02:00 Athens, Beirut,
> >>> Bucharest, Istanbul
> >>> Subject: Re: Switch from Prototype to jQuery?
> >>>
> >>> I am not so sure.
> >>>
> >>> Do all pages/components work the same way if you move the scripts to
> the
> >>> top?
> >>> If that is the case, then it would be nice if a component could
> indicate
> >>> that the scripts should be at the top for the entire page.
> >>> If not, then there is a problem if you want to combine a component
> which
> >>> requires scripts at the top with a component which requires scripts at
> >>> the bottom.
> >>>
> >>> Joachim
> >>>
> >>> Kevin Menard wrote:
> >>> > This was an older app that I haven't needed to revisit.  At the time,
> >>> > no such directive existed.  If it does, great.  Then I guess there
> >>> > really aren't any problems after all.
> >>> >
> >>> >
> >>>
> >>>
> >>> --
> >>> Joachim Van der Auwera
> >>> PROGS bvba, progs.be
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> >>> For additional commands, e-mail: users-h...@tapestry.apache.org
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> >>> For additional commands, e-mail: users-h...@tapestry.apache.org
> >>>
> >>>
> >>
> >
>
>
>
> --
> Howard M. Lewis Ship
>
> Creator Apache Tapestry and Apache HiveMind
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to