$.ajax and abort
Working on a jsonp plugin (that will supercede my getJSON mess of a replacement).<div> </div><div>I'd like it to be as similar to $.ajax behavior as possible and I'm wondering what happens exactly when the abort method of the xhr object is called while the request is still active.</div> <div>More precisely, are the success/error and complete callbacks called or not?</div><div> </div><div>That's really the only little thing I have left before I make some documentation and release it.</div><div> </div><div>Thanks
jQuery 1.4.2 Minified with no Sizzle
Hi jQuery Fourms, I have a small question. Can I get jQuery 1.4.2 that is Minified and Gzipped but that doesn't include Sizzle? Thanks, Ben
Attribute selectors for SVG elements limited.
I'm a new user to jQuery I admit, but already I'm finding it convenient for a new javascript application I'm building for one of my websites. The app in question uses SVG to help generate a music game based stepchart. Due to the nature of SVG elements, I often have to be able to retrieve elements based on their x or y values inside the primary SVG document. Some sample code is as follows: <g id="svgNote" transform="scale(3)"> <svg x="16" y="40" class="note_008 tap"><g><path d="m 1,2 v 12 c 0,0 0,1
MIX10 EX36
http://live.visitmix.com/MIX10/Sessions/EX36?type=wmv For some reason this is now really slow and gets interrupted often. Has anyone downloaded it and can share it , perhaps ? --DBJ
Live() click event not firing on checkbox in IE
I find that the live() click event will only fire if it's added before events on other elements in internet explorer (I'm using 7). I don't have access to my webserver right now since I'm at work, but below is some short simple code to reproduce. As it is right now, the click events on the checkboxes won't fire. If you swap the second part with the first part in the javascript though, the click events will fire and the textbox change event still works as well. So there is a workaround for me,
div containing image height & width, from cache
Hi, I have a div containing an image. The purpose of the div is to set the maximum size of the image both in width and in height. The image is set with height: 100% & width: auto or height: auto & width: 100% depending if the image is in portrait or landscape mode. This is all fine and dandy until cached images are encountered. In both FF and Chrome, if the image is just loaded, a .height() & .width() on the images returns the correct numbers, but if the image is cached, both those functions return
$(iframe.contentDocument).ready(...)
I wish jQuery.ready() supported iframes or popup windows, e.g. $(iframe.contentDocument).ready(...); - or - var window = open('http://example.com/'); $(window).ready(...); I opened this feature request, http://dev.jquery.com/ticket/5511 Ran into a situation where I wished for it again today
html() performance vs cruft
Hey, we're trying to eke out some more performance from our jquery app, and we noticed that virtually none of our html insertions pass the test to take the innerHTML shortcut and instead are forced to take the .append route which can in some cases double the time of the insertion. In looking at the test we noticed that .html simply reuses the rnocache regex rather than having it's own specialized "innerHTML vs .append()" regex, and also that the regex takes somewhat of a sledgehammer approach to
Transversing with function param (ex: .next(function))
Hello I propose this idea: Code to apply (example): <div id="test"> <div>Test</div> Hello World! <b>Hello</b> New Test! </div> Application: $('#test') // Get textNode contents only .contents(function(){ if(this.nodeType === 3){ // Add to collection when return true return true; } }) // For each textNodes, change value .each(function(){ this.nodeValue = 'Changed!'; }); Results: <div id="test"> <div>Test</div> Changed! <b>Hello</b> Changed! </div>
Why check .html() etc for "value === undefined" instead of arguments.length?
I'm wondering why .html(), .attr(), .css() etc check if a value was passed with "value === undefined" instead of checking with arguments.length if a (second) argument was passed at all. I ran into problems a few times when chaining one of those methods and passing an undefined variable by accident - and jQuery returned the value instead of the jQuery object. Sure, this way I instantly knew something was wrong because of a JavaScript error, but still - I'd expect another behavior: jQuery should set
I want to the new feature in next version jQuery.
Hi! var sId = document.getElementById("my_select").selectedIndex(); when: <select id="my_select"> <option>Hello</option> <option>World!</option> </select>
Same Data is being displayed again and again in JSP while using Jquery
Hi, I have called a jquery ajaxOnSubmit('../../../EmployeeVisitorServlet?bharat='+i+'&'+dateVal); function ajaxOnSubmit(url){ alert('am in ajaxon submit : '+url); $.ajax({ type: 'GET', url: url , cache: false, dataType: 'html', success:function(xml){displayAjaxResults(xml)}, error:function(err){displayAjaxError(err)}}); } function displayAjaxResults(xml){ document.getElementById('employeeVisitorDetailReport').style.display='none'; alert("displayAjaxResults
creating a DOM element
Hey, I'm not quite sure if it's a bug. Anyways I'm experiencing the following behavior: var _new_li = $('<li/>', { 'id': 'p', click: function(){ alert('fired'); }, data: { 'somedata': 'somedata', } }),If I use that order, event (click) before data, I receive an exception on click. "e is undefined" or "events is undefined". If I switch the order, data before click, works just fine. see http://jsbin.com/isixo3/edit Kind Regards --Andy
rleadingWhitespace
Please do not forget to replace rleadingWhitespace from jquery / src / manipulation.js with trimLeft (defined in jquery / src / core.js ) --DBJ
jQuery event sniffer?
I have a problem with a page that uses intensive jQuery code. After a little while, IE 8 uses up to 90% of the CPU and the PC is getting very slow. Refreshing the page solves the problem, so I'm pretty sure something goes wrong with my jQuery code. As this page binds and uses many events (onclick, onkeypress, onchange, etc), I'm wondering if there is a dead loop somewhere in the event chain, but this is pretty hard to debug as I can't find a way to reproduce the problem which happens randomly.
Dancing with bear, stops only when bear wants.
http://visualstudiomagazine.com/articles/2010/03/16/mix10-jquery-announcement.aspx Congratulations to John and the Team ... I hope due dilligence was performed before embracing MSFT. --DBJ
Closest work with open child selector
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?
.attr(null) can return element attributes
Hello! It's a example: <div id="test" style="font-color: red;" class="test-one" onclick="test()"></div>Then if you do: $("#test").attr(); Will return: { id: 'test', css: { fontColor: 'red' }, class: 'test-one', click: function(){ test(); } } Bye.
faster jQuery.trim()
Here's a patch for a faster version of jQuery.trim based on native String.trim and these improvements: http://blog.stevenlevithan.com/archives/faster-trim-javascript Test case: http://jsbin.com/oquji/2 Patch: (removed) I also just requested a pull request. The native String.trim is ridiculously fast.
Bind and unbind a submit event : JS error on unload
Hi, I have one global JS file that bind to the submit event of every form a function disabling each submit button. Sometimes, i don't want the submit button to be disabled because a click from the user results in the download of a dynamically generated file, which means that the page doesn't change at all and the user just needs to be able to submit the form one more time. That's why i added in a other JS file loaded after the first one, a piece of code to unbind the event. It goes like this : /*
Problem using variable in selector
I've set some hidden input variables to help users search through a very dense page. If I hard code a string such as CHI it works, but if I pass CHI in as a variable it won't work. Interestingly, I've not had issues doing this when I am passing in a variablel and trying to selection with an ID versus attribute selector. Examples of what works: A) hardcode selector by attribute: var targetOffset = $("input[value='CHI']").next().offset().top; B) variable passed to selector by id: $.post(url,
$.getJSON() isn't automatically appending "&callback=?" to my cross-domain URL
The $.getJSON() documentation states: If the specified URL is on a remote server, the request is treated as JSONP instead. See the discussion of the jsonp data type in $.ajax() for more details. The $.ajax() documentation for the jsonp data type states (emphasis mine): Loads in a JSON block using JSONP. Will add an extra "?callback=?" to the end of your URL to specify the callback. So it seems that if I call $.getJSON() with a cross-domain URL, the extra "callback=?" parameter should automatically
Please add nodelevel() method concept
Instead of using parent() or children() methods. nodelevel() could traverse to any node in the DOM. $(element).nodelevel( +1 ) Capture a parent node 1 level up from the selected node $(element).nodelevel( +3 ) Capture a parent node 3 levels up from the selected node $(element).nodelevel( +1all ) Capture all parent nodes at each level up from the selected node $(element).nodelevel( -1 ) Capture all child nodes 1 level down from the selected node $(element).nodelevel( -3 ) Capture all child nodes
focusin should bubble
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 will submit patches for this and anything else I get a thumbs up for.
liveFired with change and submit
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.
Can JQ add such 2 events: focusenter & focusleave?
Just like mouseenter and mouseleave, sometimes I just want to trigger the focusin event only once while the focus doesn't leave the top parent element, so could you supply such 2 new events?
Problem with .not selector between 1.3.2 and 1.4.2 ?
After upgrading from 1.3.2 to 1.4.2 I noticed a portion of my application did not function the same way. Clicking outside of an open div would close that div. I've made a simple test case to illustrate: <script> $(document).ready(function() { $(document).not("#test").click(function() { alert("clicked"); }); }); </script> <div id="test" style="background-color:#000;color:#fff;height:200px;width:200px;">hello</div> <p>click here somewhere</p> JSBin (jQuery 1.3.2) - http://jsbin.com/areri3
Creation of INPUT with value broken
Hi, In 1.4.2 the following line works: $("<input/>", {"type": "hidden", "id": "myID", "value": "hi" }); The following line does NOT: $("<input/>", {"type": "text", "id": "myID", "value": "hi" }); Why is it that the creation of a hidden element with a value works, but not for a text element?
How do I build the jquery documentation?
I've checked out jquery from git://github.com/jquery/jquery.git. Building works fine, but I can't figure out how to build the documentation. $ make docs make: *** No rule to make target `docs'. Stop.What am I missing?
wrapAll and clone
At the moment, wrap, wrapInner and wrapAll all clones the input element, which results in that you can't manipulate your reference to the container after calling wrap, and have to resort to foo.parent() instead. I think that for wrapAll in particular, no clone should be made, and the wrapping should be performed on the original element, as it will only be one "wrap" (singular) in the end.
jQuery.map not consistent with Mozilla spec
Why this inconsistency? jQuery.map([-1,0,1], function(e) { return e == -1 ? null : e; }); returns: [0, 1] [-1,0,1].map(function(e) { return e == -1 ? null : e }); returns: [null, 0, 1] https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map
A new type of .live() event
Hello. I want propose a new "event" to .live(). See this case: I'm using AJAX to load HTML, and for all .roundedBox I need apply in ajax.success: $('.roundedBox').css({borderRadius: 5}); I suggest any more intelligent: $('.roundedBox').live('all', function(){ $(this).css({borderRadius: 5}); }); // Obs: the event "all" is only a bad-suggestion, is only for example Or be: to ALL new .roundedBox (indepentends if it is from AJAX HTML content or not), will be applied this event-method. Currently is
How I "compile" jquery from git?
Hello. I'm trying to "compile" jquery from git on Windows, but I don't know how I install Ant, seems that I need JDK, then I make a "build.php", all works fine, jquery was compile, but in unit test I get too much errors. data module: expando (2, 4, 6) data module: jQuery.data (2, 10, 12) data module: .data(String) and .data(String, Object) (1, 22, 23) manipulation module: append(String|Element|Array<Element>|jQuery) (12, 25, 37) manipulation module: append(Function) (12, 25, 37) event module: click(),
.data( object ) and memory-leak
For quite some time now I had intention to open this discussion because of increasing tendency of using data/event API on native objects. Why this is a problem? Well, the current $.data implementation is optimized for host objects only, and not for native objects too. In fact, it uses a cache object to store all related data and an expando with numerical values to keep references. The need of such solution is unquestionable and it fits well because elements are normally "eliminated" by using .remove()
error event with live
hi, i just wanted swap all broken images with a placeholder. i thought about $("img").live("error" ... ) but it never seems to be triggered. i could of course use $("img").bind("error" ...) and it works pretty well, but i would need to do some extra work if i wanted to apply it for every newly loaded image (via load() for example). so... am i doing something wrong or error event isn't just supposed to work with live? i'm using jquery 1.4.1. -- regards, ojo
slideUp() doesn't work with hidden parent
slideUp() of an element doesn't hide when its parent is hidden. See: http://jsbin.com/uxedu3/2/edit
cross domain call problem - rails and jquery
Hi guys i am trying to make ajax call with below code which makes sucessful request but i am not able to get the response data. I can see the response on firebug console but not in my code under "success" callback function of the ajax call. Any idea ?? My jquery code $.ajax({ url:"http://192.168.2.53:3000/homes/show.json?format=json&callback=?", dataType: 'json', type: "GET", success: function(responsedata){ console.log(responsedata);
.html() changes the html structure
I wonder why is $("<div><script type='text/javascript'></script></div>").length == 2in 1.3 this used to be one single node, while 1.4 extracts the script element and places after the div. this causes a lots of problems with plugins which expect that their input will parse into a single node. is there an explanation for this? is it a bug? if it's not, how can i force jquery to stop doing this (other than reverting back to 1.3.x?)
Passing along arguments to QUnit tests
Hi - I just discovered QUnit. When using it, I noticed that the 'test()' function doesn't provide a simple way to pass along arguments to the test function. This makes it prone to errors in which the wrong variables are captured in the test function's closure. For instance: var tests = [ test1, test2, test3 ]; for (var i = 0; i < tests.length; i++) { var test = tests[i]; test("...", function () { stop(); $.getJSON(...., function () { equals(test.someprop,
1.4 performance regression over time vs 1.3.2?
We're currently running a script-intensive app on jQuery 1.3.2. I did some quick testing last week against 1.4 and saw what in some respects is a perf regression. The torture test case is switching a tabbed sidebar to very busy, dynamically-generated content. One big .html() write, a dozen or so small .html() inserts, and a whole bunch of event binding. No network access, animation effects or live events; no third-party plugins (including jQuery UI); testing on IE7. On the first iteration, 1.4's
Next Page