[jQuery] datePicker plugin - inputClick bug fix and other alterations
I've made a few changes to the Kelvin Luck's date picker plugin (http://kelvinluck.com/assets/jquery/datePicker/). After adding the ability to click the input to show the calendar it replaces any existing css classes that may already exist on it (which I should have caught when adding it). So I have changed it to use addClass instead of attr({'class' : '...'}). Along with that, I have reduced the number of times 'attr' is used: i.e. $("").attr({'title' : 'Foo', 'rel' : 'myrel', 'href' : 'javascript:;'}) becomes: $("").title('Foo').rel('myrel').href('javascript:;') I have left alone those attributes that don't have a shorthand equivalent (scope, abbr, cellspacing). Download from: http://www.texotela.co.uk/datePicker_source.zip ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] datePicker plugin - inputClick bug fix and other alterations
On 11/27/06, Sam Collett <[EMAIL PROTECTED]> wrote: > Along with that, I have reduced the number of times 'attr' is used: > > i.e. > $("").attr({'title' : 'Foo', 'rel' : 'myrel', 'href' : 'javascript:;'}) > > becomes: > $("").title('Foo').rel('myrel').href('javascript:;') I'm curious why you have done this? Those helper methods might be deprecated from the core in the 1.1 release. -- Brandon Aaron ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] datePicker plugin - inputClick bug fix and other alterations
On 27/11/06, Brandon Aaron <[EMAIL PROTECTED]> wrote: > On 11/27/06, Sam Collett <[EMAIL PROTECTED]> wrote: > > Along with that, I have reduced the number of times 'attr' is used: > > > > i.e. > > $("").attr({'title' : 'Foo', 'rel' : 'myrel', 'href' : 'javascript:;'}) > > > > becomes: > > $("").title('Foo').rel('myrel').href('javascript:;') > > I'm curious why you have done this? > > Those helper methods might be deprecated from the core in the 1.1 release. > > -- > Brandon Aaron Just personal preference, I think that also makes it more readable and less prone to errors (when using attr you may miss off a , : { or }). File size is also reduced (although only by about 100 bytes) - in a very large plugin, using the helper methods could result in even more reductions. While I can see why the helper methods are removed, some are actually applicable to all elements (id, title, lang, dir), so it may be good to keep them in as they could be frequently used (at least id and title). ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] datePicker plugin - inputClick bug fix and other alterations
On 27/11/06, Brandon Aaron <[EMAIL PROTECTED]> wrote: > On 11/27/06, Sam Collett <[EMAIL PROTECTED]> wrote: > > Along with that, I have reduced the number of times 'attr' is used: > > > > i.e. > > $("").attr({'title' : 'Foo', 'rel' : 'myrel', 'href' : 'javascript:;'}) > > > > becomes: > > $("").title('Foo').rel('myrel').href('javascript:;') > > I'm curious why you have done this? > > Those helper methods might be deprecated from the core in the 1.1 release. > > -- > Brandon Aaron I've changed it to use attr to set attributes (addClass is still used to set the class) and noticed that 'val' was used instead of attr to get the value (so that has been fixed too). Download link is till the same. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/