Hi guys
I am trying to do the following:

    //Save a reference to the original init method
    var valFunction = $.prototype.val;

    //Create a new val method that handels nulls correctly
    $.prototype.val = function(value) {
            return valFunction(value || '');
    };

But it comes back with a "this.each is not a function" is not a
function.I have a feeling that I my be loosing the context but I am
not sure how to fix it up.

Cheers
Anthony


On Jun 17, 3:21 pm, vdhant <vdh....@gmail.com> wrote:
> I was thinking of something a little more simple. I don't mind doing
> this in the shorter time but for the here and now I was wondering how
> I would write an in code dynamic patch.
>
> As in would I do something like the following:
>
> //This being code I add to my page
> jQuery.fn = jQuery.prototype = {
>   baseval: jQuery.prototype.val,
>   val: function(value) {
>     this.basedval(value || '');
>   }
>
> };
>
> Like I know the above doesn't quite work but is there some way that I
> could archive this?
> Cheers
> Anthony
>
> On Jun 17, 1:39 pm, David Zhou <da...@nodnod.net> wrote:
>
> > Checkout the jQuery svn repo, make your changes and generate a diff.
>
> > -- dz
>
> > On Tue, Jun 16, 2009 at 11:34 PM, vdhant <vdh....@gmail.com> wrote:
>
> > > Hey guys
> > > In the meantime how could I go about creating my own patch that fixes
> > > this issue???
> > > Cheers
> > > Anthony
>
> > > On Jun 17, 1:11 pm, Daniel Friesen <nadir.seen.f...@gmail.com> wrote:
> > > > Hmmm? Clarifying, has $(el).css('width', undefined).someOtherFnMethod();
> > > > been fixed?
>
> > > > ~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]
>
> > > > John Resig wrote:
> > > > >> It's always a good idea to either use a ||'' or cast your data to a
> > > string or other proper datatype when using jQuery, a large number of the
> > > methods will have somewhat undesirable results if you try using null or
> > > undefined, it's a known issue.
>
> > > > > Oh, I wouldn't go that far. We've patched any null/undefined issues
> > > > > that we've found. I'm not aware of any outstanding issues (save for
> > > > > the one mentioned in this thread). Pointers to any others would be
> > > > > appreciated.
>
> > > > > vdhant: You should file a bug with this point in it:
> > > > >http://dev.jquery.com/newticket
>
> > > > > --John
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to