[jQuery] jQuery is Moving to a Forum
Hello All - After much deliberation the jQuery team has decided to close down the Google Groups that we've been using for project discussion and move to a unified forum instead. The new forum can be found here: http://forum.jquery.com/ More information about our decision to move can be found here: http://jquery14.com/day-07/new-jquery-forum If you have any questions concerning the move please feel free to post them in the new meta discussion forum here: http://forum.jquery.com/about-the-jquery-forum Thanks for your continued support and here's to future community discussions! --John
[jQuery] jQuery 1.4 Alpha 1 Released
More details here: http://blog.jquery.com/2009/12/04/jquery-14-alpha-1-released/ --John
[jQuery] Re: $(':target') and $(location.hash)
jQuery does not support :target. The only reason why it works in Firefox 3.5 is that it provides a native querySelectorAll method. We would have to have an implementation that works in other browser (FF 3.0, IE 8, etc.) and we don't have that right now. You're welcome to file a ticket asking for :target. --John On Thu, Sep 24, 2009 at 2:41 PM, Jack Bates jack.ba...@gmail.com wrote: $(':target') works in Firefox 3.5, but not Firefox 3.0 and some other browsers, http://www.sfu.ca/~jdbates/tmp/qubit/200909231/#aaahttp://www.sfu.ca/%7Ejdbates/tmp/qubit/200909231/#aaa ^ in Firefox 3.5, $(':target') selects just the element with id=aaa, so this element appears blue while the other appears red In Firefox 3.0 and some other browsers, $(':target') seems to select all elements? so they all appear blue $(location.hash) works in Firefox 3.5 and 3.0, http://www.sfu.ca/~jdbates/tmp/qubit/200909232/#aaahttp://www.sfu.ca/%7Ejdbates/tmp/qubit/200909232/#aaa ^ in Firefox 3.5 and 3.0, $(location.hash) selects just the element with id=aaa, so this element appears blue while the other appears red Is the inconsistent behavior of $(':target') in Firefox 3.5 and 3.0 a bug in jQuery? May I open a ticket?
[jQuery] Re: Twitter for support?
That sounds about right - hopefully we'll be able to direct them to a forum, eventually (which would be much easier to use, I'd expect, for someone who's using twitter). --John On Sun, Sep 13, 2009 at 2:53 PM, Mike Alsup mal...@gmail.com wrote: Over the past few months I've been fielding an increasing number of support requests via Twitter (for Cycle, BlockUI, and Form plugins). In some ways it's a nice way to respond to simple questions but obviously it's not well-suited for more in-depth questions and responses. I generally direct people to this Google Group for anything non-trivial but I'm wondering what others think about leveraging Twitter for simple QA. Thoughts? Mike http://twitter.com/malsup
[jQuery] Re: IE8 Selector Bug?
It looks similar to the one above, but different. I'll try and check in to them both. gentry - can you file a bug for the issue you found, preferably with a full test case? --John On Wed, Aug 12, 2009 at 2:21 PM, Jeffrey Kretz jeffkr...@hotmail.comwrote: My guess is its related to a problem I ran into with the Sizzle child selectors in 1.3.x I opened a ticket about a month ago http://dev.jquery.com/ticket/4917 But it hasn't been reviewed yet. JK -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of gentry Sent: Wednesday, August 12, 2009 10:26 AM To: jQuery (English) Subject: [jQuery] IE8 Selector Bug? Anybody know why this doesn't work in IE8 with jQuery version 1.2.6? It works in the latest jQuery version but I can't move to it yet because of some other issues. I'm trying to clear all the textboxes in a table row but only the 1st textbox gets cleared in IE8. $('#Row_1 input[type=text]').each(function() { $(this).val(''); });
[jQuery] Re: IE8 Selector Bug?
gentry - Yes please! --John On Wed, Aug 12, 2009 at 5:15 PM, gentry gent...@gmail.com wrote: I got it to work by changing to this: $('#Row_1tdinput[type=text]').each(function() { $(this).val(''); }); John - Still want a bug filed for this? Thanks, Shane On Aug 12, 11:50 am, John Resig jere...@gmail.com wrote: It looks similar to the one above, but different. I'll try and check in to them both. gentry - can you file a bug for the issue you found, preferably with a full test case? --John On Wed, Aug 12, 2009 at 2:21 PM, Jeffrey Kretz jeffkr...@hotmail.com wrote: My guess is its related to a problem I ran into with the Sizzle child selectors in 1.3.x I opened a ticket about a month ago http://dev.jquery.com/ticket/4917 But it hasn't been reviewed yet. JK -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of gentry Sent: Wednesday, August 12, 2009 10:26 AM To: jQuery (English) Subject: [jQuery] IE8 Selector Bug? Anybody know why this doesn't work in IE8 with jQuery version 1.2.6? It works in the latest jQuery version but I can't move to it yet because of some other issues. I'm trying to clear all the textboxes in a table row but only the 1st textbox gets cleared in IE8. $('#Row_1 input[type=text]').each(function() { $(this).val(''); });
[jQuery] Re: jQuery.ready after document has loaded
We just landed some code in the latest nightly versions of jQuery to auto-detect if the page has already loaded. You can try it here: http://code.jquery.com/jquery-nightly.js --John On Wed, Aug 12, 2009 at 5:14 PM, ujamu danab1...@gmail.com wrote: I have developed a FF extension that loads a few JavaScript files (one of which is jQuery) and attaches them to any given page being viewed by the user. The loading of the js files can ether happen during or after the web page had been loaded into the browser. Obviously, once the js files get loaded, I want to start doing some stuff and I wanted to use the jQuery.ready method to determine when the js code can start performing whatever needs to be done. However, it does not seem to get fired if the extension only starts loading the js files after the web page has already been fully loaded. Generally, there does not seem to be a method in FF that tells me if the web page is loaded or not but rather, only an event that can get fired upon page load. Am I missing something? if not, is there a workaround?
[jQuery] Re: Bug? -- toggle() of TR broke in IE8
These are a duplicate of http://dev.jquery.com/ticket/4512 which has been fixed. --John On Fri, Aug 7, 2009 at 4:53 PM, Mondo Libero i...@vincenzoferme.it wrote: Here: http://dev.jquery.com/ticket/4753, and Here: http://dev.jquery.com/ticket/4960 some users send this bug on bug tracker. The example are almost the same of this situation. On 5 Ago, 17:02, Liam Potter radioactiv...@gmail.com wrote: Sorry about the hostility, was having a pretty stressful day and I didn't really look into the problem too much, so my apologies for that. Now that I've had a better look, it actually does look like a bug. If you enter a value to the toggle, IE8 will do something with the TR, but it ends up hiding at the end. You may want to post a bug reporthttp://dev.jquery.com/report/ Fontzter wrote: Liam, Thanks for your input, we all know how irritating IE can be. However, there are a few things about this that puzzle me: * It works in IE6, IE7, FF, Chrome and Opera * It works with jQuery 1.2.6 * You can call show() and hide() on the TRs and it works in IE8 (see http://jsbin.com/ifiqa/edit) For these reasons, I did not think it was inappropriate to ask (I did use a question mark in the subject) if this was a possible bug. Thanks, Dave On Aug 4, 11:18 am, Liam Potter radioactiv...@gmail.com wrote: It's down to the way IE handles tables, nothing to do with a jquery bug (people are so quick to shout out that word). Boiled down, you can't do a lot of things to tr's in IE, and display none is one of the things you can't change. - Liam Fontzter wrote: bump? Can anyone confirm this? On Jul 29, 9:52 am, Fontzter dmfo...@gmail.com wrote: I put together a simple case to demonstrate this: http://jsbin.com/ijini This works in other browsers but not IE8. Thanks, Dave
[jQuery] Re: jquery 1.3.2 error with $(':inp...@name=submit]')???
Just remove the @ and it'll work fine. --John On Sun, Aug 2, 2009 at 12:07 PM, micorreo13 micorre...@gmail.com wrote: I was using jquery-1.2.6 and now, I started to use jquery-1.3.2, and I get my first difference: when I use the wrapped set operation $ (':inp...@name=submit]') with jquery-1.3.2 it returns all input fields, but if I use it with jquery-1.2.6 it returns 0 (as espected). Is it an error with 1.3.2 version?What do you think I'm doing wrong? Thank you very much. P.S.: this wrapped set is used by jQuery Form Plugin and, if I have file uploads I get the alert 'Error: Form elements must not be named submit.' from the function fileUpload of this plugin.
[jQuery] Re: function running 2X
How many times is clickcharges called? Perhaps you're binding a click more than once. --John On Wed, Jul 29, 2009 at 3:03 PM, marksimon zen...@gmail.com wrote: Still getting 2 alerts. On Jul 29, 11:49 am, Eric Garside gars...@gmail.com wrote: Pretty sure its because the event is bubbling up. Try: $('#cardcharges td').click(function(){ alert('execute once'); return false; }); On Jul 29, 2:38 pm, marksimon zen...@gmail.com wrote: no stupid ideas here, but changing to $(#cardcharges td).click( didn't fix the problem. On Jul 29, 11:22 am, András Csányi sayusi.a...@gmail.com wrote: 2009/7/29 marksimon zen...@gmail.com: Any idea why this would run twice: function clickcharges() { $('#cardcharges tr td').click(function() { alert('execute once'); }); } Stupid idea, but maybe... Because the td tag is part of the tr. And if you click the cell once means that one click on the cell and one click on the row... :) -- - - -- Csanyi Andras --http://sayusi.hu--SayusiAndo -- Bízzál Istenben és tartsd szárazon a puskaport!.-- Cromwell
[jQuery] Re: My messages don't show?
All messages are moderated - so it'll depend heavily upon when we're able to review them. --John On Mon, Jul 27, 2009 at 3:19 PM, Cesar Sanz the.email.tr...@gmail.comwrote: I takes about 3 hrs to display your first message. dunno why - Original Message - From: Jon Jackson j...@jon-jackson.co.uk To: jquery-en@googlegroups.com Sent: Sunday, July 26, 2009 5:23 AM Subject: [jQuery] My messages don't show? What could I be doing wrong? I've joined the group, posted a message (tried it twice)... but it doesn't show? Jon Jackson (JimmyHill, jonj...@googlemail.com)
[jQuery] Re: consistently unable to get return false to work, why?
It looks like you're using the old liveQuery plugin. Why not just use .bind() or .live()? --John On Mon, Jul 27, 2009 at 5:11 PM, pedalpete p...@hearwhere.com wrote: So, this isn't related to any one bit of code, but it seems to be a problem I run into almost everytime i need to stop a form or link for doing what it was originally intended to do (submit). Now, i have used return false; many times, but it never works at first. I'm never sure what I end up changing, but something changes, and then all of a sudden it works, and I am once again left stumped as to what I did. Yesterday, i renamed a class, and all of a sudden, it worked. Changed the class back, and guess what! It still works, though it hadn't before ...r Today, i'm trying to use a submit, check the e-mail address and then submit the form via ajax. Once again, i can't seem to stop the form from submitting. There are no other javascript errors coming up in firefox. my alerts work, so i'm in the right function, but then...the form submits. code jQuery('div#selected form#getEmail').livequery('submit', function (){ var sid=jQuery('input.emailsButton', this).attr('id'); var emailAddress=jQuery('input#email', this).val(); alert(sid); if(isValidEmailAddress(emailAddress)) { alert('works'); $(input#email).after(works); } else { alert('errored'); $(input#email, this).after(label class='error'Email is not valid!/label); } return false; }); /code I've tried moving the return false; into the if/else, but no changes. As mentioned, i think the biggest problem isn't just with this code. There is something I seem to be doing consistently. Thanks
[jQuery] Re: jQuery broken in FF3.5b99 (Preview)
It looks like it may have already been fixed: https://bugzilla.mozilla.org/show_bug.cgi?id=496790 Thanks for the heads-up, though! --John On Tue, Jun 9, 2009 at 6:09 PM, benjambenjamwel...@gmail.com wrote: I'm sure support for a beta release is a bad thing to be asking for, but I mostly just want to make sure I'm not going crazy (and to inform the devs of a possible issue). I have the current FF 3.5b99 (Preview Release) and am playing around on a WordPress (v2.7.1) installation on my dev box, and it seems that when I try to open the media library while editing a page, it opens in a new window (which it should open in a shadowbox type modal window). I've also noticed that some of the menu fly outs and some other various JS things aren't working right. It all works in Google Chrome just fine. So I'm sure it's a FF issue, but just wanted the devs to be aware of this before FF 3.5 and it's new JavaScript engine were released and broke lots of stuff all over the place. Here is the error I get in FireBug when I load the page: cannot access optimized closure - /wordpress/wp-includes/js/jquery/ ui.core.js?ver=1.5.2 I am not 100% sure this is a jQuery bug, it may be one of the plugins I'm using, but the fact that it works in Chrome makes me wonder. Anywho... if anybody else wants to confirm this issue and inform the devs, it would help to ease my current state of confusion. If any more detail is required, please let me know and I'll try and get it.
[jQuery] Re: Something changed from 1.2.2 to 1.3.2 with hashes
Well, in 1.3.2 it now throws an exception, since the CSS selector # is invalid. If you wish to use that precise technique I'd wrap a try/catch around the jQuery statement to catch the error. --John On Wed, May 20, 2009 at 8:22 AM, madmax019 maxi.karr...@googlemail.comwrote: Hi everyone, I have the following problem with the latest jQuery version. Thanks already to anyone wanting to help me. With jQuery 1.2.2 I could get a targets hash like this: var $target = $(this.hash); Sometimes, people use just href=# to get to the top of page and not href=#header (or similar). Hence, if it was just a #, I considered it to have an undefined target. Now to check whether the hash is undefined or not, I used the following: var $defined = $target.length; Now if the hash was undefined, I would get a zero. If it was defined, I would get a 1. Then with a simple if statement I was able to sort through the stuff... Apparently with jQuery 1.3.2 this is no longer possible? Anyone know why and possibly know a fix to this? Thanks Max
[jQuery] Re: jQuery v1.3.2 error
Could you try it with an unminified version of jQuery? That might help a little bit with debugging. --John On Thu, May 14, 2009 at 11:00 AM, Devision c...@e950.lv wrote: Hello. I recently updated my jQuery to 1.3.2 from 1.2.6 and now firebug shows me error: tagName is undefined (jquery.js line 12) Any ideas what might be the problem? All an all jQuery works just fine.
[jQuery] Re: Double submitted ajax requests
Do you have Firebug installed? Some versions of Firebug submit requests twice. --John On Wed, Apr 29, 2009 at 5:17 PM, Josh Ain josh@gmail.com wrote: Very intermittently, I am finding ajax requests submitted with jquery are being submitted twice, once with parameters, and once without parameters. The code looks something like this: jQuery.post(url?id=id, {param1: param1, param2: param2, id: id}, callback); We are using jquery 1.3.1, and the error occurred most recently from a firefox 2 browser. What we see on the server side, is a request with all the expected parameters, then about 200ms later, a request with only the id parameter. Does anybody have any idea why this is happening, and how to avoid this issue? Thank you for any assistance! Josh Ain ITA Software
[jQuery] Re: jQuery 1.3.2 *SLOW* using .class tag selector?
Upgrading is probably safe - it's the engine that'll be in jQuery 1.3.3. --John On Wed, Apr 29, 2009 at 8:35 AM, swalke16 swalk...@gmail.com wrote: I have a situation where I have some HTML I am selecting elements from using the .class tag selector combination using jQuery v1.3.2. I have noticed that in both IE8 and Firefox 3.0.10 this particular scenario is painfully slow to execute. From profiling in both browsers it appears that the Sizzle engine is making an *enormous* amount of calls to both the isXML and filter functions. If I upgrade the version of Sizzle to v1.0 then these selectors work incredibly fast as I would have expected. Profiling in both browsers reveals that the amount of calls to the isXML and filter functions come down from numbers around 80k+ to a few hundred. My specific example can be found here: http://grubersauce.com/walker/jquery_test.html Does anyone have any guidance as to why this would be so slow in jQuery 1.3.2 using the Sizzle v.0.9.3 engine? Is it safe to upgrade the Sizzle version to v1.0 while using jQuery v1.3.2?
[jQuery] Re: Jquery 1.3 - Not all selectors work in IE 8?
Interesting. Do you think you could file a bug on this and then post it to the jQuery-dev list? Thanks! http://dev.jquery.com/newticket http://groups.google.com/group/jquery-dev --John On Thu, Apr 23, 2009 at 5:11 PM, giovanni gflam...@gmail.com wrote: I found that certain selectors work in all browsers except IE 8 and they need to modified. This selector pattern seem to work well in all browsers, including IE 8: jQuery(input[class='class_name'][type='text']) But this identical selector works in Firefox, Safari but not in IE 8: jQuery(input.class_name:text) In IE 8 it returns a property not found javascript runtime error. I don't know whether that the actual issue or if it is a side effect of some memory leak. Giovanni
[jQuery] Re: Any benefit to using event.preventDefault() over return false to cancel out an href click?
return false does e.preventDefault() and e.stopPropagation(). --John On Mon, Apr 20, 2009 at 3:20 PM, kgosser kgos...@gmail.com wrote: Just curious if there is a best practice when choosing between $(a).click(function(){ // stuff return false; }); and $(a).click(function(){ // stuff event.preventDefault(); }); to cancel out the href of an anchor when clicked. Thanks in advance for the help.
[jQuery] Re: Simple selector not working in 1.3.1 and webkit (safari and chrome)
You should remove the @ from your selectors, they're invalid. --John On Thu, Apr 2, 2009 at 12:10 PM, ale alejandr...@gmail.com wrote: Hi, I relative new to JQuery but I have some code that works fine in Firefox, IE and Opera, but seem to be having a problem with Chrome and Safari. Here is part of the code: $(form#quiz_form_1).submit(function(){ alert(This is testing); $.post(question_result.asp,{ quiz_answer: $(input [...@name='quiz_answer_1']:checked).val(), currdiv: $(input [...@name='currdiv_1']).val() }, function(xml) { question_response(xml); });//end of $.post return false; }); here is the function question_response function question_response(xml) { //next div to show var next = $(nextdiv,xml).text(); var current = next - 1; alert(This is test); //if the it was the correct answer if ( $(answer,xml).text() == 1) { //display next part of the story $(#story_+next).slideToggle(slow); //diplay next quiz $(#quiz_+next).slideToggle(slow); //display message to answer $(#answer_+current).html($(message,xml).text()); } else { //display message $(#answer_+current).html($(message,xml).text()); } } I place alert screens for debugging, the alert screen in the function question_response is never display in safari or Chrome I don't know if there is problem with the Ajax code. Thanks! On Feb 4, 5:05 am, Javier Martinez ecentin...@gmail.com wrote: Sure! Createdhttp://dev.jquery.com/ticket/4058 Hope there is some easy patch, if not, I will regret to 1.2.6 inmediately :( 2009/2/3 John Resig jere...@gmail.com That's odd. Could you file a bug on this? http://dev.jquery.com/newticket Thanks! --John On Tue, Feb 3, 2009 at 10:39 AM, Javier Martinez ecentin...@gmail.com wrote: I'm creating a component for an application I'm developing and I have upgraded jquery to the last version to get it's speed boost. After some testing I have seen that my component is not working correctly in webkit browsers because there is some bug with the new Sizzle selector of the new jquery. I can't provide my source files, but I have created a simple test case that shows this error. !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en head meta http-equiv=Content-Type content=text/html; charset=utf-8 / script type=text/javascript src=jquery.js/script script type=text/javascript $(function() { var container = $('#container'); var containerSelecteds = function() { return container.find('ul.selected'); }; var bodySelecteds = function() { return $('ul.selected'); }; var select = function(nodes) { containerSelecteds().removeClass('selected'); nodes.addClass('selected'); // the container html show me that the element has the class selected alert(container.html()); // webkit (chrome and safari) says that there are no elements inside of container with the class selected alert(containerSelecteds().length); // but the element exists in the dom, and it has the classname selected !! alert(bodySelecteds().length); }; var element = $('ul class=someclassliMyText/li/ul').appendTo(container); select(element, false); }); /script /head body div id=container style=border:1px solid #ccc;height:300px;width:300px/div /body /html I will try to explain the error: I'm inserting a node inside the container div, and applying a classname selected to this node. After this, I want to select the nodes inside container that have this classname. Firefox, IE, etc, says that there is one node inside container. But webkit browsers says that there is a node with this classname in the dom, but not inside container. I think that this is a quite simple css selector, so I don't know why it fails. Thanks. PD: it doesn't fails with jquery 1.2.6- Hide quoted text - - Show quoted text -
[jQuery] Re: Form no longer works with upgrade to 1.3.2
Well, without being able to see the form in question - does your page validate? If everything is going into a single input that sounds like a problem with malformed HTML markup. --John 2009/3/30 Kathryn kathry...@gmail.com: I'm working on a web form and had to upgrade to 1.3.2 tonight to solve some problems. Unfortunately, I now have a much worse problem. Not by my choice, I have to use ASP. With the lower version of jQuery, the form was working fine and I could process it as usual...e.g., HTML: input name = dept input name = employee etc. (There are around 40 fields on this form) ASP: dim dept, employee dept = request.form(dept) employee = request.form(employee) etc. However, since upgrading, when I submit the form and response.write the results on the ASP page, the contents of ALL form fields are contained in the dept variable and all the other variables are empty. I know it's not a problem with the ASP code, because it was working immediately before the upgrade and I haven't changed it. Has anyone else had this happen, and if so, what did you do about it? Thanks in advance, Kathryn
[jQuery] Re: Timing of 1.3.3 release
Why not just use a nightly build? No need to wait for a full release. http://code.jquery.com/nightlies/jquery-2009-03-26.js --John On Thu, Mar 26, 2009 at 9:03 AM, dberthia dave.berthia...@gmail.com wrote: Anybody have any insight into when 1.3.3 might be released? There are a couple of bugs that are wreaking havoc on our application, but have apparently been fixed in 1.3.3 (#3993 and #4017). Thanks, - Dave
[jQuery] Re: Ticket: [1758-5724031711]
Uhhh... why were there like 30 of these submitted to the mailing list? Your email address has now been banned. Please contact me off-list if you wish to rectify the situation. --John On Tue, Mar 24, 2009 at 5:45 PM, InfiniteSkills Support Center i...@infiniteskills.com wrote: This message is to notify you that your ticket has been submitted. Ticket ID: 1758-5724031711 Message: -- Add the {async:false} option to your $.get. This tells JavaScript to wait for the response before continuing with the rest of the script. By default, AJAX is asynchronous. On Mar 24, 4:13 am, aeg1s aeg1s1...@gmail.com wrote: I have the following code: $('#r_0_0').blur(function() { var x = $('#r_0_0').val(); var y=#d_0; $(y).empty(); $.get(apps/P5001/call/LineItems.lasso?LITM= + x + Line= + 'r_0_0' + TEST= + y,function(data2){ $(y).empty(); $(y).append(data2); },html); $('#addnew').click(); }); The last line #addnew is adding a new line to a html table, and the other code is updating a div with information from a database call. It is all processing correctly, except the addnew is running before the database query. How can I get the addnew to wait for the prior commands to finish? -- To check the status of this ticket, visit: http://www.infiniteskills.com/helpdesk/index.php?action=ticketid=MTc1OC01NzI0MDMxNzExide=anF1ZXJ5LWVuQGdvb2dsZWdyb3Vwcy5jb20=
[jQuery] Re: Ticket: [1758-5724031711]
Ah, missed that, thanks. --John On Tue, Mar 24, 2009 at 6:34 PM, Matt Quackenbush quackfu...@gmail.com wrote: John, I'm not the offender, but he did apologize and explain. http://groups.google.com/group/jquery-en/browse_thread/thread/c661f1f17c5d374b HTH On Tue, Mar 24, 2009 at 5:28 PM, John Resig wrote: Uhhh... why were there like 30 of these submitted to the mailing list? Your email address has now been banned. Please contact me off-list if you wish to rectify the situation. --John
[jQuery] Re: Playstation 3
If I remember correctly - the NetFront browser was missing some fairly fundamental features. I don't remember which, off-hand, but it was enough to cause jQuery not even to load. --John On Mon, Mar 23, 2009 at 7:21 AM, Johan johandesi...@gmail.com wrote: jQuery fails on the Playstation 3 browser. Yeah I know the PS3's NetFront browser really sucks at JS but it would be good if the plugin ran so even basic effects would work.
[jQuery] Re: Forced bubbling
Why not do: $('#first').click(function(e) { e.preventDefault(); }); --John On Mon, Mar 23, 2009 at 9:20 AM, John Smith master9...@gmail.com wrote: I have 2 containers i disabled event bubbling for first container. This is must have $ ('#first').click(function() { return false; }); Now i need to detect if user clicked outside #second container $ (document).click(function () { alert('clicked somewhere'); }); Clicking on #first doesn't show me alert. Is there any way to force bubbling??. I cant add this alert to #first click, because there can be 1000 that kind of elements.
[jQuery] Re: Animate using relative %
Not sure - do you have a sample that we can look at? --John On Thu, Mar 5, 2009 at 6:16 AM, Adam Jessop a...@infused-gaming.net wrote: Hi, I am working on a site where are wanting to create a full screen site using percentages for positioning and displaying of content. As part of the project we also want to have some animation to bring objects onto the page. We have the objects in their correct positions using relative positioning and negative top values for example: #myDiv{ top: -26%;} This is where we wish the animation to end with the block in position so therefore its starting value in the CSS could be: “top: 0%”. Now I made the assumption that my js to achieve this would be: $(‘#myDiv’).animate({top : “-26%”}); After testing this, it became clear that the animate function was ignoring the ‘%’ sign and was just applying ‘-26px’ instead. After positing this directly to John Resig via twitter I got a response asking me to try: $(‘#myDiv’).animate({top : “-=26%”}); However the object always animates to: “top: 0px” regardless of its starting position, percentage value and the +=, -= notation. Is this a bug or am I missing something here? – Using JQuery 1.3.2 Adam Jessop.
[jQuery] Re: $('#foo p') or $('p', $('#foo'))
The benchmark is getElementById().getElementsByTagName() - why not inlcude that in the test? But it's not that simple (it never is). That code doesn't take into account browsers, like IE, returning element that have a name equal to the ID, not does it take into account the element (with the ID) not existing, nor does it return a static list of elements - it returns a live NodeSet (which is a constant source of misconceptions for developers). If you want to play the cross-browser roulette, make sure you go all the way in. --John
[jQuery] Re: $('#foo p') or $('p', $('#foo'))
To follow-up from my post yesterday, here are the new numbers, for 1.3.3 (work in progress, naturally): http://ejohn.org/files/jquery1.3.3/id.html jQuery version used = 1.3.3pre Total number of DIVs = 100 Paragraphs per DIV = 50 --- $(#div50 p) = 2ms $(p, #div50) = 0ms $(#div50).find(p) = 1ms --John On Wed, Feb 25, 2009 at 4:12 PM, Kevin Dalman kevin.dal...@gmail.com wrote: FYI, I built a quick test page for this. As previously noted, the differences in v1.2.6 are relatively small - about 2x as long for one syntax over the other. But with 1.3.2 - Wow! - 60x longer! jQuery version used = 1.3.2 Total number of DIVs = 100 Paragraphs per DIV = 50 --- $(#div50 p) = 574ms $(p, #div50) = 8ms $(#div50).find(p) = 9ms For anyone interested, below is *the complete test-page* so you can do your own testing - just copy and paste. No external files are required. Since the HTML is all generated by script, you can easily modify the number of divs and number of paragraphs per div just by changing the vars. You can also add as many test-cases for comparison as you want. It's all pretty self-explanitory. !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN http://www.w3.org/ TR/html4/strict.dtd HTML HEAD META http-equiv=Content-Type content=text/html; charset=utf-8 TITLEjQuery Speed Test/TITLE STYLE type=text/css body { font-family: Arial, Helvetica, sans-serif; font-size: 80%; color: #FFF; background: #000; margin: 15px; } div { border: 1px solid #FF0; padding: 5px 20px; margin: 1ex 0; } p { margin: 0; } div#Output { font-size: 1.25em; color: #000; background: #FFF; border: 3px solid #999; margin-bottom: 15px; } div#Output p { margin: 1ex 0; } /STYLE SCRIPT type=text/javascript src=http://code.jquery.com/jquery- latest.js/SCRIPT SCRIPT type=text/javascript $(document).ready(function(){ var c_divs = 100 , c_paras = 50 , myDiv = Math.floor(c_divs/2) , $Output = $(#Output) , $DIV , $Test , start, end , a_Selectors = [] , a_Times = [] ; $DIV = $(div/); for (var i=1; i = c_paras; i++) $DIV.append(p/).append( i ); for (var i=1; i = c_divs; i++) $DIV.clone(false).appendTo(document.body).attr(id,div+i); // Test # 1 start = new Date(); $Test = $(#div+ myDiv + p); end = new Date(); a_Selectors.push('$(#div'+ myDiv +' p)'); a_Times.push(end - start); // Test # 2 start = new Date(); $Test = $(p, #div+ myDiv); end = new Date(); a_Selectors.push('$(p, #div'+ myDiv +')'); a_Times.push(end - start); // Test # 3 start = new Date(); $Test = $(#div+ myDiv).find(p); end = new Date(); a_Selectors.push('$(#div'+ myDiv +').find(p)'); a_Times.push(end - start); // Write the Results $Output.html( pjQuery version used nbsp; = + $DIV.jquery +/p + pTotal number of DIVs = + c_divs +/p + pParagraphs per DIV nbsp; = + c_paras +/p + hr / ); var c = a_Selectors.length; for (var i=0; i c; i++) $Output.append(p+ a_Selectors[i] + = + a_Times[i] +ms / p); }); /SCRIPT /HEAD BODY DIV id=OutputWorking.../DIV /BODY /HTML
[jQuery] Re: $('#foo p') or $('p', $('#foo'))
WOW! Check out the last 2 tests, John. Syntax #4 takes 512-times longer than #5! I think this code needs a little TLC too ;) It was also interesting that $(#div500).children(p) is 10-times slower than $(#div500).find(p). So I added one final test using childNodes and filter() to see if I could beat .children()... Oh right, this is a regression to what I just did - I can tweak that. I'll look in to it tonight. --John
[jQuery] Re: $('#foo p') or $('p', $('#foo'))
Ok, fixed the perf regression. Here's the commit: http://dev.jquery.com/changeset/6261 In Firefox 3.0.6 I'm now getting (on my local copy): Query version used = 1.3.3pre Total number of DIVs = 1000 Paragraphs per DIV = 500 $(#div500 p) = 19ms $(p, #div500) = 2ms $(#div500).find(p) = 1ms $(#div500 p) = 6ms $(#div500).children(p); = 19ms I'll dig around tomorrow and see if I can still get some juice out of #div500 p. The issue is that $(#div500) takes a *ton* of shortcuts to try and make ID selectors faster - which is good since that's what developers tend to use a lot - but in the case of $(#div500 p) we have to dip down into the selector engine which has to be more thorough in its checks. I've cut out just about everything that I can to make #id-rooted queries faster, but I'll keep checking to see if there's something that I'm overlooking. As far as .children() goes, I have that on the list to optimize (along with next/prev/siblings/parent/parents/etc.). And I'll tackle the IE regression tomorrow morning, as well. Thanks for these tests - it's stuff that I've been meaning to get around to for a while now but it's good to have some easy-to-spot targets. --John On Wed, Feb 25, 2009 at 7:21 PM, John Resig jere...@gmail.com wrote: WOW! Check out the last 2 tests, John. Syntax #4 takes 512-times longer than #5! I think this code needs a little TLC too ;) It was also interesting that $(#div500).children(p) is 10-times slower than $(#div500).find(p). So I added one final test using childNodes and filter() to see if I could beat .children()... Oh right, this is a regression to what I just did - I can tweak that. I'll look in to it tonight. --John
[jQuery] Re: $('#foo p') or $('p', $('#foo'))
I want to point out a couple things: 1) You should always use $(#foo).find(p) in favor of $(p, $ (#foo)) - the second one ends up executing $(...) 3 times total - only to arrive at the same result as doing $(#foo).find(p). 2) I generally dislike saying that there's one good way to do a selector (especially with one that has such bad syntax, as above) - especially since it may not always be that way. In fact, I've already filed a bug and I'll be looking in to this issue, possibly resolving it tonight or tomorrow - at which point the advice will be false again. http://dev.jquery.com/ticket/4236 My recommendation is to always write the simplest, easiest to understand, expression: jQuery will try to do the rest to optimize it. --John On Feb 24, 10:23 am, Stephan Veigl stephan.ve...@gmail.com wrote: Hi Karl, $('#foo').find('p') and $('p', $('#foo')) are approximately of the same speed. I've put the test code on JSBin, so everybody can play around with it and try other combinations :-)http://jsbin.com/ifemo by(e) Stephan 2009/2/24 Karl Swedberg k...@englishrules.com: Hi Stephan, Thanks for doing this testing! Would you mind profiling $('#foo').find('p') as well? I suspect it will be roughly equivalent to $('p', $('#foo')) Cheers, --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Feb 24, 2009, at 8:28 AM, Stephan Veigl wrote: Hi, I've done some profiling on this, and $(p, $(#foo)) is faster than $(#foo p) in both jQuery 1.2.6 and 1.3.2. the test HTML consists of 100 ps in a foo div and 900 ps in a bar div. However the factor differs dramatically: In 1.2.6 the speedup from $(p, $(#foo)) to $(#foo p) was between 1.5x (FF) and 2x (IE), while for 1.3.2 the speedup is 20x (FF) and 15x (IE). $(p, $(#foo)) is faster in 1.3.2, by a factor of 1.5 (both FF and IE), while $(#foo p) is _slower_ in 1.3.2 by 8.5x (FF) and 4.6x (IE). Even with an empty bar div $(p, $(#foo)) is faster by a factor up to 3x. Conclusion: If you have an ID selector, first get the element by it's ID and use it as scope for further selects. by(e) Stephan 2009/2/23 ricardobeat ricardob...@gmail.com: up to jQuery 1.2.6 that's how the selector engine worked (from the top down/left to right). The approach used in Sizzle (bottom up/right to left) has both benefits and downsides - it can be much faster on large DOMs and some situations, but slower on short queries. I'm sure someone can explain that in better detail. Anyway, in modern browsers most of the work is being delegated to the native querySelectorAll function, as so selector performance will become more of a browser makers' concern. - ricardo On Feb 23, 1:08 pm, Peter Bengtsson pete...@gmail.com wrote: I watched the John Resig presentation too and learned that CSS selectors always work from right to left. That would mean that doing this:: $('#foo p') Would extract all p tags and from that list subselect those who belong to #foo. Suppose you have 1000 p tags of them only 100 are inside #foo you'll have wasted 900 loops. Surely $('#foo') is the fastest lookup possible. Doing it this way will effectively limit the scope of the $('p') search and you will never be bothered about any p tags outside #foo. Or am I talking rubbish?
[jQuery] Re: Stopping emails
I just changed your setting to 'No Email'. --John On Mon, Feb 23, 2009 at 1:15 PM, Alan Williams a...@ralentango.co.uk wrote: Hi I currently get all the posts to this group sent to me by email, but not because I am a member of the Google group (I must have signed up to the emails before the group was set up). I have tried joinng the group, changing the settings and unsubscribing, but all to no avail: the emails keep coming. Please can anyone tell me how to unsubscribe to the email feed? Alan
[jQuery] Re: 1.3.1/2 selecting bug... or feature?
Looks like a bug to me. In this case it seems like doing just li would be equivalent to what you want. Could you file it here? http://dev.jquery.com/newticket --John On Mon, Feb 23, 2009 at 11:43 AM, Sjeiti sje...@gmail.com wrote: I've build a recursive tree. Now I'm trying to get the number of list elements but I get weirds results: $(li).length = 10; $(bodyul li).length = 4; Is this right?.. or a bug... (1.2.6 works as expected) [code] !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / !--script type=text/javascript src=scripts/ jquery-1.2.6.min.js/script-- script type=text/javascript src=scripts/jquery-1.3.2.min.js/ script script type=text/javascript $(function(){ $(body).prepend($(\bodyul li\).length = +$(bodyul li).length +;br/); $(body).prepend($(\li\).length = + $(li).length +;br/ ); }); /script /head body ul li spana/span ul li spanaa/span /li li spanab/span /li li spanac/span ul li spanaca/span /li li spanacb/span /li li spanacc/span /li /ul /li /ul /li li spanb/span /li li spanc/span /li li spand/span /li /ul /body /html [/code]
[jQuery] Re: Lower speed with 1.3.1 vs 1.2.6 with simple parsing
A lot has changed with regard to the selector engine in 1.3.1 - it this case it looks like these type of selections didn't benefit. One thing that would change that, though, would be caching the selectors that you do run. Right now you run a couple of these over-and-over again. I'd probably rewrite your method like this: // COLLECTOR function getProcessMenuItem(li) { var type = processMenuItem; var first = $(li).find('a:first'), news = $(li).find('li.News a'), splash = $(li).find('li.Splash a'); var item = { id : $(li).attr('id'), type : type, title : first.text(), URI: first.attr('href'), preamble : $(li).find('h4').text(), body : $(li).find('p').text(), news : { title : news.text(), URI : news.attr('href'), summary : news.attr('title') }, splash : { title : splash.text(), URI : splash.attr('href'), summary : splash.attr('title'), media : splash.next().attr('src') }, links : getAnchorLinks(li) }; return item; }; I'm not sure what's in your getAnchorLinks method - but that could probably be optimized as well. --John On Fri, Feb 20, 2009 at 5:02 AM, Sjoland jo...@sjoland.com wrote: The markup look like this: li class=MenuItem processMenuItem id=MENUID-D a href=processing/x/XbrProcessing/a ul li class=Intro h4If you recieve 20,000 invoices per year, you can save at least $100,000/h4 pLorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua./p /li li class=News Disabled a href=processing/x/news/ title=News summary.News text.../a /li li class=Splash Disabled a href=processing/x/splash/ title=Splash summary.Splash text.../ a img src=media/splashImage.jpg /li li class=Anchora href=processing/x/#OverviewOverview/a/li li class=Anchora href=processing/x/#Introduction title=We are experts in sorting.Introduction/a/li li class=Anchora href=processing/x/#ArticleArticle/a/li li class=Anchora href=processing/x/#FeaturesFeatures/a/li li class=Anchora href=processing/x/#References title=IKEA, Porsche, Pfizer, SAS, Tetra Pak, Carlsberg, DaimlerChrysler, LEGO, Bosch, DFDS transport, Canon...References/a/li li class=Anchora href=processing/x/#TechnicalTechnical/a/ li li class=Anchora href=processing/x/#Integration title=Lorem ipsum dolor sit amet.Integration/a/li li class=Anchora href=processing/x/#DownloadsDownloads/a/ li /ul /li The timer looks like this: var timer = { time: 0, now: function(){ return (new Date()).getTime(); }, start: function(){ this.time = this.now(); }, since: function(){ return this.now()-this.time; } }; ...and I start the timer in the last row of the last script being loaded... Yes, I know there are many ways to improve and optimize my methods, BUT that's not my main issue right now, becuse any improvment like the one Ricardobeat suggests still ends up with less speed in 1.3.1 vs 1.2.6. Thanks, /Johan
[jQuery] Re: .contents() not meeting its contract?
.not() and .filter() don't work against text nodes (they're immediately removed). If you wish to just get the text nodes you can do: $(p).contents().filter(function(){ return this.nodeType !== 1; }) Although, it sounds like you're trying to do this instead: $(p).wrapInner(b/b); --John On Fri, Feb 20, 2009 at 9:11 AM, David david.kar...@gmail.com wrote: According to the documentation, .contents() should Find all the child nodes inside the matched elements (including text nodes). However, in the example given there, when the jquery $(p).contents().not([nodeType=1]).wrap(b/) is applied to the content pHello a href=http://ejohn.org/;John/a, how are you doing?/ p only the text John is made bold---in other words, jquery is failing to select the text nodes containing Hello and , how are you doing Since I would very much like to be able to select the text nodes, can someone explain what is going on here? Thanks David
[jQuery] jQuery 1.3.2 Released
Hi Everyone - Full details here: http://docs.jquery.com/Release:jQuery_1.3.2 Enjoy! --John
[jQuery] Re: jQuery 1.3.2 Released
Awesome, thanks John. So UI 1.7 should be around the corner as well? Let's hope so! You'll have to ask the UI team :-) I think they're getting real close, though. --John
[jQuery] Re: A question for John Resig
I'm curious what the benefit of that would be. Given that the window.undefined property exists and has the undefined value, I'd think they would give the same result. They give the same results for properties, at least: someObject.undefinedProperty === undefined but not for variables that are undefined (meaning that 'var someUndefinedVar' or 'window.someUndefinedVar' was not used): someUndefinedVar === undefined // error typeof someUndefinedVar === undefiend // works I think it'd be better to be consistent everywhere. --John
[jQuery] Re: Lower speed with 1.3.1 vs 1.2.6 with simple parsing
Do you have some sample markup? It's kind of hard to determine from just the code. --John On Thu, Feb 19, 2009 at 2:18 PM, Sjoland jo...@sjoland.com wrote: Hi!, When switching between 1.3.1 and 1.2.6 i get a serious drop in speed when collection a JSON object from static HTML content. 1.2.6 FF: 325ms Safari: 75ms IE7: 450ms 1.3.1 FF: 1205ms Safari: 415ms IE7: 1550 ms The javascript collects data into a JSON object with a few methods like this: // MAIN function getMenuItems(menu) { var menuItems = []; $(menu).find('.MenuItem').each(function(){ var item = false; if ($(this).hasClass('processMenuItem')) item = getProcessMenuItem($ (this)[0]); if ($(this).hasClass('softwareMenuItem')) item = getSoftwareMenuItem ($(this)[0]); if ($(this).hasClass('listMenuItem')) item = getListMenuItem($(this) [0]); if ($(this).hasClass('aboutMenuItem')) item = getAboutMenuItem($ (this)[0]); menuItems.push(item); }); return menuItems; }; // COLLECTOR function getProcessMenuItem(li) { var type = processMenuItem; var item = { id : $(li).attr('id'), type : type, title : $(li).find('a:first').text(), URI: $(li).find('a:first').attr('href'), preamble : $(li).find('li.Intro h4').text(), body : $(li).find('li.Intro p').text(), news : { title : $(li).find('li.News a').text(), URI : $(li).find('li.News a').attr('href'), summary : $(li).find('li.News a').attr('title') }, splash : { title : $(li).find('li.Splash a').text(), URI : $(li).find('li.Splash a').attr('href'), summary : $(li).find('li.Splash a').attr('title'), media : $(li).find('li.Splash img').attr('src') }, links : getAnchorLinks(li) }; return item; }; Anyone else experiencing drops in speed with 1.3.1 doing simple stuff like this? Sure, I was not expecting any major speed increase since the code is not optimized yet, but an 80% drop is just crazy... Please advice, /Johan
[jQuery] Re: A question for John Resig
Extra function calls sure - plus there's really no need for those methods, they're already a part of JavaScript. typeof FOO === string typeof FOO === number typeof FOO === boolean --John On Tue, Feb 17, 2009 at 11:53 PM, pbcomm pbc...@gmail.com wrote: This might be a stupid question, but I have to ask ... What is the reason for not having functions like isString, isNumber, isBoolean, etc? Is it just because that would create extra function calls?
[jQuery] Re: A question for John Resig
It really depends in which browser you test. I'm seeing little to no difference in IE and Firefox - but a noticeable difference in Safari and Opera. http://dev.jquery.com/~john/ticket/equals/ Safari: +3ms, +2ms, +7ms, +3ms, +4ms Opera: +46ms, +35ms, +21ms, +19ms, +36ms (over 500,000 iterations) It's not massive, but it's measurable. As far is its use - I see no problem with it. It's more precise and instills good habits (being more precise about what you want to target). I also see no problem with this: if ( typeof text !== object text != null ) We want items that aren't objects, aren't null, and aren't undefined. Looks fine to me. As far as convention, we're already working to formalize it: http://docs.jquery.com/JQuery_Core_Style_Guidelines It's very basic right now (and we'll probably switch from foo === undefined to typeof foo === undefined - we'll see) but it's a work in progress. --John On Wed, Feb 18, 2009 at 3:43 PM, Matt Kruse m...@thekrusefamily.com wrote: On Feb 18, 2:20 pm, Kean shenan...@gmail.com wrote: While it would not affect the results, I believe you can shave a few ms off by using === Over 10,000,000 iterations, I see no difference in time between using == and ===. If the return type of 'typeof' varied, a difference might be found. It's just a minor quibble anyway. It's similar to lines like this in the jquery source: if ( typeof text !== object text != null ) Fixing things like this would tighten and improve the code a bit, IMO. Matt Kruse
[jQuery] Re: A question for John Resig
Why implement jQuery.isFunction when you can also just go typeof variable == 'function'? You can see some of the cases that we handle that normal typeof can't, here: http://dev.jquery.com/browser/trunk/jquery/test/unit/core.js#L176 --John
[jQuery] Re: A question for John Resig
Safari: +3ms, +2ms, +7ms, +3ms, +4ms Opera: +46ms, +35ms, +21ms, +19ms, +36ms I forgot to mention that this means that == is about 10% slower than === in both browsers. --John
[jQuery] Re: selector best practice
Umm - that's not true at all. I created a test for you to see: http://dev.jquery.com/~john/ticket/class-speed/ In Firefox 3 I'm getting: ID Raw: 9 ID jQuery: 22 (over 500 queries) Class Raw: 1108 Class jQuery: 778 (over 100 queries) In Safari 3.2 I'm getting: ID Raw: 1 ID jQuery: 3 (over 500 queries) Class Raw: 224 Class jQuery: 184 (over 100 queries) So not only is jQuery's class implementation faster but the ID searching has an approximately 0.026 milliseconds overhead - that's 2.6% of 1 millisecond per query - an absolutely acceptable figure to be able to live with. --John On Mon, Feb 16, 2009 at 8:28 AM, RobG rg...@iinet.net.au wrote: On Feb 16, 5:30 pm, SteelRing steelr...@gmail.com wrote: This may sound stupid to y'all jquery practitioners, but i wonder which method is fastest (recommended) for selecting a cell with a class in a big table (think like 1000+ rows 100+ columns): Fastest: the browser-native getElementsByClassName (recent Firefox, Opera, Safari) is 20 to 40 times faster than $('.className'), as a bonus you get a live collection. Alternatively, XPath is probably just as quick but the result isn't live (supported by the same set of browsers). The jQuery way is to use a CSS selector, however it is much slower than other methods (except perhaps in IE). (#tableid tbody tr.rowclass td.cellclass) or is it (td.cellclass) or (.cellclass). And how about if the cell happens to have a unique id: (#tableid tbody tr#uniquerow td#uniqueid) or just (#uniqueid) If speed really matters, getElementById is more than 7 times faster than $('#...') in Firefox and 4 times faster in Safari. Philosophically, the question being is it better to put as much detail as structurally already known by the programmer into the selector or just anything goes and let jquery handle it as long as it works. There is no selector optimisation that I can see in jQuery other than using getElementById after discovering '#...' (and the overhead of discovering that means it is 4 to 6 times slower than gEBI). As a general rule, keep the selector to a minimum that concisely describes the element - cells must be inside table, table section and row elements, including those in a selector doesn't seem to help. An ID for the starting selector likely does. Do some testing for particular circumstances, the most efficient method will emerge. Don't forget to include browser-native methods where available. -- Rob
[jQuery] Re: class weirdness in loaded XML?!?
I filed a bug and fixed the issue: http://dev.jquery.com/ticket/4167 --John On Mon, Feb 16, 2009 at 11:40 AM, ml1 tsummer...@gmail.com wrote: Tragically none of those quoting variations work. (I've pretty much exhausted every quote variation in my desperate search to try to figure out what's going on.) Any other ideas? Could this possibly be a jquery bug? On Feb 16, 11:35 am, Michael Lawson mjlaw...@us.ibm.com wrote: I didn't notice the quotation discrepancy, good catch! Also, I know they're not required, but it's good practice IMHO. cheers Michael Lawson Content Tools Developer, Global Solutions, ibm.com Phone: 1-919-517-1568 Tieline: 255-1568 E-mail: mjlaw...@us.ibm.com 'Examine my teachings critically, as a gold assayer would test gold. If you find they make sense, conform to your experience, and don't harm yourself or others, only then should you accept them.' From: Karl Swedberg k...@englishrules.com To: jquery-en@googlegroups.com Date: 02/16/2009 11:31 AM Subject:[jQuery] Re: class weirdness in loaded XML?!? The string does not need to be wrapped in single quotation marks. Also, why does the selector begin with a single quotation mark and end with a double? Are these just typos in the emails? Try this: $('span[class*=mycategory]',xml).length Just one set of single quotation marks, and the closing mark is to the right of the closing bracket. --Karl Karl Swedbergwww.englishrules.comwww.learningjquery.com On Feb 16, 2009, at 11:15 AM, Michael Lawson wrote: You should wrap your string in ' so your code would be $('span[class*='mycategory'],xml).length cheers Michael Lawson Content Tools Developer, Global Solutions, ibm.com Phone: 1-919-517-1568 Tieline: 255-1568 E-mail: mjlaw...@us.ibm.com 'Examine my teachings critically, as a gold assayer would test gold. If you find they make sense, conform to your experience, and don't harm yourself or others, only then should you accept them.' graycol.gifml1 ---02/16/2009 11:08:46 AM---I have something very strange going on trying to create a wrapped set ecblank.gifecblank.gif From:ml1 ?tsummer...@gmail.com ecblank.gifecblank.gif To: jQuery (English) jquery-en@googlegroups.com ecblank.gifecblank.gif Date:02/16/2009 11:08 AM ecblank.gifecblank.gif Subject: [jQuery] class weirdness in loaded XML?!? I have something very strange going on trying to create a wrapped set of elements from an xml file loaded via jquery's xmlhttprequest. The xml has a number of entries with class attributes that have multiple values, ie span class=mycategory mychoice ../span When I use this selector: $('span[class*=mycategory],xml).length jquery returns zero. Weirdly if I do exactly the same thing but use a different attribute name from class in the xml and the query, it works perfectly. If I use this method I get the expected result: $('span').attr('class') It returns mycategory mychoice Is there something special about the class attribute in xml that is causing this? graycol.gif 1KViewDownload ecblank.gif 1KViewDownload
[jQuery] Re: class weirdness in loaded XML?!?
No problem man. In the future feel free to bring issues like this up on the jquery-dev list - we can diagnose or fix the problem quite quickly. Thanks for spotting this! --John On 2/16/09, ml1 tsummer...@gmail.com wrote: Holy cow, before I even submitted the bug report! On Feb 16, 1:24 pm, John Resig jere...@gmail.com wrote: I filed a bug and fixed the issue:http://dev.jquery.com/ticket/4167 --John On Mon, Feb 16, 2009 at 11:40 AM, ml1 tsummer...@gmail.com wrote: Tragically none of those quoting variations work. (I've pretty much exhausted every quote variation in my desperate search to try to figure out what's going on.) Any other ideas? Could this possibly be a jquery bug? On Feb 16, 11:35 am, Michael Lawson mjlaw...@us.ibm.com wrote: I didn't notice the quotation discrepancy, good catch! Also, I know they're not required, but it's good practice IMHO. cheers Michael Lawson Content Tools Developer, Global Solutions, ibm.com Phone: 1-919-517-1568 Tieline: 255-1568 E-mail: mjlaw...@us.ibm.com 'Examine my teachings critically, as a gold assayer would test gold. If you find they make sense, conform to your experience, and don't harm yourself or others, only then should you accept them.' From: Karl Swedberg k...@englishrules.com To: jquery-en@googlegroups.com Date: 02/16/2009 11:31 AM Subject:[jQuery] Re: class weirdness in loaded XML?!? The string does not need to be wrapped in single quotation marks. Also, why does the selector begin with a single quotation mark and end with a double? Are these just typos in the emails? Try this: $('span[class*=mycategory]',xml).length Just one set of single quotation marks, and the closing mark is to the right of the closing bracket. --Karl Karl Swedbergwww.englishrules.comwww.learningjquery.com On Feb 16, 2009, at 11:15 AM, Michael Lawson wrote: You should wrap your string in ' so your code would be $('span[class*='mycategory'],xml).length cheers Michael Lawson Content Tools Developer, Global Solutions, ibm.com Phone: 1-919-517-1568 Tieline: 255-1568 E-mail: mjlaw...@us.ibm.com 'Examine my teachings critically, as a gold assayer would test gold. If you find they make sense, conform to your experience, and don't harm yourself or others, only then should you accept them.' graycol.gifml1 ---02/16/2009 11:08:46 AM---I have something very strange going on trying to create a wrapped set ecblank.gifecblank.gif From:ml1 ?tsummer...@gmail.com ecblank.gifecblank.gif To: jQuery (English) jquery-en@googlegroups.com ecblank.gifecblank.gif Date:02/16/2009 11:08 AM ecblank.gifecblank.gif Subject: [jQuery] class weirdness in loaded XML?!? I have something very strange going on trying to create a wrapped set of elements from an xml file loaded via jquery's xmlhttprequest. The xml has a number of entries with class attributes that have multiple values, ie span class=mycategory mychoice ../span When I use this selector: $('span[class*=mycategory],xml).length jquery returns zero. Weirdly if I do exactly the same thing but use a different attribute name from class in the xml and the query, it works perfectly. If I use this method I get the expected result: $('span').attr('class') It returns mycategory mychoice Is there something special about the class attribute in xml that is causing this? graycol.gif 1KViewDownload ecblank.gif 1KViewDownload -- --John
[jQuery] Re: Feature Detection Best Practice?
That seems like a good use to me! --John On Thu, Feb 12, 2009 at 10:21 PM, Chris cpot...@siolon.com wrote: I ventured into feature detection, and I want to make sure I'm doing this the right way. Basically the fx on the jQuery UI tabs causes aliasing in IE 6/7 (but not 8). Instead of checking for those browsers the old way I thought this is the right way. if (!$.support.opacity) { $(.ui-tabs ul).tabs(); } else { $(.ui-tabs ul).tabs({ fx : { height: 'toggle', opacity: 'toggle' } }); }
[jQuery] Re: Simple selector not working in 1.3.1 and webkit (safari and chrome)
That's odd. Could you file a bug on this? http://dev.jquery.com/newticket Thanks! --John On Tue, Feb 3, 2009 at 10:39 AM, Javier Martinez ecentin...@gmail.com wrote: I'm creating a component for an application I'm developing and I have upgraded jquery to the last version to get it's speed boost. After some testing I have seen that my component is not working correctly in webkit browsers because there is some bug with the new Sizzle selector of the new jquery. I can't provide my source files, but I have created a simple test case that shows this error. !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en head meta http-equiv=Content-Type content=text/html; charset=utf-8 / script type=text/javascript src=jquery.js/script script type=text/javascript $(function() { var container = $('#container'); var containerSelecteds = function() { return container.find('ul.selected'); }; var bodySelecteds = function() { return $('ul.selected'); }; var select = function(nodes) { containerSelecteds().removeClass('selected'); nodes.addClass('selected'); // the container html show me that the element has the class selected alert(container.html()); // webkit (chrome and safari) says that there are no elements inside of container with the class selected alert(containerSelecteds().length); // but the element exists in the dom, and it has the classname selected !! alert(bodySelecteds().length); }; var element = $('ul class=someclassliMyText/li/ul').appendTo(container); select(element, false); }); /script /head body div id=container style=border:1px solid #ccc;height:300px;width:300px/div /body /html I will try to explain the error: I'm inserting a node inside the container div, and applying a classname selected to this node. After this, I want to select the nodes inside container that have this classname. Firefox, IE, etc, says that there is one node inside container. But webkit browsers says that there is a node with this classname in the dom, but not inside container. I think that this is a quite simple css selector, so I don't know why it fails. Thanks. PD: it doesn't fails with jquery 1.2.6
[jQuery] Re: 1.3 and toggle()
It looks like you're trying to use a jQuery UI effect - maybe that's why? --John 2009/1/30 gmacgregor gmacgre...@gmail.com: Consider this markup: div class=holder h4Foo/h4 div class=bar Hello! /div /div Since upgrading to 1.3, this no longer works: $('div.holder h4').click(function() { $(this).toggleClass('close'); $(this).next('.bar').toggle(blind, {direction: vertical}, 600); return false; }); If I simply call $(this).next('.bar').toggle(fast) instead everything is fine. Am I completely missing something in the docs with regards to toggle()? Any help much appreciated...
[jQuery] Re: vsdoc for new jquery 1.3.1
The team at Microsoft is already working on it. Hopefully it'll be ready soon. --John On 1/22/09, Fisher Ning ning...@gmail.com wrote: Hi guys, Does anyone know when the jQuery Visual studio doc (jquery-vsdoc.js) will be updated for new 1.3.1? Is there any plan for this? Regards, Fisher -- --John
[jQuery] Re: 1.3.1 is over 10x slower than 1.2.6
I'm not seeing this, no. Do you have a link to the app? What version of Firebug are you using? --John On 1/22/09, Loren lorenw...@gmail.com wrote: Hello, I have an application that does lots of HTML injection, animation, and manipulation, and I'm a long time user and fan of jQuery. Recently I downloaded 1.3.1, and my app became really sluggish. Normally it loads in under a second, but with 1.3.1 it takes over 3 seconds to load, and the animation is choppy. The problem *really* shows up when I use firebug. Normally my app loads in about 3-4 seconds in firebug, but the 1.3.1 library increases the firebug load time to about 50 seconds (you read that right). Here is a link to two screen shots of the firebug profiler. The first screen shot is using 1.2.6: http://public.hotwall.com/tmp/jQuery1.2.6.jpg The next link is the same profile (loading the app). The only difference is it's using 1.3.1: http://public.hotwall.com/tmp/jQuery1.3.1.jpg The profiler numbers show where the time is being spent. Is anyone else having speed problems with the new 1.3 jQuery? -Loren -- --John
[jQuery] Re: $('.someclass[initialized!=1]') fails in 1.3; works in 1.2 (if elements don't have initialized attr)
This was fixed in 1.3.1. --John On Thu, Jan 22, 2009 at 4:42 PM, Soulcatcher foril...@gmail.com wrote: Say i have several elements with class='someclass' and they DON'T have attribute 'initialized' initially. When i do $('.someclass[initialized!=1]') in 1.2.6, i get the list of all those elements. In 1.3, i get an empty list. I traced it to line 1986 in jquery 1.3 (Revision 6104) that will return false if given attribute doesn't exist. So, is it a bug or a 'feature' of 1.3? :) I hope it's a bug cause this is very useful when you want to get all elements that weren't initialized before. If it's a feature, what's the best way of doing this check then? using each() like this: $('.someclass').each(function(){ if($(this).attr('initialized') != 1){initialize..;$(this).attr ('initialized',1) } }); ? Was so easy and simple before...
[jQuery] Re: 1.3, attributeStartsWith and '['
I filed a bug over here: http://dev.jquery.com/ticket/3928 and have since fixed the issue. --John On Mon, Jan 19, 2009 at 2:08 PM, Balazs Endresz balazs.endr...@gmail.com wrote: Unforunately it's just turned out that there's anothor isssue behind this. You can follow the ticket if you want update on this, I guess it will be solved soon. On Jan 19, 10:46 am, Jedrzej Majko jdr...@gmail.com wrote: Hello, I have strange problem with attribute StartsWith in new version of jQuery. This code gives 'FOUND' in 1.2.6 and 'NOT FOUND' in 1.3. There's a problem with [name^='item['], [name^='item[1]'] works fine. Is this a bug, or expected behavior? Code: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en head meta http-equiv=Content-Type content=text/html; charset=UTF-8 / script type=text/javascript src=http://jqueryjs.googlecode.com/ files/jquery-1.3.js/script script type=text/javascript $(document).ready(function(){ if($([name^='item[']).length==0){ alert('NOT FOUND'); } else { alert('FOUND'); } }); /script /head body input type=text name=item[1] value=1/ /body /html
[jQuery] Re: addEvent wrap for document.ready()
Why not just do: function addEvent(obj, evt, fn){ jQuery(obj).bind(evt, fn); } Just defer everything to jQuery! --John On Mon, Jan 19, 2009 at 2:48 AM, rundmw run...@gmail.com wrote: I have an existing application which I would like to transition to use jQuery. The app currently uses Dean Edwards addEvent() function in many (many!) locations, mostly as addEvent(window, 'load', fn). In all of these cases, wndow.onload is not strictly required; document.ready () would not only suffice, but be a significant improvement. Rather than chase all the references in the app to addEvent(), it would be desirable to replace the Dean Edwards implementation with something like the following: function addEvent(obj, evt, fn){ if (obj == window evt = 'load'){ // use document onready } else { use the original addEvent code } } Does this seem reasonable? Any suggestions on the precise syntax? [ I'm not a noob, per se, but I do confess that sometimes the jQuery codebase ventures a bit over my head, getting a bit confusing with issues of binding, with IE memory leaks, etc. So I apologize in advance for the somewhat vague and possibly trivial nature of the request. ] Any ideas would be greatly appreciated. Thanks and best regards,
[jQuery] Re: jquery 1.3 n.queue is not a function?
Do you have a URL for your site anywhere? --John On Mon, Jan 19, 2009 at 11:45 AM, yellow1912 yellow1...@gmail.com wrote: When I try to use jquery 1.3 on my test site, I get this error: jQuery.queue is not a function [Break on this error] var queue = jQuery.queue( this, type, data ); (firebug) The site is using livequery, form, metadata and validate plugin in, all upgraded for 1.3 support. Weird.
[jQuery] Re: jQuery 1.3 live not working correctly
Do you have an example anywhere that we can look at? Also, could you post a follow-up to the jquery-dev list? Thanks. http://groups.google.com/group/jquery-dev --John On Mon, Jan 19, 2009 at 7:25 AM, Walther waltherl...@gmail.com wrote: I am having an issue with the new live events in jQuery 1.3. Specifically I am having an regarding event bubbling. I have a a list of items, each item element looks like : liabla/a/li. When the user clicks on the li element one thing should happen, and when the user clicks on the a element another thing should happen (The css styles are such that the user can easily see what to do). I will be dynamically adding and removing items from the list, hence the reason to use live events. When I use live events and click on the a element the li elements click handler is also fired even though I am using the stopPropagation function (and I've tried return false as well). If I use the normal bind function then it works 100%. Is there a possible bug in the live events implementation, or am I missing something? Walther.
[jQuery] Re: jquery 1.3 n.queue is not a function?
Also, could you post that URL to the jquery-dev list when you have it? Thanks. http://groups.google.com/group/jquery-dev --John On Mon, Jan 19, 2009 at 11:52 AM, John Resig jere...@gmail.com wrote: Do you have a URL for your site anywhere? --John On Mon, Jan 19, 2009 at 11:45 AM, yellow1912 yellow1...@gmail.com wrote: When I try to use jquery 1.3 on my test site, I get this error: jQuery.queue is not a function [Break on this error] var queue = jQuery.queue( this, type, data ); (firebug) The site is using livequery, form, metadata and validate plugin in, all upgraded for 1.3 support. Weird.
[jQuery] Re: Selector *= not works in Safari 3.2.1 and Chrome 1.0.154.43
What version of jQuery are you using? --John On Fri, Jan 16, 2009 at 2:35 AM, floyd floyd...@gmail.com wrote: Hi all, Here is my situation. HTML Page DTD Type is declared as following !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.1//EN http://www.w3.org/ TR/xhtml11/DTD/xhtml11.dtd Javascript Code as following $(#fp option[text*='+subject+']).remove(); Where #fp is a select.../select object Works fine in IE7 and FireFox 3.0.5 How can I fix this line or is a bug? Thanks in advance!
[jQuery] Re: jQuery UI 1.6rc5
The jquery-ui list would be a better place for this question. http://groups.google.com/group/jquery-ui --John On Fri, Jan 16, 2009 at 9:34 AM, Eric Garside gars...@gmail.com wrote: When is this planned on coming out? Anyone know?
[jQuery] Re: question about changes to :not() in 1.3
$(':not(div:has(div))') is equivalent to $('*:not(div:has(div))') is equivalent to $('*').filter(':not(div:has(div))') is equivalent to $('*').not('div:has(div)') Hope that helps to answer your question :) --John On Fri, Jan 16, 2009 at 11:24 AM, jdwbell jdwb...@gmail.com wrote: Here I am trying to get every element which is not a div that contains another div. Is $(':not(div:has(div))') supposed to now be equivalent to $('*').not ($('div:has(div)')) or am I misunderstanding what the change was (I'm just getting started with jQuery)? Thanks!
[jQuery] jQuery 1.3 Released
Hey Everyone - jQuery 1.3 is out! Full details here: http://blog.jquery.com/2009/01/14/jquery-13-and-the-jquery-foundation/ Happy 3rd Birthday, jQuery! --John
[jQuery] Re: @name deprecated?
Why disappointingly? Because 1.2 to 1.3 is a big major release... and there's a few post to test test test, but there's no indication of what to test for.. what's changed what could break Huh? Did you miss the beta 1 post where we outlined everything that could've broken? http://blog.jquery.com/2008/12/22/help-test-jquery-13-beta-1/ I think we outlined it there fairly well - and we've gotten some great feedback. --John
[jQuery] jQuery 1.3rc2 Ready
Hey Everyone - jQuery 1.3rc2 is ready. This means that 1.3 is effectively finished barring a horrible bug between now and the final release on Wednesday (the 14th). You can grab the source here: http://code.jquery.com/jquery-1.3rc2.js Please let me know, personally, if you find some bad new bug and we can triage it together. A screenshot of the final test run can be found here (on 8 browsers): http://www.flickr.com/photos/jeresig/3192101251/ A couple bugs were found in last night's rc1 one (a problem with :not(:first) failing, and two problems with disconnected elements causing problems). As of right now users of the Validation plugin and jQuery UI will both need to upgrade to the latest release when they upgrade to jQuery 1.3. --John
[jQuery] jQuery 1.3rc1 Ready
Hey Everyone - jQuery 1.3rc1 is ready. This means that 1.3 is effectively finished barring a horrible bug between now and the final release on Wednesday (the 14th). You can grab the source here: http://code.jquery.com/jquery-1.3rc1.js Please let me know, personally, if you find some bad new bug and we can triage it together. A screenshot of the final test run can be found here (on 8 browsers): http://flickr.com/photos/jeresig/3189240673/ Who else here is excited to get this out the door? --John
[jQuery] Re: jQuery 1.3rc1 Ready
jQuery 1.3rc1 is ready. This means that 1.3 is effectively finished barring a horrible bug between now and the final release on Wednesday That's great news. For those of us who haven't been following recent development, are there any release notes available? Nope - but there will be a full set of release notes to go with the final release of 1.3. Just want to make sure that it's relatively bug-free, first! --John
[jQuery] Re: jQuery 1.3rc1 Ready
Do you have an example? It's kind of hard to figure out what's going wrong with only a line to look at. --John On Sun, Jan 11, 2009 at 11:07 PM, Canglan cang...@gmail.com wrote: Kudos! John, the RC1's new selector is causing problems with some of my existing code base, I've submitted a ticket: http://dev.jquery.com/ticket/3826 Thanks!
[jQuery] Help Test jQuery 1.3 Beta 2
Beta 2 is now out - and we need help testing it! More information here: http://blog.jquery.com/2009/01/05/help-test-jquery-13-beta-2/ --John
[jQuery] Re: jQuery way
Maybe: $(#container).children().not(#header, #content, #footer).empty(); --John On Sun, Jan 4, 2009 at 2:05 PM, Dirceu Barquette dirceu.barque...@gmail.com wrote: Hi all! Is there better way? var elem = $('#container')[0]; var arr = [header,content,footer]; jQuery.each(elem.childNodes,function(k,v) { if (jQuery.inArray(v.id, arr) 0) { $(v).empty(); } }) thanks Dirceu Barquette
[jQuery] Help Test jQuery 1.3 Beta 1
Hi Everyone - The jQuery dev team just got jQuery 1.3 Beta 1 out the door. Help us test this release and make sure it goes nice and smoothly! http://blog.jquery.com/2008/12/22/help-test-jquery-13-beta-1/ Thanks in advance. --John
[jQuery] Re: Simple XPATH Selector
jQuery doesn't support XPath selectors any more - you need to use CSS selectors. $(p).addClass(jq); --John On Dec 20, 9:36 am, chinnakarup...@gmail.com chinnakarup...@gmail.com wrote: Hi, I am trying XPATH selector with jqueryit doesn't seem to work..find below the eg.it should select the paragraph. can any tell me what I am missing. THnks !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleNew Web Project/title style type='text/css' .jq{ background-color:red; } /style script type=text/javascript src=/lib/jquery/ jquery.js/script script type=text/javascript $(document).ready(function(){ $(//p).addClass(jq) }) /script /head body h1heading/h1 pparagraph/p /body /html
[jQuery] Re: :not selector --- not working
That's an XPath selector, not a CSS selector. To do that in jQuery you would need to do: $(tr:not(:has(th)):even) --John On Dec 20, 9:38 am, chinnakarup...@gmail.com chinnakarup...@gmail.com wrote: Hi, I tried a eg for :not operator.According to which it should not pick up the Table header but it does .what am i missing. One more question what is the significance of putting the 'th' in the square bracket .is it OK to write like this. $('tr:not(th):even').addClass('even'); THnks !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleNew Web Project/title style type='text/css' .even{ background-color:blue; } /style script type=text/javascript src=/lib/jquery/ jquery.js/script script type=text/javascript $(document).ready(function(){ $('tr:not([th]):even').addClass('even'); }) /script /head body table tr thTitle/th thCategory/th /tr tr tdAs You Like It/td tdComedy/td/tr tr tdAll's Well that Ends Well/td tdComedy/td/tr tr tdHamlet/td tdTragedy/td/tr tr tdMacbeth/td tdTragedy/td/tr tr tdRomeo and Juliet/td tdTragedy/td/tr tr tdHenry IV, Part I/td tdHistory/td/tr tr tdHenry V/td tdHistory/td/tr /table /body /html
[jQuery] Re: JQuery licensing questions
Yes, that is perfectly fine on the MIT license. --John On Mon, Nov 10, 2008 at 6:45 PM, acesfull9 [EMAIL PROTECTED] wrote: I am working on a web application project that utilizes jquery. I would like to be able to license the system I created to local businesses for a fee. Is this possible to do with jquery under either the MIT or GPL licenses? A license of the system will be purchased and the customer will host it on their own systems. I will not be hosting the application if that makes a difference. Thanks in advance -- View this message in context: http://www.nabble.com/JQuery-licensing-questions-tp20430612s27240p20430612.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: closing tag bug in jQuery 1.2.6?
I'm fairly certain that's incorrect syntax (putting a div inside a span - especially one that's self-closing). The browser will automatically force the div outside the span. --John On Wed, Oct 29, 2008 at 11:38 AM, Jay [EMAIL PROTECTED] wrote: Has someone else already posted this bug? The following code shows jquery failing to detect the termination of a tag. Load the page and click on the word login. The selector should find the empty div and display the html content (nothing). Instead shows the span closing tag and the javascript that follows. html head titlejQuery bug test Page/title script src=script/jquery-1.2.6.min.js type=text/javascript/ script /head body style=background-color:black span id=Login style=position:absolute; top:20px; left:5%; width: 90%; z-index:12; span id=LoginToggle style=float:right; color=green;Login/span div class=popupContent style=float:right; / /span script type=text/javascript !-- $( function() { $(#LoginToggle).click( function(){ alert( $ ( '#Logindiv.popupContent' ).html() ); }); } ); //-- /script /body /html If you change the div closing it works correctly. Change this: div class=popupContent style=float:right; / To this: div class=popupContent style=float:right; /div Does the same in IE7 and FF3
[jQuery] Re: JQuery selector
$(.u:last li:last).addClass(last); Close. $(ul.u li:last-child).addClass(last); You may want to move that child ul inside an li - it's not proper HTML to put a UL inside a UL. --John On 28 Okt., 13:07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi everyone, I have a question on JQuery selector. I want to add a class, last, into li elements where have !-- This is the one -- comment next to it under different ul but have the same class u. This is what I ended up with. However, it only selects li final two. $(.u li:last-child).addClass(last); body div id=d1 This is content /div ul class=u li1/li li2/li lifinal one/li !-- This is the one -- ul class=l li11/li li22/li /ul /ul ul class=u li3/li li4/li lifinal two/li !-- This is the one -- /ul /body Any help will be appreciated. Thanks.
[jQuery] Re: Multiple JQuery Bottleneck
Kind of hard to debug what you're talking about without seeing it. Do you have an example? --John On Fri, Oct 17, 2008 at 10:17 AM, dvdavid2001 [EMAIL PROTECTED] wrote: Hi guys, This is my 1st time asking the questions hence please bear with me if I did it wrongly or etc. I have a J2EE application that used jQuery quite a lot. There is one page that called jQuery 4 times upon loading. Out of these 4 calls, there is one jQuery call that took around 20-30 seconds depending on the criteria that user chose. However, unfortunately, I found that the other 3 jQuery calls are in fact waiting for that 1 jQuery call that took some time to complete before the rest can also be completed. I have added the debugging, it seems that the bottleneck occurred at the success method of .ajax. The other 3 calls are simply stuck there to wait for the 1 call to complete before they can proceed to implement their success methods. Any idea how to fix it? Thanks David -- View this message in context: http://www.nabble.com/Multiple-JQuery-Bottleneck-tp19938671s27240p19938671.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: jQuery's ajax .load sometimes shows the previous page for a blink of a second?!
Try something like this: $(.photo).click(function() { $(.jq).hide().load(photo.htm, function(){ $(this).slideDown(slow) }); $(.closerbutton).show(slow).attr(title, close); return false; }); $(.about).click(function() { $(.jq).hide().load(about.htm, function(){ $(this).slideDown(slow) }); $(.closerbutton).show(slow).attr(title, close); return false; }); You were starting the animation before loading the page - you need to start it after the loading is complete. --John On Sun, Oct 5, 2008 at 3:02 PM, ivframes [EMAIL PROTECTED] wrote: Here's the code: $(function ready() { // slide'n'ajax $(.photo).click(function() { $(.jq).hide().slideDown(slow).load(photo.htm); $(.closerbutton).show(slow).attr(title, close); return false; }); $(.about).click(function() { $(.jq).slideDown(slow).load(about.htm); $(.closerbutton).show(slow).attr(title, close); return false; }); // close button $(.closerbutton).click(function() { $(.jq).hide(slow); $(this).hide(slow); }); }); If I open/close the photo.htm page and then click on about.htm, for a blink of a second I'll see the first one (photo.htm), not the page I just clicked! This happens randomly, sometimes every few clicks and sometimes never. I tried adding .hide() function, but without any success. It's like it remembers the previous loaded page and mistakenly displays it for a second and then corrects itself. No big deal, but kind of annoying. Is there any command or function that would prevent this from happening? Thanks!
[jQuery] Re: i was patient, now i'm frustrated
This is a completely unrelated issue - we host jQuery.com (the homepage, blog, and dev) on a separate server with Rimuhosting. There was a power outage at the server facility and they're working ot bring it back up: http://rimuhosting.com/maintenance.jsp?server_maint_oid=68009362 The other sub-domains should be responding fine (docs, plugins, ui, code). --John On Fri, Sep 26, 2008 at 4:35 AM, Richard W [EMAIL PROTECTED] wrote: How long does it take to sort out hosting issues? 1 month, 2 months? I've been reading all the comments from frustrated developers who are unable to do their job because the jQuery site does not load. I thought those people should understand the situation and be patient. Now it's my turn to complain, because now this is affecting my job. Media Template obviously don't have the knowledge or capacity to correctly host a high traffic site. What's the problem, really, i'm curious why this SERIOUS issue has not been resolved after so long?
[jQuery] Re: jquery.com incredibly slow for me
AFAIK jquery.com provides files for downloading not hotlinking. So you should have used your own server to serve js in the first place. We provide code.jquery.com to hotlink to - that's perfectly ok. --John
[jQuery] Re: jquery.com incredibly slow for me
I wasn't counting the hits to code.jquery.com in those numbers - that's another 20 million-or-so hits per month (and are stored on a separate server). --John On Wed, Sep 17, 2008 at 1:34 PM, acacio [EMAIL PROTECTED] wrote: I had the same problem so I switched to the Google hosted files and it's *much* faster. Also, if we use it systematically, the client browser caches the files between different apps. You need to replace the load to this: script src=http://www.google.com/jsapi;/script script // Load jQuery google.load(jquery, 1.2); google.load(jqueryui, 1.5); /script Nothing else needs to be changed. A good article on the subject: http://ajaxian.com/archives/announcing-ajax-libraries-api-speed-up-your-ajax-apps-with-googles-infrastructure -Acacio On Sep 17, 7:05 pm, John Resig [EMAIL PROTECTED] wrote: We just acquired four new servers from Media Temple, yesterday. We'll be moving the various sub-domains (docs, plugins, dev, ui) to their own unique servers this week - this should help with load times significantly. But yes, it's mostly due to popularity issues (we're getting the equivalent of about 4 Digg/Slashdot-ings worth of traffic, per day, at this point). On 9/17/08, misterqj [EMAIL PROTECTED] wrote: I have experienced the same thing. Based on other messages in this newsgroup, I think it is a combo of hosting issues and jQuery's popularity. On one hand, it is great that the toolkit is being so widely used, but on the other hand it seems that the resources aren't keeping up with demand. It is a free toolkit, though, so I am not inclined to complain too much. But if they need additional resources, it might be time for the community to kick in a little $$. On Sep 17, 7:30 am, micha_17 [EMAIL PROTECTED] wrote: Can someone please confirm that jquery.com is sometimes (%2) so slow, pages won't even show up after 2 minutes waiting ? The slowness has been there before tha page has been redesigned. I'm on winxp FF3. I's the same with my colleagues here and @home. -- --John
[jQuery] Re: New jQuery Website...
It was launched the Friday before last. You can thank Scott Jehl for all the hard work he did! --John On Mon, Sep 8, 2008 at 12:58 PM, Chris Jordan [EMAIL PROTECTED] wrote: I really like the look of the new jQuery website. When did it get launched? My hats off to the designers! It looks fantastic!! :o) Chris -- http://cjordan.us
[jQuery] Re: I must be missing something simple...
He's using Document Ready - that's not the issue. To quote Jake from another thread: See this http://dev.jquery.com/ticket/3143. Long story short, jQuery only supports $(html) or $(xmlObject). --John On Sat, Sep 6, 2008 at 7:43 AM, Rene Veerman [EMAIL PROTECTED] wrote: http://www.learningjquery.com/2006/09/introducing-document-ready On Fri, Sep 5, 2008 at 4:29 PM, Jim Buzbee [EMAIL PROTECTED] wrote: I've got some jQuery code that seems to work fine in Safari and Firefox both under OSX and Windows. But I've been beating my head against the wall trying to get the same code running under IE7. I must be missing something :-( I'm a novice at javascript and jQuery. The following is a much abbreviated and simplified version. Under IE, the alert function in the loop below comes up with Color: each time as if the find seems to be returning null. Does anyone have a suggestion? The same code can be found online at: http://batbox.org/bh.html Thanks, Jim Buzbee ... script type=text/javascript src=jquery-1.2.6.min.js/script script type=text/javascript jQuery(function() { var xml = jQuery( 'span itemcolorWhite/color/item' + ' itemcolorBlack/ color/item' + '/span' ); $(xml).find(item).each(function() { alert('Color: ' + $(this).find(color).text() ); }); }); /script ...
[jQuery] Re: jQuery project works fine in IE6, but bombs in FF2
Try changing this line: $(this.children).show(); to: $(this).children().show(); The first uses a property that's not available in Firefox - whereas the second uses a jQuery method that works in all browsers. --John On Thu, Sep 4, 2008 at 10:45 AM, Phonedude [EMAIL PROTECTED] wrote: My first jQuery project has me puzzled. I have a page http://twinflamingos.com/chris/chris.htm that throws an error when any of the menu headers is clicked in Firefox. In IE6 the drop-down works perfectly, but FF2 doesn't work and puts an error in the log. Specifically it says: Error: [Exception... Could not convert JavaScript argument nsresult: 0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS) location: JS frame :: http://jqueryjs.googlecode.com/files/jquery-1.2.6.js :: anonymous :: line 871 data: no] Source File: http://jqueryjs.googlecode.com/files/jquery-1.2.6.js Line: 871 I am relatively new to javascript and brand new to jQuery so this information doesn't help me much. Is this a bug? Or is my coding simply bad? My html and css both validate at W3C. If this is the wrong forum/list/group I apologize -- please direct me to the proper place. Thanks, Larry Ludwick
[jQuery] Re: Doc's site down?
We've been working with the guys at Media Temple - they're going to be breaking us off into multiple servers. Right now the docs site (for example) is getting the equivalent of about 3-4 Slashdot/Digg effects per day so we have to boost up the resources that we have. --John On Thu, Aug 28, 2008 at 3:22 PM, Chris Jordan [EMAIL PROTECTED]wrote: No offense to Remy, but I just don't like the way the Visual jQuery docs are laid out. I *really* like the way the official docs are laid out on docs.jQuery.com. If a copy of the docs in that exact format could be hosted somewhere else as an alternative to docs.jQuery.com, then I'd be happy with that. Just my two-cents. Having docs down (they appear to be down right now 2:22pm cst) is very frustrating, but I'm happy to know that they're working to resolve the issue. Any kind of update on the problem, Rey? Chris On Thu, Aug 28, 2008 at 10:48 AM, Sam [EMAIL PROTECTED] wrote: For jQuery reference, I use Visual jQuery almost exclusively, unless using a new plugin: http://remysharp.com/visual-jquery/ Seems to be a better option than the docs site. -- http://cjordan.us
[jQuery] Re: jQuery.com Broken?
All our static files are hosted on Amazon S3 - they had an outage earlier today. --John On Sun, Jul 20, 2008 at 4:43 PM, Kevin Pepperman [EMAIL PROTECTED] wrote: same here. no CSS. degrading gracefully. On Sun, Jul 20, 2008 at 3:46 PM, xwisdom [EMAIL PROTECTED] wrote: Hello, The website is not rendering the CSS.
[jQuery] Re: yet again XML+jQuery+IE7
Hey - can you provide an example site? It's unclear what might be wrong without seeing a response from the server. What is the value of xml when it comes back? --John On Tue, Jul 15, 2008 at 9:34 AM, Tzury [EMAIL PROTECTED] wrote: The following example (from the jquery-doc-site) works fine with firefox. however, in IE7 $(element_name, xml).text() returns empty-string anyone bypassed this issue in the past? $(document).ready(function() { // generate markup $(#rating).append(Please rate: ); for ( var i = 1; i = 5; i++ ) $(#rating).append(a href='#' + i + /a ); // add markup to container and apply click handlers to anchors $(#rating a).click(function(e){ // stop normal link click e.preventDefault(); // send request $.post(rate.php, {rating: $(this).html()}, function(xml) { // format and output result $(#rating).html( Thanks for rating, current average: + $(average, xml).text() + , number of votes: + $(count, xml).text() ); }); }); });
[jQuery] Re: is dimensions now part of jquery or not? (I hear different opinions)
Yes, Dimensions is completely a part of jQuery as of jQuery 1.2.6. --John On Tue, Jul 8, 2008 at 2:49 PM, jquertil [EMAIL PROTECTED] wrote: the other day was told latest jquery now includes dimensions plugin but I was certain it does not... I still assume it does not, thus I compile the dimensions plugin into my standard jquery deployments... can anyone shed light on this? thanks.
[jQuery] Re: .hide() Doesn't Work Fast Enough?
In which browser(s) are you having this issue? --John On Mon, Jul 7, 2008 at 12:41 PM, Vik [EMAIL PROTECTED] wrote: I'm using jQuery to fade in my site logo on my home page header, to give the home page some animation. It works great. So that the page will degrade gracefully if the user doesn't have Javascript, the HTML has the complete logo already visible. That's what users without Javascript see. If the user has javascript, I first hide() the logo using jQuery. Then I fade it in. However, many times when I load my home page, I see the logo briefly before jQuery can hide it. You see the logo for a split second, and then it vanishes. (After that it fades in correctly). Is there a way to fix this? Here's the code: HTML: echo 'ul id=Animated_Header'; echo 'liimg src=/images/Logo_3.gif/li'; echo '/ul'; JQUERY; $(document).ready(function() { $('#Animated_Header').hide(); $('#Animated_Header').html('liimg src=/images/Logo_1.gif / liliimg src=/images/Logo_2.gif alt=FlavorZoom, the New Way to Count Calories/liliimg src=/images/Logo_3.gif /li'); $(ul.nav).superfish(); $('#Animated_Header').fadeIn(100).innerfade({ speed: 'slow', timeout: 300, type: 'sequence', containerheight: '71px' }); }); Thanks in advance to all for any info. -Vik
[jQuery] Re: $(something).text() doesn't preserve whitespace in IE
I'm fairly certain that our .text() support has changed a lot since October 2006 (!). It would be interesting to re-examine this issue - if there are any current problems I know that we'd really like to get them fixed. --John On Sun, Jul 6, 2008 at 8:05 PM, Dave Methvin [EMAIL PROTECTED] wrote: I'm having some issues when calling $(something).text() in IE 6/7. Basically I'm getting the calling text() on a pre element which is whitespace sensitive. In Firefox and Safari it works perfectly returning the text with whitespace intact. Is it possible to make it work in IE or shall I give up? I noticed that too quite a while back, if you run the test in this message does it still do the same thing? http://www.nabble.com/.text()-method-quirks-p6933512s27240.html
[jQuery] Re: [validate] jquery.delegate.js is missing?
Popping jquery.delegate.js into Google provides this: http://dev.jquery.com/export/5759/trunk/plugins/delegate/jquery.delegate.js --John On Wed, Jul 2, 2008 at 9:17 AM, jez_p [EMAIL PROTECTED] wrote: I should just explain that I'm very new to jQuery. That out of the way, I have downloaded the validation plug-in which states that jquery.delegate.js is required. It is not included within the package, so where can I obtain it from, and once I have it how should I include it within my project? Thanks, Jez
[jQuery] Re: hasElementClass
jQuery(element).hasClass('classname') --John On Wed, Jul 2, 2008 at 12:18 PM, Harald Armin Massa [EMAIL PROTECTED] wrote: hello, I am in the process of converting some MochiKit code to jquery. I was used to a comfortable funciton hasElementClass(element, 'classname') which checked if the element has at least the css_class named classname what is the best way to have this in jQuery? Harald
[jQuery] Re: QUnit, jqUnit, and rhino
I'm working on this (well, trying to get more of the jQuery test suite to pass). I've broken it out into a separate project here: http://github.com/jeresig/env-js/tree/master I'm also trying to get it to run on more platforms (such as Ruby/Johnson, Perl/Spidermonkey, and Python/Spidermonkey). --John On Thu, Jun 26, 2008 at 12:18 AM, fuzziman [EMAIL PROTECTED] wrote: I was thinking about modifying testrunner.js (the rhino version) with jqUnit, and getting it run to a point where it will be compatible with the latest QUnit and jqUnit test framework. before I dive in, has anyone done any work on this they'd be able to share, so I won't be reinventing the wheel? thanks -- View this message in context: http://www.nabble.com/jQuery-test-suite-and-jsUnit-compatibility-tp15882865s27240p18126261.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: Safari 2.0.4 not passing the jQuery test
Jeff - Safari 2 has serious memory issues that are impossible to work around - simply loading and executing too much JavaScript will cause it to crash (as you see with the test suite). We do run the test suite against Safari 2 but in pieces to verify that it works as intended. Yes, we still support Safari 2. --John On Thu, Jun 19, 2008 at 12:12 AM, Jeff Kenny [EMAIL PROTECTED] wrote: I'm working on a site and the js is crashing Safari 2.0.4, so I went back to check the compatibility page and it says it's supported. I ran the test page ( http://jquery.com/test/ ) in Safari 2.0.4 multiple times and it crashed EVERY time BUT at different places. So...my question is, is jQuery really compatible with Safari 2.0.4 or should it be taken off the list of compatibility? In which case I'm a little screwed.
[jQuery] Re: Converting this mootools code to jQuery....help?
jQuery(document).ready(function(){ setInterval(function(){ jQuery('#usersOnlineTxt').load(siteURL+'fetch/online-users'); }, 30); }); --John On Mon, Jun 16, 2008 at 5:58 AM, azz0r [EMAIL PROTECTED] wrote: Hey guys, I'm trying to convert my scripts to jQuery, I wondered if you guys could help me out with this... window.addEvent('domready', function Online_User_Updater() { ajaxRequest = new Ajax(siteURL+'fetch/online-users', {method: 'get', update: $('usersOnlineTxt')}); if(ajaxRequest.request()){ var interval = setInterval('ajaxRequest.request()',30); } } );
[jQuery] Re: jQuery v1.2.6 is now Officially Released and Release Notes are Available
Still a performance improvement, but not as great as the test machine - i.e. the faster the client PC processor, the better the performance improvement (I don't think RAM will have much of an impact as the CPU is doing the work). How so? Your .extend() improved by 37% and your .map() improved by 1017%. Those are well within the realm of what we posted. The speed of the processor shouldn't affect the degree of relative improvement. --John
[jQuery] Re: jQuery v1.2.6 is now Officially Released and Release Notes are Available
.extend() was used extensively in the event handling code, hence the need for improvement. How does it compare with other libraries now? How does what compare? No other library is making the optimizations we are - or even examining how to perform faster operations here. --John
[jQuery] Re: jQuery v1.2.6 is now Officially Released and Release Notes are Available
Sure, we'll take credit for that :-) --John On Wed, Jun 4, 2008 at 12:28 PM, Josh Nathanson [EMAIL PROTECTED] wrote: Great job on this release guys. I also noticed when developing a plugin that it seems the memory management in IE6 is greatly improved. I accidentally was using 1.2.1 while trying to cut memory leaks in IE6, and when I switched to 1.2.6 the memory leaks on IE6 were gone. I'm not sure if it was some combination of my code and jQuery...am I imagining this, or is this also something that was worked on, or perhaps a by-product of other optimizations? -- Josh
[jQuery] Re: element.attr() bug in jquery 1.2.6?
I'm confused - you're getting and modifying the onclick attribute? That seems... strange. --John On Thu, May 29, 2008 at 7:48 PM, Phil Christensen [EMAIL PROTECTED] wrote: Hi all, I've run into a strange issue that I believe is a bug in jQuery 1.2.6. I've posted a ticket along with a test HTML file at: http://dev.jquery.com/ticket/2959 As far as I can tell, attr() is not properly updating the value of a form attribute, although prior versions had worked fine. Any help in resolving this, or providing a workaround would be greatly appreciated. Thanks in advance, -phil
[jQuery] Re: 1.2.5 and 1.2.6 not working at all for me - what am I missing?
Victor: That shouldn't be the case (if you're using noConflict). Note that the code he presented worked with 1.2.3. --John On Wed, May 28, 2008 at 4:41 AM, Victor [EMAIL PROTECTED] wrote: Kape: Just read your post again. You are using prototype. I believe that it conflicts with 1.2.5 and 1.2.6. Victor On May 27, 5:26 pm, kape [EMAIL PROTECTED] wrote: OK, I'm sure that someone would have mentioned that the latest releases don't work, so that can't be it. It's obvious that I'm missing something. I've been using jQuery 1.2.3 for months now, and today I wanted to use the ui.slider plugin which requires offsetWidth() which is not in 1.2.3. So I figured I'd just download the latest release, i.e. 1.2.6 and be done with it. I did just that, but when I ran my app, there were a whole bunch of JS errors. I figured that's to be expected, my code isn't perfect. So I started debuging them. So far, I'm still trying to debug the very first one. I have something as simple as: jQuery(document).ready(function() { alert(jQuery('body').html()); }); If I use 1.2.3 everything works and onLoad I get the html of the body element. If I change the one line to 1.2.5 or 1.2.6, I get an alert with undefined. The reason I'm using jQuery() instead of $() is that I am also using prototype for their portal plugin. I wish I wasn't but the jQuery verion just isn't cutting it yet. And yes, I have the jQuery.noConflict(); line first in my JS code. So, what am I missing? Do I need to download any other file besides jquery-1.2.5.pack.js for example? Are the new releases not working with prototype? Are they using different syntax? I mean, I assume that if the new releases would have such drastic changes, they wouldn't be 1.2.6 they would be 2.0. Anyway, hopefully someone can point out whatever it is that I'm missing here. Thanks, Kape
[jQuery] Re: 1.2.5 and 1.2.6 not working at all for me - what am I missing?
What if you use jquery-1.2.6.js (not packed). --John On Wed, May 28, 2008 at 12:26 AM, kape [EMAIL PROTECTED] wrote: OK, I'm sure that someone would have mentioned that the latest releases don't work, so that can't be it. It's obvious that I'm missing something. I've been using jQuery 1.2.3 for months now, and today I wanted to use the ui.slider plugin which requires offsetWidth() which is not in 1.2.3. So I figured I'd just download the latest release, i.e. 1.2.6 and be done with it. I did just that, but when I ran my app, there were a whole bunch of JS errors. I figured that's to be expected, my code isn't perfect. So I started debuging them. So far, I'm still trying to debug the very first one. I have something as simple as: jQuery(document).ready(function() { alert(jQuery('body').html()); }); If I use 1.2.3 everything works and onLoad I get the html of the body element. If I change the one line to 1.2.5 or 1.2.6, I get an alert with undefined. The reason I'm using jQuery() instead of $() is that I am also using prototype for their portal plugin. I wish I wasn't but the jQuery verion just isn't cutting it yet. And yes, I have the jQuery.noConflict(); line first in my JS code. So, what am I missing? Do I need to download any other file besides jquery-1.2.5.pack.js for example? Are the new releases not working with prototype? Are they using different syntax? I mean, I assume that if the new releases would have such drastic changes, they wouldn't be 1.2.6 they would be 2.0. Anyway, hopefully someone can point out whatever it is that I'm missing here. Thanks, Kape