- Screen name: justinbmeyer
- About Me: CEO Juptier Consulting
- Email ID: justinbmeyer@gmail.com
justinbmeyer's Profile
36 Posts
86 Responses
0
Followers
Show:
- Expanded view
- List view
Private Message
- It seems like binding on parent-child element with swipe will result in a double swipe event.
- How are you guys testing? From the article : http://jquerymobile.com/2010/11/jquery-mobile-alpha-2-released/ it looks like it's mostly manual testing. What are you using?I'm wondering if a Selenium for mobile would be useful? Is someone working on this? I know nothing about mobile development, but I'm interested in helping mobile testing.
- When I run the latest test suite in Chrome, I get a failure on the:offset: disconnected nodetest. Is this for everyone? Is someone working on this? This is similar to the 'hidden' node offset issue. I'm happy to help if someone lets me know the state of affairs.
- $(document).delegate("body", "foo.bar", function(){
- alert('bar')
- }).delegate("body", "foo.zar", function(){
- alert('zar')
- });
- $(document.body).trigger("foo.bar");
Alerts "zar" and "bar" when it should only alert "bar". This is a problem with liveHandler only checking- handleObj.origType.replace( rnamespaces, "" ) === event.type
Which will match anything fooVS something more like:- handleObj.origType === event.type+(event.namespace ? "."+event.namespace : "")
And in handle, you have to add the namespace to the event like:- event.namespace = namespaces.join(".")
- $('.tab').bind('default.show', function(){})
Also, I submitted a 4 fixes a month or so ago that never got added. Any reason for the delay? Seems like the last update in jquery/jquery was a month ago. I know you are crazy busy, but let me know if there is anything I can do to help these get in. There's a few other plugins that need some of these changes on the way. But this delegation error is by far the most important.Thanks!- There is a bug if you are delegating for click and change on the same element. If the click liveHandler runs before the change liveHandler, the change liveHandler event will never be fired.The FIXLine 2297 of the nightly build (the testChange function that tests if a change has happened) looks like:
- if ( data != null || val ) {
- e.type = "change";
- return jQuery.event.trigger( e, arguments[1], elem );
- }
it should be changed to:- if ( data != null || val ) {
- e.type = "change";
- e.liveFired = null;
- return jQuery.event.trigger( e, arguments[1], elem );
- }
This will prevent previously set lifeFired events from blocking new change events.- I'm trying to make an extension to qunit that enables it to power selenium to run other browsers. For this to work, I need qunit to be able to rerun the same tests over again. I was able to get this to work by using my own version of qunit.js with a custom synchronize function that stores all callbacks. But I'd like to avoid that.Is there a way to do this? Would you consider making synchronize a public method in future releases? Thanks,Justin
- If you do a jsonp request followed by another jsonp request, with jsonpCallback set, the callback function is deleted before the second request completes.Example:
- $.ajax({
- url: "1.json",
- success: function(){
- $.ajax({url: "2.json", jsonpCallback: "C", dataType: "jsonp", success: function(){} })
- },
- jsonpCallback: "C",
- dataType: "jsonp"
- });
- I've implemented drag/drop to work as special events. I'd really like to have the drop work like:
- $(el).delegate(".drop","drop",function(ev, drop, drag){
- if(drag.hasClass('nope'){
- drop.cancel();
- }
- })
But as trigger can only take 1 data argument, I can't pass the drag to the event handler unless I rig it into the event or drop. I don't want to do this b/c they are are independent.Is there a reason for this limitation? I know arguments makes things relatively slow, but it would be inconsequential compared to trigger calling parentNode.Would a patch be accepted where you can do the following?- $(dropPoint).trigger("drop",drop, drag);
Thanks!- 24-Apr-2010 04:57 PM
- Forum: Developing jQuery Core
I think it would be very useful to allow setting of data on an element without a reference to the actual element. This is for performance reasons. The following is a longer explanation.I use data a lot. I typically use it in the following (and I believe, extremely common) pattern:- Get data from a service
- Convert that data to html
- Insert HTML into the page
- Iterate through html to add service data on the elements
A good example of this would be a tree. When someone expands the tree, I need to get the data from the element they clicked on.The problem is if you have 1000s of elements, doing a query, and then iterating over every element is rather expensive. This could be much faster if jQuery allowed me to set an attribute value in HTML that could be later read by $.data.I'd like to do something like:- var htmls =[]:
- $.each(files, function(file){
- htmls.push('<div ',$.dataAttr("file",files),">",file.name,"</div>");
- })
- $('#folderWithManyFiles').html(htmls.join(''))
$.dataAttr is my own helper function that:- Increments uuid and creates a new object at jQuery.cache[uuid].
- Sets the data passed in $.dataAttr in the new object at jQuery.cache[uuid]
- Returns jQuery23452141412412='5' (where jQuery23452141412412 is jQuery.expando and 5 is uuid).
For $.dataAttr to even be possible, 2 changes would have to be made:1. uuid would be available on jQuery. Maybe jQuery._uuid to warn people not to abuse it.2. data would check for a jQuery.expando attribute. If present, it would use its value with jQuery.cache to get data for that element.Just to be clear: I am not proposing dataAttr.
I want to be able to make functionality like this possible so data can work with the pattern at a much larger scale. On my workstation, in IE6 vmware, it takes 213 ms to query on the dom, iterate through, and set data on 1000 elements. This become nothing if I could set data ahead of time.If this sounds good, I'll submit a pull request hopefully by tomorrow.- 31-Mar-2010 12:32 AM
- Forum: Developing jQuery Core
For performance reasons, and for what I considered expected results, closest should return the first match per selector. This is causing problems with event delegation with nested DOM structures. For example:Consider a nested menu like:- <ul><li>
- Option 1
- <ul><li>Option 2</li></ul>
- </li>
And the following code- $('li').live('click', function(){
- $(this).addClass('clicked')
- })
If you click on the deep li, the event handler function will be called on both LI's. This makes using event delegation for nested structures (like a menu) pretty much unusable. I've used event delegation for a while, and I've never wanted to respond to anything other than the deepest child.Further, by stopping walking up the parentNodes when all selectors have been filled, it's very likely the 'match' case can be speed up.So ...I recommend closest only returning the first matched parent element, making delegation only callback on the deepest child.- http://www.w3.org/TR/CSS21/tables.html#height-layoutThere are some adjustments to make when getting the innerWidth of tables. Tables use something closer to the old IE box model (where clientWidth includes the padding) which makes width and innerWidth incorrect.I propose fixing this by checking the display property. If it is table-ish, adjust accordingly.I can make this patch (along with everything else) when I finally get some time ....
- Repeat calls to getComputedStyle / currentStyle are slow in browsers not smart enough to cache the style.I'm thinking of submitting a curStyles (or similar: curCSSs) function that allows you to get a bunch of current styles from an element. This will allow things like outerHeight/outerWidth, and 3rd party plugins to be optimized in a similar way that offset is.Is there any support for this?Btw, I am out of the office this week so I won't be able to submit a patch for this an the other things I suggested until this weekend.
- 12-Mar-2010 07:28 PM
- Forum: Developing jQuery Core
If I am calling .remove() on the currently focused element when another element is focused on, a change event is never triggered by the live code in IE.The problem is Focusout is called after the element is already removed, preventing live from calling testChange to trigger the change.To fix this, jQuery should use the beforedeactivate event like:- beforedeactivate: testChange,
- Focusin and Focusout bubble in IE. These events should behave the same way in other browsers.I suggest something like the following:
- if(document.addEventListener){
- document.addEventListener('focus', function(ev){
- jQuery.event.trigger( 'focusin', null, ev.target )
- },true);
- document.addEventListener('blur', function(ev){
- jQuery.event.trigger( 'focusout', null, ev.target )
- },true);
- }
- I want to setOffset on items before they are shown. However, as offset() always returns {top:0,left:0} on items with display: none, this doesn't work.I suggest not using the curTop and curLeft values if the offset is 0,0 and the item !is(:visible)
- In IE, if you are delegating on click and submit on the same element, the 2nd event will never be fired b/c liveFired is set. Somehow liveFired needs to be reset for different types of events.I can/will submit test cases when I have time. But this is a pretty serious problem with IE / event delegation. If I get a fix before the community, I will make a pull request.Also, for performance, the liveFired check should probably go before the jQuery.data call.
- I'm really excited that cleanData is exposed. I can overwrite it to let me know when an element is removed. However, I'm wondering if this is the expected way.I notice that each event.remove is called in cleanData. Is it expected / possible to use custom events to callback a function, letting something know that the element has been removed?I'm going to experiment later today with this. But I'm hoping there's already an answer.
- 26-Feb-2010 06:20 PM
- Forum: Developing jQuery Core
It might be nice to do something like:Dog = function(){}Dog.prototype.toString = function(){ return "woof"}dog = new Dog()$("#foo").html(dog)This can be solved super easy, I just feel like this would already work if it was meant to.- 25-Feb-2010 05:39 PM
- Forum: Developing jQuery Core
I'm often wanting to set the outerHeight of an element. Currently I have to figure out manually the padding and border to make sure I am setting the height() correctly.Would jQuery accept a patch that by providing an integer height to outerHeight, it will set the height. The idea is if you should be able to do:$foo.outerHeight( $bar.outerHeight() )And no matter what border / padding $foo might have, it will still look the same size as $bar.I bet this is a rather common problem and will add very little code.- 16-Feb-2010 01:49 AM
- Forum: Developing jQuery Core
After trying out $.require in Chrome, it seems like if you use it before onload, it doesn't make onload wait for all scripts (like it does in IE and FF).I know you can do this by using document.write in Webkit based browsers. Is there another way? Surprisingly, it doesn't seem to work if you append to the body.- 02-Feb-2010 01:22 AM
- Forum: Developing jQuery Core
By removing the namespace in handler, it makes it impossible for liveHandler to figure out which events to call back.I know this is to normalize "click.foo" into "click", but is this necessary?I'm not sure how to get live to work with namespaces if handle does this.- If trigger is going to follow how an event normally bubbles, shouldn't it calculate the parents before calling event handlers on each node.If the DOM changes, or an element gets removed, it won't bubble correctly.I realize this is optimized for stopPropagation, but it seems incorrect.I can submit a patch if this is something jQuery is interested in.
After talking w/ Yehuda, we came up with the idea of allowing people to provide default actions on triggered events.
I discuss it a little on JMVC's forum.
http://groups.google.com/group/javascriptmvc/browse_thread/thread/4d5ae9c61f3817f0
But here's what it looks like essentially:
//imagine some plugin wanting to provide default functionality on a "hide" event.
$(".tab").bind("hide", function(ev){
var el = this;
ev.addDefault(function(){
$(el).hide()
})
})And allow you to do something like:
$(".tab").bind("hide", function(ev){
if(!CURRENT_TAB_COMPLETE) ev.preventDefault();})Similar to how the browser works. This might have problems if people expect defaults to be added after a stopPropagation is called. But, I think the idea is powerful. Here's a working version:I'm going to make a plugin for this, but I think it could be a very useful addition to core, or at least something jQuery UI takes a look at.I've mentioned this before, but it might be worth another go.
Fix takes way too long. Here is the top 2 function calls for http://cdn.javascriptmvc.com/videos/3_0/toolbar/toolbar.html after playing with the menu:
fix: 47%
handle: 7.41%
On most of my apps, the worst performing part is fix. This is especially bad b/c I listen to mousemove.
Fix makes drag-drop and other mousemove functionality noticeably slower. It be possible to have events optionally not run fix, and instead return an object like {originalEvent: event} with an additional .fix() function which will run fix when called.
To be decide to apply fix or not, pass in noFix:true in as event data. As you call back the handlers in handle, if they don't have noFix: true, apply the fix.
This allow plugins like draggable to run really fast if someone isn't listening to dragmove events, only drop, dragover, etc, which is extremely common.
I'm not sure delegating from non-document elements is not officially supported. But, I'd like to be able to do something like the following:
$(">ul>li>a", el).live("click", func)
because: $(el).find(">ul>li>a") works.
for this to work, filter would need a context, but this starts going into Sizzle. Is this something sizzle could support?
- «Prev
- Next »
Moderate user : justinbmeyer
© 2013 jQuery Foundation
Sponsored by
and others.