[jquery-dev] Re: jQueryLINT

2010-01-17 Thread James Padolsey
Yesterday, after seeing this thread, I started work on a jQuery Lint script. You can see it here: http://github.com/jamespadolsey/jQuery-Lint It does a few basic checks - argument signatures being the main one. It also tries to combat lack-of-caching with selections, and it will warn you when

[jquery-dev] jQuery.fragments and simple HTML

2010-01-04 Thread James Padolsey
I've been looking into jQuery.fragments and have a couple of suggestions. It'd be useful, I think, if jQuery.fragments could be used to store basic DOM nodes as well, for example (currently it only stores fragments): jQuery.fragments['div/'] = document.createElement('div'); ...

[jquery-dev] Re: jQuery.fragments and simple HTML

2010-01-04 Thread James Padolsey
a bit hesitant landing a change like this, wholesale - mostly because we're looking at better templating solutions for after 1.4 and this seems hacky, at best. --John On Mon, Jan 4, 2010 at 7:50 AM, James Padolsey jamespadol...@googlemail.com wrote: I've been looking

[jquery-dev] Re: What's wrong in my code?

2009-12-08 Thread James Padolsey
What? Never heard of that before... On Dec 8, 2:28 pm, DBJDBJ dbj...@gmail.com wrote: Also please be sure to have jquery attribute present, like so: script scr=jquery-1.3.2.min.js type=text/javascript jquery=1.3.2 /script This switches on, undocumented jQuery event handling. And also

[jquery-dev] Re: .attr() brakes the chain if setting to value 'undefined'

2009-10-25 Thread James Padolsey
This could be fixed by checking arguments.length. --- set = arguments.length 1; --- On Oct 23, 5:12 pm, Jonathan Sharp jdsh...@outwestmedia.com wrote: Given the following: $.fn.foo = function() { alert('foo'); return this }; $( [] ).attr('id', bar).foo(); .foo() is never executed

[jquery-dev] Re: getting multiple values

2009-10-05 Thread James Padolsey
This is just the way jQuery works. All getters only return the first result. To avoid this you could use jQuery.map: var values = jQuery.map( $('input.file_attachment'), function(input){ return $(input).val(); }); If you think you'll want this functionality more than once then I'd suggest

[jquery-dev] Re: The Context property/parameter

2009-08-16 Thread James Padolsey
Thanks for your reply John. :) On Aug 14, 1:24 pm, John Resig jere...@gmail.com wrote: That can't be true, right? It doesn't search the whole doc. Correct, it only searches the limited sub-set. The context property may be document but .myClass is only searched for within #myContainer,

[jquery-dev] eq(-1) - negative numbers take from end of collection

2009-08-14 Thread James Padolsey
Would this be a possibility? It would be nice if it worked like JavaScript's Array methods, whereby passing a negative number indicates a position from the end of the array. So, with the following collection: [a/, div/, span/] eq(-1) would return span/, eq(-2) would return div/... This could

[jquery-dev] Re: ajax() with method PUT - missing payload

2009-08-14 Thread James Padolsey
I think you mean /^(PUT|POST)$/ Your regex will match PUT at the start of a string or POST at the end of one. On 14 Aug, 09:16, George george.jqu...@softwareunity.com wrote: FWIW would it be clearer to write the regex like this? It's the same number of characters:   xhr.send(

[jquery-dev] The Context property/parameter

2009-08-14 Thread James Padolsey
Back in June, Brandon wrote an enlightening article about the misunderstood context parameter. Read it here: http://brandonaaron.net/blog/2009/06/24/understanding-the-context-in-jquery Most of it makes sense to me now but I'm still a little confused about some of the assertions made as a

[jquery-dev] Re: eq(-1) - negative numbers take from end of collection

2009-08-14 Thread James Padolsey
Added http://dev.jquery.com/ticket/5050 Thanks guys! On 14 Aug, 13:19, John Resig jere...@gmail.com wrote: I don't see why not - we already support .get(-1), .eq(-1) makes sense. Want to file a feature ticket for it? --John On Fri, Aug 14, 2009 at 2:34 AM, James Padolsey jamespadol

[jquery-dev] Re: isFunction() that works in IE too

2009-08-04 Thread James Padolsey
instanceof won't worik because a function within an iframe won't have the same constructor as one outside of it. On Aug 4, 10:04 am, DBJDBJ dbj...@gmail.com wrote: Worryingly in IE8 this is the state of play : // IE8 Object.prototype.toString(Error.valueOf) /* [object Object] */ typeof

[jquery-dev] Memory leaks, IE, bfcache

2009-07-29 Thread James Padolsey
Around line ~3100 (3321 in the latest nightly) you're binding the unload event so as to prevent any memory leaks in our favourite browser (IE). Unfortunately the presence of an unload handler disables some caching techniques used in other browsers (see

[jquery-dev] Re: Ticket #4946, jQuery.isObject

2009-07-24 Thread James Padolsey
Checking the constructor is a bad idea; if you try checking the constructor of an object within an iframe it won't have the same constructor as an object outside of the iframe. I think this'll do what's required: function isObj(o){ return Object.prototype.toString.call(o) === '[object Object]' }

[jquery-dev] Having valueOf() reflect length of collection - a good idea?

2009-07-23 Thread James Padolsey
Just a thought; this would be quite useful IMO: var paras = $('p'), uls = $('ul'); if (paras uls) { // ... } I know it's not quite as readable (or as semantic) as: if (paras.length uls.length) { // ... } but still, it's one of those things that may as well be added, just for the few

[jquery-dev] Re: Issues with binding click events to an option element.

2009-06-29 Thread James Padolsey
Try the change event, it's more reliable: $('select').bind('change', function(){ /* ... */ }); On Jun 28, 10:35 am, Nesto katapultstolpil...@gmail.com wrote: It seems there are issues with binding events to option elements, bind ('click') doesn't work on anything. live('click') works for

[jquery-dev] Re: Live events and :not

2009-06-18 Thread James Padolsey
I'm pretty sure this has nothing to do with the live() event. It's probably the selector itself that is killing the browser. Are you looking for HREFs that start with #javascript? ... If so, why not just use [href^=#javascript] ... On Jun 18, 6:18 am, pbcomm pbc...@gmail.com wrote: Trying to

[jquery-dev] Passing a number to clone()

2009-06-11 Thread James Padolsey
I think it'd be useful to be able to pass a number to clone(). Example of usage: jQuery('ul').append( jQuery('li/').clone(50) ); What do you think? Useful or not? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google