Looking for any feedback on #3699 before committing, which is for allowing an alternative scope for events. There is a patch attached to the ticket. The ticket actually proposes a method signature that doesn't really fit jQuery's style. I added a patch that allows the following call signature instead.<div> </div><div>$(...).bind("type", fn, scope);</div><div>$(...).bind("type", data, fn, scope);</div><div> </div><div>This also applies to .one() and .live().</div><div> </div><div>The patch utilizes the internal event.proxy method with a tweak to include an optional scope.</div> <div><div> </div><div>--</div><div>Brandon Aaron</div></div>
I was walking someone through the process of creating a new theme for a project that uses jQuery UI and when he clicked "Download theme" he thought it broke. It was a pretty jarring experience. I mean the button says "Download theme", not "Next" or "Build jQuery UI with this Theme".<div> </div><div>It seems like most of the time if I go to themeroller directly than I'm there to generate a theme and probably already have a build of jQuery UI. However, if I go to UI builder I can understand being taken to the theme builder. So I propose two buttons. The primary button to download just the theme and the secondary button to download the theme + get jQuery UI.</div> <div> </div><div>--</div><div>Brandon Aaron</div>
I wrote an API Browser as a "Web App" for the iPhone and iPod touch. It downloads the docs to a local sqlite database for quick browsing of the API. It is basically a proof of concept right now (the code is ugly and a little buggy). However, if enough people like it I'll go ahead and take the time the polish it up and fix the quirks/bugs. Let me know what you think, how it performs, etc. BTW... If you add it to your home screen it will launch without the Safari chrome. Beware the first time you visit this site it will download the docs in XML format (368KB) and then store them in the database. So be patient, the setup screen will let you know what is going on and there will be a big "Continue" button that shows up once everything is done. <a href="http://brandonaaron.net/iphone/index.html">http://brandonaaron.net/iphone/index.html</a> One bug I know is fairly annoying is that if you click the back button to a long page it won't scroll. Just click back one more time and then go to that page again and it will magically scroll again. I tweaked the iUI framework to use CSS transforms for the slide animation and it seems to be causing the issue. -- Brandon Aaron
Just wanted to let you guys know I just committed the new offset method. It will behave almost identical to the previous version except it is faster, no more browser detection and handles body offsets a little better. I believe there are a few open issues with the offset method that I hope to address before the next release. In the mean time please let me know if you run into any issues with the new offset method.<div> </div><div>--</div><div>Brandon Aaron</div>
<div dir="ltr">Yehuda said he found a bug during one of his presentations. I've created a simple test case of the said bug ( <a href="http://brandonaaron.net/jquery/issues/events/namespace_bug.html">http://brandonaaron.net/jquery/issues/events/namespace_bug.html</a> ). You'll need to open it in Firefox and open up firebug. I've bound two click events with different namespaces to the document but they use the same function. <div> </div><div>What would you expect to happen in this situation? Should we consider the namespace of the event when checking to see if the function has already been bound? When your thinking about this, think about custom events and events not even tied to DOM nodes.</div> <div> </div><div>The real reason this bug came up is because Yehuda was using the event system like no one really expected it to be used. </div><div> </div><div>--</div><div>Brandon Aaron</div></div>
jQuery.batch is a small extension (951 bytes min'd, 520 bytes gzipped) to jQuery that allows you to batch the results of any jQuery method, plugin into an array. By default the batch plugin aliases the getter methods in jQuery by adding an 's' to the end (attrs, offsets, vals ...). You can also just call $(...).batch('methodName', arg1, arg*n). Download: <a href="http://plugins.jquery.com/project/batch">http://plugins.jquery.com/project/batch</a> Blog post: <a href="http://blog.brandonaaron.net/2008/05/08/jquery-batch/">http://blog.brandonaaron.net/2008/05/08/jquery-batch/</a> -- Brandon Aaron
I'm getting a 302 response from <a href="https://jqueryjs.googlecode.com/svn/trunk/">https://jqueryjs.googlecode.com/svn/trunk/</a> It blows when hosted services drop out ... :/ -- Brandon Aaron
It looks like the dimensions plugin is now whittled down to the following methods: scrollTop/Left, position and offsetParent. Lets just create a dimensions.js file and throw the dimension related methods in there (width/height, inner/outterWidth/Height) and put the rest of the methods in the offset.js file. Thoughts? -- Brandon Aaron
The PBwiki team compared the loading times for the major libraries in several different scenarios. jQuery's small footprint shines through! Run the tests in your browsers to add to the overall data. <a href="http://jst.pbwiki.com/"> http://jst.pbwiki.com/</a> -- Brandon Aaron
I just checked in two new plugins: Batch and Viewable. Batch is a plugin that allows you to batch the results of any jQuery method, plugin into an array. I know this has been brought up on the list a few times and I believe several other libs provide this functionality. By default the batch plugin aliases the getter methods in jQuery by adding an 's' to the end (attrs, offsets, vals ...). You can all just call $(...).batch('methodName', arg1, arg*n). <a href="http://brandonaaron.net/jquery/plugins/batch/">http://brandonaaron.net/jquery/plugins/batch/</a> The viewable plugin allows you to know when an element is in view and what percentage of the element is viewable. Actually I wrote the viewable plugin a while back ... finally getting around to checking it in. :) <a href="http://brandonaaron.net/jquery/plugins/viewable/">http://brandonaaron.net/jquery/plugins/viewable/</a> Once I get the docs done I'll do an official release of each. -- Brandon Aaron
I just noticed that the new ready event fails within iframes in IE. I've created a simple test case that alerts the value of document.body. <a href="http://brandonaaron.net/jquery/tickets/iframe_ready/shell.html"> http://brandonaaron.net/jquery/tickets/iframe_ready/shell.html</a> <-- alerts null (within iframe) <a href="http://brandonaaron.net/jquery/tickets/iframe_ready/test.html">http://brandonaaron.net/jquery/tickets/iframe_ready/test.html </a> <-- alerts properly (not within iframe) <a href="http://jquery.com">jquery.com</a> is down ... when it comes back up I'll be creating a ticket. -- Brandon Aaron
I just committed the beginnings of the offset test suite. It pops up a new window to isolate the test cases, so it requires that you enable your pop-up blocker to run the tests. <a href="http://brandonaaron.net/jquery/jquery/test/offset.html"> http://brandonaaron.net/jquery/jquery/test/offset.html</a> You can also access the individual fixtures to run a visual test as well. Just click on any of the white boxes to move the grey marker. <a href="http://brandonaaron.net/jquery/jquery/test/data/offset/relative.html"> http://brandonaaron.net/jquery/jquery/test/data/offset/relative.html</a> <a href="http://brandonaaron.net/jquery/jquery/test/data/offset/absolute.html">http://brandonaaron.net/jquery/jquery/test/data/offset/absolute.html </a> Please feel free to contribute some test-cases if you feel inclined to do so. :D You can even just provide the fixture html (like the above relative and absolute fixtures) and I'll add the actual test hooks. I'll be adding many more test-cases as I get the time. -- Brandon Aaron
I created a branch today to finally implement some ideas I've had to implement "special events". Basically I've made "ready" a first class event and the hooks for doing so allow us to create other special events. I've already implemented the following events: mouseenter, mouseleave and mousewheel. All of these events, including ready, can be implemented via the bind/unbind API. <div><br class="webkit-block-placeholder"></div><div>$(...).bind("ready", fn);</div><div>$(...).unbind("ready", fn);</div><div>$(...).bind("mousewheel", function(event) { console.log(event.delta ); return false; });</div><div> </div><div>I've also gone ahead and implemented the ability to bind multiple event types with one call.</div><div><br class="webkit-block-placeholder"></div><div>$(...).bind("mouseover mouseout mouseenter mouseleave", function(event) { console.log(event.type); });</div><div><br class="webkit-block-placeholder"></div><div>I just implemented the changes and have only done minor testing with Firebug+Firefox only. </div><div><br class="webkit-block-placeholder"> </div><div>As far as file size goes ... </div><div>Original events.js: 13,771 bytes </div><div>New events.js: 16,823 bytes</div><div>New events.js without mousewheel: 14,814 bytes (this still includes mouseenter and mouseleave) </div><div><br class="webkit-block-placeholder"></div><div>The hover helper method has been re-factored to use the mouseenter and mouseleave events ... which means unbinding the hover is as simple and safe as $(..).unbind('mouseenter mouseleave', fn); </div><div><br class="webkit-block-placeholder"></div><div>To add a "special event" just extend the jQuery.event.special like so:</div><div><br class="webkit-block-placeholder"></div><div>$.extend($.event.special, { </div><div> myspecialevent: {</div><div> setup: function() {</div><div> // do the setup</div><div> // this == element</div><div> // return false to allow bind to call addEventListener and attachEvent respectively </div><div> },</div><div> teardown: function() {</div><div> // undo what you did in setup</div><div> // this == element</div><div> // return false to allow unbind to call removeEventListener and detachEvent respectively </div><div> }</div><div> }</div><div>};</div><div><br class="webkit-block-placeholder"></div><div>The setup and teardown methods are only called once per an element per an event type. Similar to how the actual event is only bound once per an element per an event type. The jQuery events API does the rest (the majority) of the heavy lifting. </div><div><br class="webkit-block-placeholder"></div><div>In my implementations I've also added a "handler" function as well as the setup and teardown functions. This handler function provides any normalization, etc needed before calling the handlers. If you take a look at the branch you'll notice that I return false on the mouseenter and mouseleave events if it is IE. This way IE can handle them natively while the other browsers will use the special event handler. </div><div><br class="webkit-block-placeholder"></div><div>I know this email is a little hasty but I wanted to go ahead and let everyone know what I'm working on. Please grab the code from the branch and take a look. Let me know what you think. <a href="http://dev.jquery.com/browser/branches/event_enhancements/src/event.js">http://dev.jquery.com/browser/branches/event_enhancements/src/event.js</a></div><div><br class="webkit-block-placeholder"></div><div>--</div> <div>Brandon Aaron</div>
I've gone through and really cleaned up the code for the shadow plugin. All the info is in ticket 1923 (http://dev.jquery.com/ticket/ 1923). I have a few other ideas for the shadow plugin that I was working on for myself but wouldn't mind contributing to this plugin instead. I planned on having a size and angle option to go along with the distance/offset option to make the shadow more configurable. -- Brandon Aaron
Could anyone with an iPhone provide some feedback about ticket #1563? The claim in ticket #1563 is that $('p:eq(1)').hide() does not work. If someone could run a few tests to see if this is true and if it is the hide method itself or just the selector, that would be awesome. :) BTW ... I've tested this in Safari 3 beta and it works just fine. <a href="http://dev.jquery.com/ticket/1563">http://dev.jquery.com/ticket/1563</a> -- Brandon Aaron
Some of you may be familiar with Behavior. It was a first attempt at implementing a "live DOM" experience. Behavior has been rewritten from the ground up with performance in mind and new features. It is now called Live Query. A couple of new features are that: * Live Queries work with attribute and class selectors * Live Query automatically unbinds events to unmatched elements and when the Live Query is expired * Live Query can fire a second callback for when an element is unmatched and when the Live Query is expired Check out the blog post for more details: <a href="http://blog.brandonaaron.net/2007/08/19/new-plugin-live-query/">http://blog.brandonaaron.net/2007/08/19/new-plugin-live-query/</a> -- Brandon Aaron
I just released Dimensions 1.1. It includes an option to include margin for the outerWidth and outerHeight methods. I've also fixed the issues with Safari 3 and the offset method. The docs have also been udpated for 1.1 . As usual you can grab the latest from the Dimensions project page. Note that this update requires jQuery 1.1.3. project page: <a href="http://jquery.com/plugins/project/dimensions/">http://jquery.com/plugins/project/dimensions/</a> docs: <a href="http://brandonaaron.net/docs/dimensions/">http://brandonaaron.net/docs/dimensions/ </a> -- Brandon Aaron
The 1.0 release of Dimensions is finally here. It has been a long time in the making. Thanks to everyone who helped me test it! You can get the details and see an example using the new position method over at my blog: <a href="http://blog.brandonaaron.net/2007/07/22/dimensions-10/">http://blog.brandonaaron.net/2007/07/22/dimensions-10/</a> You can download dimensions from the project page: <a href="http://jquery.com/plugins/project/dimensions"> http://jquery.com/plugins/project/dimensions</a> Or via SVN: <a href="http://jqueryjs.googlecode.com/svn/trunk/plugins/dimensions/">http://jqueryjs.googlecode.com/svn/trunk/plugins/dimensions/</a> If you find any bugs or have any feature requests ... be sure to report them at the dimensions project page. Oh... and you can check out the documentation over here: <a href="http://brandonaaron.net/docs/dimensions/">http://brandonaaron.net/docs/dimensions/</a> Thanks! -- Brandon Aaron
I recently created an plugin/extension for jQuery to use the following syntax for binding events. $('input').bind('mouseover focus', fn); So you can bind multiple event types to the same function quickly. It also applies to .one and .unbind. However, this got me thinking about writing a plugin that would allow us to add new event types ... like mouseenter and mouseleave. So instead of using .hover, you could do this: $(...).bind('mouseenter', fn); or $(...).bind('mouseenter', fn1).bind('mouseenter', fn2); or $(...).unbind('mouseenter', fn1); or $(...).trigger('mouseenter'); etc... So I'm curious about what the jQuery community thinks about this idea? I've built out a proof-of-concept but it is by no means production ready. You can see it in action here: <a href="http://www.brandonaaron.net/jquery/plugins/events_extension/test/test.html"> http://www.brandonaaron.net/jquery/plugins/events_extension/test/test.html</a> We could also hook up the mousewheel event in the same way. $(...).bind('mousewheel', fn); Are there other events that could be added/normalized with this plugin? BTW ... Here is the blog post about binding multiple event types: <a href="http://blog.brandonaaron.net/2007/06/05/bind-multiple-events-simultaneously-with-jquery/">http://blog.brandonaaron.net/2007/06/05/bind-multiple-events-simultaneously-with-jquery/ </a> -- Brandon Aaron
Okay ... I've got a sneak peak of the new bgiframe plugin here: http://brandon.jquery.com/plugins/_bgiframe/test/ This discussion started in the recent suckerfish plugin thread ... basically they ran into an issue where the expressions used by the bgiframe plugin slow down animations in IE6. This has been brought up before. Hopefully the flexibility provided by the new settings will help solve this problem and a few others. Notice that if you don't pass anything it acts just like it did before, which is usually enough for most situations. However, there are a few situations where having more control would be really nice. So, I've made it possible to manually pass a top and left, width and height and the src of the iframe. On the test page I demo several different usages and the settings I passed to the bgiframe method. One of the bigger things that makes this nice is that you can now use other values other than pixels by manually passing in the values. You can also pass your own expression() too. I still highly suggest using the 'auto' settings because that automatically adjust the top, left, width and height properties as the elements changes. However, you can very easily hook into the iframe and change its properties as the element changes in advanced situations by selecting the element, $('iframe.bgiframe',scope).doWhatYouNeedToIt(). I'm going to be doing some more testing and hopefully push it into SVN soon. BTW I've tagged the previous version of the bgiframe plugin here: http://dev.jquery.com/browser/tags/plugins/bgiframe/1.0/bgiframe.js?format=txt -- Brandon Aaron
I just checked in a fix for the flickers that have been happening in the fx module. Anyone that was having problems with flickers in their animations (mostly in Firefox) please grab the latest from SVN and let me know if it solves your problems or not. -- Brandon Aaron _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
I've noticed several times on the list people asking why .clone() doesn't clone the events along with the elements. No more worries ... now you can clone those events if you need too! var $elements = $('.elements'); $elements .clone() .cloneEventsFrom($elements); There is also a .cloneEventsTo() which acts like .appendTo(). var $elements = $('.elements'); var $clonedElements = $elements.clone(); $elements.cloneEventsTo($cloneElements); You can find this plugin in SVN: http://jquery.com/dev/svn/trunk/plugins/cloneEvents/cloneEvents.js?format=txt You can run the unit tests here: http://brandon.jquery.com/plugins/cloneEvents/test/unit.html -- Brandon Aaron _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Okay so I've gotten some good feedback on the new offset method and have made some additional changes to make the method a little more flexible to people's needs. The offset method signature has changed and now takes an options hash as the first param and a return object as the second param. The options hash has 4 properties that each take a boolean. margin: Should the margin of the element be included in the calculations? True by default. If set to false the margin of the element is subtracted from the total offset. border: Should the border of the element be included in the calculations? True by default. If set to false the border of the element is subtracted from the total offset. padding: Should the padding of the element be included in the calculations? False by default. If set to true the padding of the element is added to the total offset. scroll: Should the scroll offsets of the parent elements be included in the calculations? True by default. When true, it adds the total scroll offsets of all parents to the total offset and also adds two properties to the returned object, scrollTop and scrollLeft. If set to false the scroll offsets of parent elements are ignored. If scroll offsets are not needed, set to false to get a performance boost. You can see these properties in action on the updated test/demo page: http://brandon.jquery.com/plugins/dimensions/test/offset.html The second param is just an object to use for the return value. If passed in, then the chain will not be broken. Here is an example: var offset = {}; $('#testdiv').do().something().offset({scroll: false}, offset).do().some().more(); Then if you looked at the offset object it would would have top and left properties. The new test/demo page now gives you the opportunity to try different options and see how they work. I've also added a div with overflow: auto to see what the scroll option does. Test/Demo: http://brandon.jquery.com/plugins/dimensions/test/offset.html Source from SVN: http://jquery.com/dev/svn/trunk/plugins/dimensions/dimensions.js?format=txt -- Brandon Aaron _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/