Hi I've been seeing the multiple commits for http://dev.jquery.com/ticket/4111. Moving regexps to local vars to cache them. I was wondering if this is a perfomance measure and if so, if there's some benchmark out there to prove the gain. I personally think these changes make the code more complicated and longer. I'd rather see the regexp in place if I want to understand what it does. I went ahead and created a benchmark for this: http://benchmarker.flesler.com/regexp/run/ The conclusions were that there's absolutely no gain in speed except on IE. Even on IE, it doesn't seem to be such a critic improvement and it's slower the more you get away from the variables' scope chain (in nested functions). Any opinion ? Cheers -- Ariel Flesler
Hi There're a few things I'd like to mention about jQuery.event.special. About returning false to keep the native binding... While this has been around for a while already and it's painful to change stuff like this, I think it's really counter-intuitive. We sort of established returning false as a way to abort things (events, iterations). In this case, you need to return false not to abort the native binding. I can say that every time I used this (not that often) I expected return false to avoid regular binding. Considering this isn't used all that much, it wouldn't be THAT painful to change relatively. About the addition of add & remove, I gave a quick look at the code to see the arguments passed and noticed that if you pass multiple (space- separated) events to $.event.add and any of those overrides the handler, then the new handler will be used for the rest of the events. If more than one return a function, then you keep stacking functions (even worse). This should be fixed asap. I can open a ticket or even fix this myself, but I'd rather let Brandon handle it I suppose. One last small thing, I think: if ( modifiedHandler && jQuery.isFunction( modifiedHandler ) ) Doesn't need to check if modifiedHandler is null, as jQuery.isFunction should handle null's. Of course you save a function call, but I don't think it's really critical and we rather keep shorter and clearer code. Cheers -- Ariel Flesler
Hi All I never actually announced these 2 small plugins I made right before jQuery 1.3 was released. They're meant to provide users with a nicer way of using certain new ajax features that could be conflicting otherwise. Here's the link: http://flesler.blogspot.com/2009/05/2-ajax-plugins-for-jquery-13.html Cheers -- Ariel Flesler
Hi all I've released jquery.scrollTo 1.4.1[1] and jquery.localScroll 1.2.7 [2]. Both contain some nice enhancements and a fair amount of small features. Both old and new versions are compatible with jQuery 1.2.x and 1.3.x. jquery.scrollTo 1.4.1 implements synchronic animations by default (1.3 addition). It also now works on quirks mode, I tested on all major browsers, including Chrome, even for iframes. It is also now compatible with xml +xhtml pages (testing is appreciated). jquery.localScroll 1.2.7 improvements are specially focused on the (problematic) 'hash' setting. You can now access and modify the settings object after initialization. [1]http://flesler.blogspot.com/2009/03/jqueryscrollto-141- released.html [2]http://flesler.blogspot.com/2009/03/jquerylocalscroll-127- released.html As always, I appreciate any feedback, testing and feature requests. I'll hopefully have a new release for jquery.serialScroll soon. Cheers -- Ariel Flesler http://flesler.blogspot.com
Hi I've been watching this magic argument over and over, hoping it'd disappear. It seems it is used all over within jQuery UI but... according to Scott, it's encapsulated into one single function. So... IF we don't need it anymore on jQuery UI... can we just remove it from jQuery.trigger ? Anyone objects ? Also, but with less expectations, removing getData and setData would be nice IMO. I'm not so sure about this because I suppose some people actually rely on them, but they're nasty. They make $.data slower and force trigger to return the data instead of true/false as it should. Cheers :) -- Ariel Flesler http://flesler.blogspot.com
Hi I suppose something is wrong with 1.3 beta. Older versions do work on situations like these: jQuery('<script type="text/javascript">alert("a")</script>').appendTo ('body') jQuery('<div><script type="text/javascript">alert("a")</script></ div>').appendTo('body') Now they never get executed but they still get removed from the jQuery object (and div) before they're added to the page. I checked the new code but didn't felt like (naively) modifying all the new additions. This should be fixed as well: http://dev.jquery.com/ticket/3733 Cheers -- Ariel Flesler http://flesler.blogspot.com
Feedback please! :) I really like (and support) this feature. http://dev.jquery.com/ticket/3662 Also... I know that the returned value from jQuery.fn.trigger is used here and there (jQuery UI?). But that behavior is really odd and fragile in my opinion (false overrides any previous value). I think it'd be nice to return true/false depending on whether e.preventDefault() was called. This would be very useful for custom events, to allow event handlers to stop a scheduled (custom) behavior. As an alternative, we could add e.isDefaultPrevented() that retrieves this value from the event object. Note that none of this last 2 behaviors (or the one in the ticket) is my invention. I'm just imitating AS3's event system. I suppose that belongs to some EcmaScript specification as well. http://docs.brajeshwar.com/as3/flash/events/Event.html Thanks -- Ariel Flesler http://flesler.blogspot.com
While working on the ultra chaining plugin mentioned on the neighboring thread, I recall that $.fn.queue auto executes the sent function if it's the first (and only) in the queue. This behavior is used for the fx module, so that one can queue animations w/o worrying about keeping the queue running. The problem is, I'm heavily relying on $.fn.queue right now, but not just for fx. Thing is, this behavior really complicates my code because the "auto execute" behavior is meaningless for anything but fx. If I queue a function, doesn't mean I want it auto executed. To work around this, I'd have to push an empty function every time queue is empty, but that's gross. Also, queue() is internal to jQuery so I can't "overload" it. In short, may I change that behavior in the core, so that only fx queues get auto executed ? It's not just a patch for my situation, I think it applies to every other queue application but fx. Also... what about making queue accessible from the outside ? seems like the same pattern as $.data. Cheers -- Ariel Flesler http://flesler.blogspot.com
We got a ticket about how to select elements by an attribute with brackets. I replied with the common link to the FAQ and the reporter replied that the example in the docs doesn't work. I tried that myself, and indeed, that didn't work. http://dev.jquery.com/ticket/3443 $('[name=foo[bar]]'); // Doesn't work $('[name=foo\\[bar\\]]'); // Should work, but doesn't $('[name="foo[bar]"]'); // Does work Now... I think the last option is good enough. But we need to update the docs. Anything to add ? Anyone volunteers to update the docs ? Cheers -- Ariel Flesler http://flesler.blogspot.com/
Hi guys I'm getting around 3-5 tickets for UI a day. I'm quite tired of closing them with the same speech. I already added a note on our trac, but it seems many people don't read it. Is there something else we can do to save this wasted time from now on ? Cheers -- Ariel Flesler http://flesler.blogspot.com/
Hi Dan Switzer added a feature request asking for a special property added to event objects when the event is triggered by $.trigger(). He provided a test case but I'm not yet convinced. Could you give your opinion on this ? Additional test cases from many users could help. I think, in a general way, that if you bind a handler to a certain event, then it should work the same for real and fake events. Else, maybe you shouldn't be binding or relying on that event, keeping that as a function/method instead. I've seen stuff like: $(...).click(function(){...}).click(); And I think that's just wrong. Someone else could had been binding to that click too. I'd save a reference to the function and call it w/o trigger(). Still.. that's just my POV. Thanks -- Ariel Flesler http://flesler.blogspot.com
Hi all After many months of no-plugin-development, I added a new version of jQuery.ScrollTo with 2 critical bug fixes and some nice features. Here you can read the whole list of changes and also get the last version: http://flesler.blogspot.com/2008/09/jqueryscrollto-14-released.html If you want a summary: - Fixed a recurrent bug when scrolling the window on Opera 9.5 - Ditto for Safari 3 (a different bug). - Added full support for iframes, you can scroll the whole (mini) window to an inner element. - Added support for $(window).scrollTo() and $(document).scrollTo() to scroll the window, instead of $.scrollTo(). And more... :) For those using SerialScroll and/or LocalScroll, no problem should arise if just replace your old ScrollTo with this one. I kept backwards compatibility where needed. Cheers -- Ariel Flesler http://flesler.blogspot.com/
Hi Just wanted to let you know that we have 2 failing tests on Opera 9.5. One for width and one for height. -- Ariel Flesler http://flesler.blogspot.com
Hi I'd appreciate some help on this ticket: http://dev.jquery.com/ticket/2690 It works well on my IE 7, so there's not much I can do. Can you please test on your IE7's and post whether it works or not ? -- Ariel Flesler http://flesler.blogspot.com/
Hi folks Due to the recent problem with Scriptaculous (or is it Prototype?). I added the option to run the test suite, along with more libraries. To do that, instead of going to /jquery/test/, go to /jquery/test/ polluted.php. You'll get a form with all the available libraries (added the last of prototype, mootools and scriptaculous). Check those you want to include and hit submit, the test will start and those libs will be included. It's very simple to add new libraries or versions. Just throw in a new folder (for version or lib) with the js inside by the name of the lib and it'll automatically be included to future forms. It's still possible to use GET vars to filter tests, just add them when you enter the php. Finally.. I tried with just Prototype and no test (?foo). It simply broke down (prototype itself). Seems like jQuery's document ready is conflicting with Prototype's. Anyway.. cheers. -- Ariel Flesler http://flesler.blogspot.com
Hi Team I've been wondering, why is that x.constructor == y is always used instead of typeof ? Is this a speed, size or browser quirks optimization ? I personally prefer typeof, the contructor requires one to first check that x isn't null. Also, referring to String, Array.. etc should be slow as they're properties of window and the interpreter needs to lookup for them on each scope in the chain before finding them. Just being curious :) Cheers -- Ariel Flesler http://flesler.blogspot.com
Hi, I really want to close these 2 tickets: http://dev.jquery.com/ticket/2661 http://dev.jquery.com/ticket/2784 But for that, I need some collaboration to verify this change won't break existent code. I prepared 2 pages, one with the original jQuery, and the other with a modified version. Original: http://flesler.webs.com/UA/ Modified: http://flesler.webs.com/UA/modified.html All you need to do is access both with all the browsers you have (supported by jQuery) and make sure the notified version is correct. If all is ok, please just say so. If you notice a failure, please report it. Thanks -- Ariel Flesler http://flesler.blogspot.com