[jQuery] Re: jQuery internals and exception handling
On Aug 19, 11:04 pm, ak732 ask...@gmail.com wrote: ofn.apply(this, arguments); Be aware that the arguments object is-not-a Array (it's an object with a length property), and i don't think there's a guaranty that that apply() will handle that special case. Also be aware that apply takes a list of args, like foo.apply(this,arg1,arg2,arg3), whereas call () takes the args as a single array: foo.call(this,[arg1,arg2,arg3]). i suspect that's what you actually want here. The normal workaround for converting 'arguments' to an array looks something like: var av = Array.prototype.slice.apply(arguments,[0]); myfunc.apply( this, av ); sense? It could do what it does for other areas of Javascript which is mitigate the browser differences. To be complete, it would need to employ onerror, add a try-catch block to document.ready(), and do something similar to the above for event handlers (only in mozilla). Thoughts? Is this just stupid? While i agree with the last bit that it might help improve the overall quality of jQuery client apps, my suspicions are that: a) Many people will bitch and moan about a perceived performance penalty for using try/catch (i know C++ people often bitch about it). b) Your solution seems like such an easy thing to do, that the jQuery devs would be justified in saying, just do what you just demonstrated. That said, having a public jQuery API which swaps out .bind() with an impl like yours might be a good idea. In any case, i will certainly give this a try in a jQuery-based application framework i'm working on. :)
[jQuery] Re: jQuery internals and exception handling
On Aug 20, 9:17 pm, Stephan Beal sgb...@googlemail.com wrote: that apply() will handle that special case. Also be aware that apply takes a list of args, like foo.apply(this,arg1,arg2,arg3), whereas call () takes the args as a single array: foo.call(this,[arg1,arg2,arg3]). Sorry, that's exactly backwards: apply() takes an array and call() takes a list. See: http://devlicio.us/blogs/sergio_pereira/archive/2009/02/09/javascript-5-ways-to-call-a-function.aspx
[jQuery] Re: jquery license - what do my company have to do
On Aug 20, 3:51 pm, Antoine Blanchard antoine...@gmail.com wrote: Do we need to write a line in our docu saying: use jquery,..., which is under MIT license? The MIT license is explained very briefly and clearly at: http://en.wikipedia.org/wiki/MIT_License You don't need to do anything special except accept the fact that you needn't do anything special. That is in stark contrast to the GPL license, which can optionally be used with jQuery. The documentation clause is from the BSD family of licenses and is quite interesting, because if you simply redistribute the original source files you are already complying with it by including those source files in the documentation and/or other materials provided with the distribution. As long as the source file IS part of the distribution, you don't need to add it to your docs or About dialog because of the and/OR part.
[jQuery] Re: Could you give some advise on studying JQuery Code Source.
On Aug 17, 5:55 am, Jackwanzai jackwan...@gmail.com wrote: Hi all, I have been using JQuery for some time, finding it very interesting and elegant. I want to study the code source. But found I was confused by many code. To really understand what jQuery is and how it works, one must also understand: A) What are HTML and the DOM? This include and understanding of its structure, as well as what types of elements are used for what purposes. jQuery is made for searching through and interacting with DOM elements, and to understand how it does this, one must understand the DOM. B) What is CSS, and how does it affect the HTML DOM? The selectors which jQuery uses were largely derived from CSS standards/conventions, and if one understands that then the selectors are easier to read and understand. C) What is JavaScript (and what is the difference between the JavaScript language and the DOM-defined JavaScript interface)? And how can we use it to interact with the objects from point (A). Also, understanding how closures and anonymous functions work in JS is critical to using jQuery properly. e.g. learn to identify which object this really points to. Don't try to understand jQuery simply be reading its source code (or the code for plugins). jQuery does a lot of tricks which are confusing to experienced JavaScript coders, and downright mystifying to newcomers. First understand what problem jQuery is trying to solve, then understanding jQuery should be a lot simpler.
[jQuery] Re: I really hope this isn't a dumb syntax error
On Aug 15, 11:38 pm, n4rc1ssus 5n4rc1s...@gmail.com wrote: Webpage error details Message: Object doesn't support this property or method Man, oh, man, MSIE is useless. i STRONGLY recommend trying this in Firefox with Firebug enabled, because it will show you exactly what property is the problem here. Line: 257713399 *not sure why the line is so insanely high but whatever* This happens when packing multiple JS files into one, but line 257M is obviously wrong. Unless you've really got several GB of JS code coming over the wire, which i highly doubt). Char: 2 Code: 0 URI:http://localhost/greekware8/ like the subject says I hope this isn't some really stupid mess up in my part but this should've worked in a day's time of work. Install firebug (in Firefox), then enable the break on all errors option in the Scripts tag, then reload the page. It will point you right to where the problem is. It sounds to me (just guessing) that it's either a syntax error in your code or you're trying to use code which requires a separate plugin which isn't yet loaded.
[jQuery] Re: Good Ajax Approach For Name List
On Aug 15, 5:42 pm, finneycanhelp lovefin...@gmail.com wrote: Some options are available here to meet these requirements. - For showing the list and hiding Add Names when list size = Count, should one: Store the Sample List into something globally accessible in the page OR request the list each time something about the list is needed (size, content) OR What is the simplest and cleanest approach? BTW, the list is requested each time an item is added or removed right now. It seems easier to debug that way. i think that conceptually you're trying to do something like i recently did for an app. It wasn't a list of names, but a list of cybertanks for a wargame i like to play. In that app (http:// wanderinghorse.net/gaming/ogre/byoo/ajax/) i did the following (that's not to imply that this is simplest or cleanest): At startup, i load all of the app data (a bit over 100kb) into the client. It is transfered as JSON and then transformed to higher-level app objects. However, i keep the original JSON db around, partly so that i can figure out if a user has modified an object (i.e. if it needs saving) and partly to implement a revert changes option without having to request the data again. When the user uses save, we convert the high-level app object to JSON, update the local internal copy of the JSON data, and send it off to the server. For really large data sets i wouldn't keep the whole thing in memory, but this particular app is intended to be a rich client, and not just page dressing, so i wasn't too concerned about memory usage. However, i am considering re-modeling it to request data only as needed. i think the determining factory here is how much traffic (and request count) i save using one approach or the other. i haven't analyzed that yet, so i can't yet make an informed decision. Maybe poking around the above app with firebug would prove informative. Feel free to use the editing features (they're open to all w/o any sort of login) - you can then watch the json transactions using firebug.
[jQuery] Re: [attribute=value]
On Aug 15, 4:19 pm, Geir gso...@frisurf.no wrote: This is fromhttp://docs.jquery.com/Selectors/attributeEquals#attributevalue: Variables can be used using the following syntax: [name=' +MyVar + '] Is it right? I can't seem to get it work properly.. Does MyVar contain any quotes or other strangness? Can you post the code?
[jQuery] Re: plugin problem with jQuery 1.3.2
On Aug 6, 9:22 am, tom.nov...@googlemail.com tom.nov...@googlemail.com wrote: I have still to support IE6 and developping applications means min-/ max-width is often required. Therefore I used actually the jQMinMax plugin to make this work in IE6. Unfortunately this plugin is not working anymore with jQuery 1.2.6. There seems to be a selector problem. Does anyone know how to fix the current plugin to get it work with 1.3.2? If you're required to still use MSIE 6.x, then why not use jQuery 1.2.5 or lower for the project? It sounds reasonable to use an old version of jQ with an ancient version of MSIE.
[jQuery] announce: jQuery.html and jQuery.createBogoMenu()
Hello, fellow scripters! Just uploaded: http://wanderinghorse.net/computing/javascript/jquery/html/ jQuery.html contains factory functions for generating DOM elements. Its intention is to help clean up script code by allowing us (well, me) to remove all inlined HTML from my script code (i HATE inlined HTML). And: http://wanderinghorse.net/computing/javascript/jquery/bogomenu/ jQuery.createBogoMenu() is a function which takes an idealized menu representation (a JS object structured like a menu) and creates a visual menu for it (by generating a conventional nested UL structure). The end result is an accordion-like menu. However, because it generates the menu from JS code, as opposed to creating it from embedded HTML elements (where the layout and script code tend to get all mixed in), there are a couple of differences from most menu plugins: a) It's much easier to modify for your own purposes because you can easily change the code it generates. (That said, it uses jQuery.html to generate the HTML.) b) The same menu structure can be fed through a different generator to generate menus compatible with other menu plugins. That is, if all menu plugin creators could decide on one general structure, we could use the same structure directly with arbitrary menu plugins. c) It does not degrade AT ALL. The menus are generated via script, so a browser which can't run scripts can't see the menu. That said, this was written for rich client applications which cannot run at all without scripts, so degrading gracefully is not a design concern.
[jQuery] Re: $ajax() question
On Aug 12, 12:03 am, yi falconh...@gmail.com wrote: OK I will try object of key/value pairs. You mean i should use data:{Arg:args2} . is it right? Right :)
[jQuery] Re: JSON how to transform an object into an array?
On Aug 12, 11:48 am, Mark johanns.m...@gmail.com wrote: $event = json_encode($super_array); How about simply: $event = '['.$event.']'; on the server side, i personally recommend using the json2.js API (i.e. JSON.parse() and JSON.stringify()) over $.getJSON(). getJSON uses an HTTP GET, which is very rude vis-a-vis Apache logs (because all your JSON gets logged there in urlencoded form).
[jQuery] Re: Old cookie data sent in AJAX request?
On Aug 12, 5:41 pm, Michael Price m...@edwardrobertson.co.uk wrote: If, however, I submit an AJAX post request to add a product to the shopping cart on this site, it doesn't work. Investigating the AJAX behind this shows that two copies of every cookie named above is being sent - the first copies have older and now incorrect data in them, and are followed by the CORRECT data. Looks a bit like this: If i'm not mistaken, this has to do with the path the cookies are set for (i had a similar problem). Make sure that ALL of your cookie-set() operations are using the same options for setting the cookie.
[jQuery] Re: JSON how to transform an object into an array?
On Aug 12, 8:22 pm, Michael Geary m...@mg.to wrote: on the server side, i personally recommend using the json2.js API (i.e. JSON.parse() and JSON.stringify()) over $.getJSON(). getJSON uses an HTTP GET, which is very rude vis-a-vis Apache logs (because all your JSON gets logged there in urlencoded form). No, that's wrong. Yes, $.getJSON() does do a GET, but that has no effect at all on the *download* format, which is what Mark is asking about given his use of json_encode. It's not wrong, but it could have been worded better. First, i wrote server side instead of client side, which is just downright wrong. i wasn't referring to the download format, but to the type of request. Requests *always* come from the client, so the direction of the exchange was implicit (to the server as opposed to from the server). Your downloaded JSON data will not show up in any Apache logs (unless, I suppose, if you have some kind of ultra-verbose logging turned on that logs i didn't mean to imply that it would. i was only referring to the GET parameters sent from the client. Those get logged.
[jQuery] Code: a generic jQuery+plugin loader/packer
Hi, all! i threw the following together, have gotten good use out of it, and thought someone else out there might find it useful. It's used like this: script src='include/jquery.js.php? version=1.3.2plugins=cookie,html,tipbox-mod' type='text/javascript'/ script As one can surmise, this script emits the JS code for jQuery and all requested plugins. If passed no 'version' parameter then it only returns the plugins (which can be used to load them individually, after jQuery has already been loaded). From the above example, include is the directory containing the following files: - jquery.js.php (see code, below) - jquery-1.3.2.js (1.3.2== the 'version' param passed above) - jquery.cookie.js - jquery.html.js - jquery.topbox-mod.js It will prefer files named *.min.js or *.pack.js over *.js, but it also gzips the output using ob_gzhandler, so minimizing/packing brings little benefit (unless you also remove the ob_xxx() lines). The implementation (only tested with PHP5 - might work in PHP4): ?php /** jQuery_pack_sources() emits JS source code for jQuery and, optionaly, jquery plugins which follow the naming convention of jquery.PLUGIN.js. It looks for $_REQUEST['plugins'] or $_ENV['plugins'], expecting a space/comma-delimited list of jquery plugins emit. (Reminder: $_ENV is checked so that i can use the from the command- line.) The $jqueryVersion param specifies the version of the core to use, and should be in the the form X.Y.Z, such that jquery-X.Y.Z.js is the file where jquery lives. If it is null then only plugins are emitted. Author: Stephan Beal (http://wanderinghorse.net/home/stephan/) License: Public Domain. */ function jQuery_pack_sources($jqueryVersion=null) { if( ! $jqueryVersion ) $jqueryVersion = @$_REQUEST['version']; $key = 'plugins'; $mod = @$_REQUEST[$key]; if( ! $mod ) $mod = @$_ENV[$key]; if($mod) $mod = preg_split('/(\s|,)/',$mod, -1, PREG_SPLIT_NO_EMPTY); if(!$mod) $mod = array(); if( $jqueryVersion ) { array_unshift($mod,$jqueryVersion); } $mod = array_map('trim',$mod); $ext = array( '.min.js', '.pack.js', '.js' ); $flist = array(); foreach( $mod as $m ) { $sep = preg_match('/^\d/',$m) ? '-' : '.'; // kludge for jquery-X.Y.Z.js $got = false; foreach( $ext as $ex ) { $fn = 'jquery'.$sep.$m.$ex; if( !...@file_exists($fn) ) continue; $got = true; $flist[] = $fn; break; } if( ! $got ) { throw new Exception(Could not find module [$m] in file [$fn]!); } echo \n; } echo /** Start of amalgamation of: .implode(', ',$flist). */ \n; foreach( $flist as $fn ) { echo /** Begin file [$fn] **/\n; echo file_get_contents($fn); echo /** End file [$fn] **/\n; } echo /** End of amalgamation of: .implode(',',$flist). */\n; } ob_start('ob_gzhandler'); jQuery_pack_sources(); header('Content-Type: text/javascript'); header('Transfer-Length: '.ob_get_length()); ob_end_flush(); exit(0); ? Happy hacking!
[jQuery] Re: attr doesn't work in IE6 and Chromium
On Aug 11, 5:35 pm, Julijan Andjelic julijan.andje...@gmail.com wrote: script type=text/javascript $(#sitemap a:eq(1)).attr(onclick,$('#sitemap a:eq(2)').text(''); have you tried: $(#sitemap a:eq(1)).click(); ? that is the canonical way to add an onclick handler in jquery.
[jQuery] Re: $ajax() question
On Aug 11, 11:53 am, Jules jwira...@gmail.com wrote: After re-reading the original post, it seems json is not required just use data:Args=+args2 Don't do that. If args2 contains any invalid characters (i.e. a space) then this will fail, possibly in mysterious ways. Always send the data as an object of key/value pairs, and let the jquery internals escape it for you.
[jQuery] Re: AJAX and JSON
On Aug 11, 5:13 am, MorningZ morni...@gmail.com wrote: I'd also recommend against use of $.getJSON for a totally different reason: There is no option to catch errors. You can: you have to set a global ajax error handler to catch it, though. Not pretty, but it's suitable for many simple cases (where all errors should go through the same reporter).
[jQuery] Re: AJAX and JSON
On Aug 11, 6:14 am, Cam Spiers camspi...@gmail.com wrote: I also recommend using json2.js for anything more then just a basic key-value json string. Another nice feature of json2.js is that you can use it to deeply clone objects: var orig = {}; var clone = JSON.parse(JSON.stringify(orig)); i've found that really useful in avoiding cross-object references in my JSON trees.
[jQuery] Re: Full jQuery website
On Aug 10, 7:19 pm, Cyril dubus...@gmail.com wrote: Is there any project about a website using pure jQuery for rendering the pages ? It's funny you mention that, because i'm working on exactly that right now: an application framework for writing apps in pure JS, using HTML only to get the JS and CSS loaded, and maybe set up the overall layout using well-defined element IDs for various parts of the UI, e.g. #ContentArea and #PageHeader. By pure JS i mean basically pure JS, but based around jQuery (in fact i call it jqApp). i've got a demo here: http://wanderinghorse.net/computing/javascript/jquery/jqapp/demo.html but it doesn't do all that much at the moment (or at least there's not much to *see* at the moment). The most import part currently implemented is a generic message-passing mechanism (demonstrated above) for posting requests and getting responses using a well-defined (but exceedingly simple) JSON grammar. The framework takes care of most of the details, leaving the client to just populate the request and fetch the payload from the response. The above link demonstrates various message types, and gives a good idea of what direction i'm planning on taking that.
[jQuery] Re: AJAX and JSON
On Aug 10, 9:58 pm, Joey Derrico joeyd...@gmail.com wrote: I am a novice at AJAX and JSON (Ok, I am a novice at JavaScript.), and I am brand new to jQuery. I wanted to use JSON in a project I am working on and I read various tutorials on using JSON with jQuery however none of them answered some of my questions. The biggest one is, does jQuery support JSON or do I need to use another JSON library to use JSON with jQuery? JSON is simply a data format. Supporting JSON simply means having: a) a function which can transform JS objects into a JSON-compliant string. b) a function which can transform a compliant string into a JS object. AFAIK, jQuery doesn't have any built-in support for JSON, but it doesn't have to - it doesn't operate at a level where JSON would be useful (except for possible selector-style traversal of a JSON tree). The canonical JSON implementation for JavaScript is Doug Crockford's json2.js, available here: http://www.json.org/ See JSON.stringify() and JSON.parse().
[jQuery] Re: Using ScrollTo, IE displays hidden info before it hides it — Any help/ideas?
On Aug 10, 6:26 pm, jen timeyout...@gmail.com wrote: Do you have any idea how to have the hidden video viewers hidden upon page load in IE? It's performing on Mac Safari FF, and Windows FF, but in Windows IE it's a lot slower to hide the info. You could try setting an explicit visibility on the element: div style='visibility:hidden'.../div then they'll start hidden. And if they don't, it's time to ditch IE.
[jQuery] Re: AJAX and JSON
On Aug 11, 12:26 am, Michael Geary m...@mg.to wrote: Just use $.getJSON() or $.ajax() with the 'json' or 'jsonp' dataType as needed. Speaking of: i recommend AGAINST using getJSON() because it muddles up my Apache logs horribly (the JSON gets encoded in the request, which gets logged as urlencoded garbage). JSON should, IMO, be sent over POST.
[jQuery] Re: Selecting element where the href contains string
On Aug 7, 9:36 pm, gray8110 gray8...@gmail.com wrote: $('li has(a[href$=.xls])').addClass('excel'); Try: $(li:has(...)) Note the : before has http://docs.jquery.com/Selectors/has#selector :)
[jQuery] Re: Navigation and sub navigation plugin
On Aug 9, 5:59 am, bharani kumar bharanikumariyer...@gmail.com wrote: Assume if i have around 20 naviation means the i have to write jquery navigation and sub navigation snippet all pages ? Every menu has to be populated, and if you've got 20 menus then you've got to populate 20 menus. However, if you have so many of them you should generate them from a DB or XML or some other idealized representation, to make changing them easier. Try to avoid putting each menu it its own html/php file, because that makes it really difficult to change the any details which exist in all copies. Is there any short way there , OR is there any similary navigation plugin available , There are tons of menu plugins. See: http://plugins.jquery.com/project/Plugins/category/44
[jQuery] Re: New to jquery, multiple .js files not running
On Aug 8, 7:25 pm, andrew.croce andrew.cr...@gmail.com wrote: var current_section = $(this).attr(name); ... $(#+current_section+_tab).addClass(current_tab); This is wrong. The '#' searches by ID, not by name. Try (untested): var current_section = $(this).attr(id);
[jQuery] Re: New to jquery, multiple .js files not running
On Aug 9, 7:38 pm, andrew.croce andrew.cr...@gmail.com wrote: What I was trying to do with var current_section = $(this).attr (name); was to create a variable that simply contained the name of the particular subsection, which I could then attach to _tab to ... idea, could that be screwing up the whole file? or is the name attribute inaccessible to jquery? i see. No, it's not a bad idea, i was just confused by it. The bigger problem, it seems, is that nothing is running in that gallery.js file, not even the first few lines... $(.current_panel .image_area).removeClass(current_area); $(.current_panel .image_area).hide(); $(.current_panel .intro).show(); $(.current_panel .intro).addClass(current_area); $(.back_tab).hide(); If you haven't done so yet, install Firebug and enable it for your page. Then click the Script -- Break on all Errors option and reload your script. If there's a syntax error or something which is causing an silent failure, this will normally point you directly to it. Other than that, i don't have any tips. class .current_panel is added when a main menu btn is clicked, and the script for that is in the other panels.js file, which, as I said, is running perfectly. If all the javascript on the site is run on page load, then there is no .current_tab class at the time, and hence nothing will happen. That's right - selectors match only what's currently in the dom at the moment (but the new livequery API can also catch future matches). It sounds like you've found the problem.
[jQuery] jQuery.ajax(): reasons to prefer GET over POST?
Hi, all! i'm working on a JSON-based request/response dispatcher system and i've got a small question about jQuery.ajax(): Are there good reasons to prefer GET over POST, or vice versa? In case it makes a difference, my target uses are somewhere in the single- digit KB range (and normally very small requests, under 500 bytes). Here's the relevant demo, in case it matters: http://wanderinghorse.net/computing/javascript/jquery/jqapp/demo.html :-?
[jQuery] demo: hooking jQuery.ajax() in to Firebug Lite
Hi, all! A few days ago i came across: http://getfirebug.com/lite.html which is every bit as cool as jQuery itself (which places it in the top 5 bits of JS code on the planet). On their site they have a link which embeds firebug lite into the current web page. i had to hack on it a bit to make it work for me, and i wanted to share the results in case anyone else out there can get some use out of it: There's a demo of it here: http://wanderinghorse.net/computing/javascript/jquery/jqapp/demo.html See the Load Firebug Lite button, but it only works if Firebug is *not* running for the current page. The code (not pure jquery - a quick hack of code i grabbed from getfirebug.com) is below, but first some comments: - The jqApp.message() stuff is of course specific to my app, but i've left it here because it demonstrates what's going on. - This demonstrates how to hook in jQuery.ajax() calls to firebug's XHR tracking. - The code: function load_firebug_lite() { jqApp.message(Attempting to load Firebug Lite...); if(! ('firebug' in this) ) { jqApp.message(Attempting to load Firebug Lite...); var fb=document.createElement('script'); fb.setAttribute('src','jqApp/imports/firebug-lite- compressed.js'); document.body.appendChild(fb); } else { jqApp.message(Firebug Lite already loaded); return; } var count = 0; (function(){ if(('firebug' in this) (firebug.version)) { jqApp.message(Initializing Firebug Lite!); var factory = jQuery.ajaxSettings.xhr; jQuery.ajaxSettings.xhr = function() { var x = factory(); firebug.watchXHR( x ); return x; }; firebug.env.height = 250; firebug.init(); jqApp.message(Loaded Firebug Lite!); } else { if( ++count 10 ) { jqApp.message(Waiting on Firebug Lite...); setTimeout(arguments.callee,500); } else { jqApp.message(Giving up waiting on Firebug Lite...); } } })(); }; If one spends 4 minutes hacking on it, the code can certainly be cut in half by using jQuery instead of the DOM API. It can be used like: input type='button' onclick=load_firebug_lite(); return false; title='Load Firebug Lite' value='Load Firebug Lite'/input Happy hacking!
[jQuery] Slightly OT: another way to gzip javscript code
This just popped up on digg, and i thought it might interest some of you: http://code.trymbill.is/index.php/2007/10/01/compress-javascript-gzip/ It presents a different way of compressing javascript code.
[jQuery] Re: New Plugin: Picklists
On Sep 24, 4:12 pm, george.gsgd [EMAIL PROTECTED] wrote: Can anyone help me come up with a better name for this? I struggled to come up with 'Picklists', and I'm not sure it's particularly descriptive or obvious... a) Linked Selection? b) Chained Selection? c) ... err... Natural Selection? ;) d) s2s: Select To Select (sounds like an ATT calling plan) That's pretty slick, by the way. :)
[jQuery] Re: AJAX Grouping feature...
On Sep 24, 2:49 pm, John Farrar [EMAIL PROTECTED] wrote: I would like to see a function (of course it might be there alleady and I don't know it) like this added to jQuery. http://docs.mootools.net/Plugins/Group.js Hi, John! When posting to the list, please always start a NEW mail, and don't respond to someone else's mail and then change the subject. Replying and changing the subject doesn't start a new post, it hijacks the original poster's thread, mixing theirs and yours and making it difficult to follow the thread.
[jQuery] Re: OT: Combining JS files for production releases
On Sep 20, 5:23 pm, Brook Davies [EMAIL PROTECTED] wrote: How do you keep your source files organized and the process of combining and packing them to release any changes or bug fixes orderly? What i do is use a PHP file as an intermediary so that i can use gzip compression on them: js.php: ?php ob_start('ob_gzhandler'); echo file_get_contents( file1.js); echo file_get_contents( file2.js); ... repeat for each file ... ob_end_flush(); ? In my HTML files i then include /path/to/js.php via a script tag. The end result is a single HTML request with all JS files, and it is compressed with gzip if (and only if) the client browser can handle the compression. There are several more fancy variations of this archived in this list somewhere (go back a month or two). Be aware that some people prefer a variant of the above which caches the output on the web server. As a general rule it is poor practice to write out files on the web server. There are several reasons for this, but the most glaring is that the files will be owned by the web server user, which is probably not the same as your account on the hosting service. When this happens, you may not be able to modify or delete the files using your account. (This happens, e.g., when writing out files on the SourceForge-hosted web servers.)
[jQuery] Re: Wild cards in id names, class names and element names
On Sep 19, 4:34 am, Pluthos [EMAIL PROTECTED] wrote: I would like to write something like $(/(id.*name)/) to be able to capture id_A_name, id_B_name and id_C_name, or some other convenient form of using *, ^ and $. Would regular expressions work as arguments to $() ? Is there any way of doing this? jQ doesn't (currently) support regexes as an argument to $(), but i believe you can get the effect you're looking for by using filter() in conjunction with regexes. Something along the lines of... $(E[id^='id_']).filter(...) http://docs.jquery.com/Traversing/filter#expr http://docs.jquery.com/Traversing/filter#fn Using the first form, i think you could probably get away with something like: $(E[id^='id_']).filter([id$='_name']) (untested)
[jQuery] Re: PERFORMANCE TIP: removeClass()
On Sep 19, 6:55 pm, Jonathan Sharp [EMAIL PROTECTED] wrote: I had 15 classes I had to remove and Firefox was a champ at chained removeClass calls, IE was taking 760ms! If i'm not mistaken, IE takes so long in that case because it has to email the results of each function call to Microsoft for approval.
[jQuery] Re: OT: PHP to read jQuery API XML
On Sep 19, 8:52 pm, Glen Lipka [EMAIL PROTECTED] wrote: What I have so far is:http://www.commadot.com/jquery/experiments/api/xmlReader.txt(code) http://www.commadot.com/jquery/experiments/api/xmlReader.php(results) I will have to make more nested foreach loops to get grandchildren and great-grandchildren. This seems like a horrible pattern. If the rendering code is in its own function, it can recursively call itself to handle the great[great[great]]grandchildren. Is there a better way on the server-side to do this? Any code samples or demos would be awesome. :) My first thought is simply to move the main loop into a function, so it can be called recursively. You seem to be on the right track though. jQuery is so easy. PHP is not. (for me) Perhaps i can help out - feel free to get in touch with my off-list. i'm pretty good with PHP, if i may say so myself. Where did you get the XML data from, by the way? Another minor tip for you: some web servers are configured to server .phps files as context-highlighted PHP source code. So, instead of xmlReader.txt, try copying (or symlinking) xmlReader.php to xmlReader.phps and see if you server can do that. It makes reading the code much simpler. :)
[jQuery] jQuery plugins repo is a major traffic generator
Hi, all! The past couple of days i've been looking through some web logs and found some really unexpected things... a) Though jQuery-related stuff is only a small part of my website, the vast majority of the recent traffic targets my jQuery plugins pages. (This is not to imply that my plugins are particularly popular (they're not - they're all small/niche stuff).) b) The jQuery.com plugins repo is the most prolific referrer to my site. c) 3 of the top 5 search terms which bring people to the site (via google) are people searching for a jQuery color picker. Another one of those top 5 is someone looking for a color picker in javascript (not explicitly jQuery). My point is: If you write plugins, add them to the jQuery plugins repository. There are lots of good reasons to do so, but one reason which is probably under-considered is that doing so will drive traffic more traffic to your site. Case in point: http://wanderinghorse.net/computing/javascript/jquery/ :)
[jQuery] Re: jQuery plugins repo is a major traffic generator
On Sep 19, 12:28 am, Benjamin Sterling [EMAIL PROTECTED] wrote: shameless plughttp://benjaminsterling.com/2007/09/13/jquery-jqalbumparser-plugin-pa.../shameless plug Shouldn't that be shameless plugIN ;)?
[jQuery] Re: Thanks for bringing back eq() in 1.2.1
On Sep 17, 9:36 am, Bernd Matzner [EMAIL PROTECTED] wrote: It really makes things easier when selecting elements with variables. Amen! Is there any chance of getting gt/lt() back in? My main arguments are: a) the same as above: working with variables is easier than when using selectors. b) having to use slice() removed the symmetry which gt/lt() had with their selector counterparts. e.g. $(...:lt(3)) == $ (...).slice(0,3). Whereas $(...:gt(3)) == slice(4) == the off-by- one there is particular inelegant, IMO.
[jQuery] Re: Thanks for bringing back eq() in 1.2.1
On Sep 17, 10:23 am, David Duymelinck [EMAIL PROTECTED] wrote: But why do you want to use eq/lt/gt as methods if you have them as selectors? Can you give an example where a method can do more than a selector? You can do more with a selector in SOME contexts, and only after converting your data to a string. For me, this is far more intuitive: $(...).lt(a+b) than: $(...:lt(+(a+b)+)) (For one thing, the extra parens are necessary to avoid a+b concating as a string.) Also, the removal of lt/gt() removes a nice symmetry which previously existed: $(...:lt(3)) === $(...).lt(3) Now that is: $(...:lt(3)) === $(...).slice(0,3) Likewise, we used to have: $(...:gt(3)) === $(...).gt(3) but that's now mutated to: $(...:gt(3)) === $(...).slice(4) There is no symmetry whatsoever in those, especially because of the off-by-one of the gt==slice conversion. Every time i see that, it makes me cringe. As a general rule, i find a mini-language (in this case, stringified selectors) to be more cumbersome to use than the in-language approach provided by function calls (in this case .lt/gt()). Obviously, though, opinions differ on this topic. i'm willing to bet, however, that most long-time programmers will agree with me on this point, and that most of the people who prefer the selector form are either relatively new to programming or have JavaScript as their first (or only) programming language. (That's not meant as an insult, so please don't take it that way!) While i agree that slice is a nice addition to jQuery, i strongly disagree that lt/gt() should be removed in favour of slice. John Resig argued (in a post last week) that slice is a well-known idiom in computer science. He's right - it's available as part of the common Array API in many (but not all) programming languages. The greater/ less-than idiom is a core/built-in part of ALL languages, though, and so i'll argue that they're easier for people to get a grasp on.
[jQuery] Re: Thanks for bringing back eq() in 1.2.1
On Sep 17, 12:46 pm, David Duymelinck [EMAIL PROTECTED] wrote: As for your example couldn't you do something like var c = a+b; $(...:lt(c)); Using a method you would have to do that so you save some bytes. Absolutely, but it's still inelegant, IMO. i find $(...).lt(a+b) to be clearer. Part of my dislike of the stringified selectors, as opposed to functional ones, is based upon lots of experience writing file parsers (primarily in C++, e.g. the file format parsers for http://s11n.net). Outputing data is easy, but parsing data is amazingly problematic and error-prone. So when i see mini-languages encoded in strings, my gut instinctively wrenches (probably more out of sympathy for the parser maintainer than any other reason). I don't care if i have to use a selector or a method, i agree with you methods come more natural for long time programmers, i'm just trying to understand why some functionalty decisions are made. i think the main reason lt/gt were removed was because you can do the same thing with slice(). John Resig said in a post a week or so ago that they were also removed because they did only one thing, and didn't do it terribly well (or something to that effect). Fair enough, but then i would prefer that x.lt(n) be kept and implemented in terms of $( :lt(n),x), or vice versa. :)
[jQuery] jQuery UI demos: minor bug in Tabs demo?
Hiya! http://ui.jquery.com/ i'm looking through the Tabs demo (nice stuff) and i noticed that the Ajax tabs demo appears to have a problem. When i click on any tab, i see a brief loading... text, then no content. Is this as designed? If so, i would recommend putting some dummy content in there to avoid any confusion. (Only tried it in Firefox/Linux 2.0.0.6.) Slightly related: the tabs docs are full of the comment (no zero- based index). What exactly does that mean? e.g.: http://docs.jquery.com/UI/Tabs/tabs#initialoptions My assumption is that it means that indexing starts at 1, but if that is/were the case then 1-based index would be infinitely clearer than no zero-based index. ??? :)
[jQuery] Re: idea to track plugin updates: myJquery.com
On Sep 17, 11:27 am, David Duymelinck [EMAIL PROTECTED] wrote: I understand people want to use the latest version of jQuery and plugins for all of their projects but i don't think it's possible. agreed 100%. As far as jQuery is concerned i would rather see a table of methods and selectors that are available for each version so it can be used as a cheatsheet for projects that use another version than the latest. The main problem with that approach is that with every new release you've got to update the cheat sheet and compare compatibility backwards against an arbitrary (and growing) number of previous releases. e.g. if we start today with a chart for 1.1.4 and 1.2.0, 1.2.1, we could compare 3 versions. Next time it's 4. Then 5... ad nauseum. For the plugins i guess most developers already announce which jQuery version they used and which browsers they tested it on. I would suggest to do this for all the versions of their plugin(s). That way you know if a browser isn't mentioned or the jQuery version you use is newer or older you are a tester. The past week i've had to go through my plugins (7 of them) and try them out with 1.2.0 and then 1.2.1. i can assure you that it gets amazingly dull to have to go through 7 plugin demos on each new jQuery release and check every feature of each of them. That is simply to say that we cannot expect all plugin authors to post up-to-the-minute version compatibility info. My tendency is normally don't post a compatible-with-version-number until someone complains that it doesn't work their version. people who use plugins are so tough on the developers. All developers doing their best to release the best plugin using their workflow and skills. Amen. Along those lines, i agree 100% with John Resig's response to the above post, where he says: Why not help to add that to the main jQuery plugin repository? We already have all the plugins and the full application... i think that most plugin authors are using (or starting to use) the nice plugin repo facility at the jQ site, and adding this as a feature would certainly coerce me to update the version compatibility info as i go through the normal update routine for my plugins. Back on topic. Not all developers put their plugins in the repository, sometimes they only announce it here. The plugin repo is fairly new, though (well, the new one is, of course... i never got around to using the old one). i think there is a movement (if we can call it that) to try to encourage plugin authors to post their plugin(s) there. It's easy to do and provides features like bug tracking, so there's little reason not to use it. (It's probably also good for one's google rankings, with jquery.com pointing back to your home page ;).)
[jQuery] Re: select items with a class beginning with a given string?
On Sep 17, 2:34 pm, jazzle [EMAIL PROTECTED] wrote: How do I select items with a class beginning with a given string? This might (indirectly) do what you're trying to do: http://docs.jquery.com/Selectors/attributeContains#attributevalue but that searches IN strings (not anchored to the beginning) and its behaviour in the face of attributes with multiple values (e.g. class) is not documented, so you'd need to try it to find out if it's suitable for what you're doing. There is also: http://docs.jquery.com/Selectors/attributeStartsWith#attributevalue but its behaviour regarding space-separated values is also not documented, so you'd need to try it out. If all else fails, you could certainly use the filter() function to implement this. Or maybe even a custom selector?
[jQuery] Re: grabbing event.target using it load - no longer works for me in 1.1.4+
On Sep 14, 3:22 pm, skatta [EMAIL PROTECTED] wrote: $(.dataWin).hide().load(resultlink); this works ... $(.dataWin).hide().load(+resultlink+); resultlink is aparently a non-String object of some type which is not accepted by load(). Your second line (the one which works) is casting it to a string. But you don't need both sets of quotes - one or the other will do: $(.dataWin).hide().load(+resultlink); That will also force it to be a string.
[jQuery] Re: Downloading 1.2 minified, getting 46kb instead of 14kb ??!?
On Sep 14, 4:30 pm, seedy [EMAIL PROTECTED] wrote: I also had the same thing happen. 14kb is only after it has been gzipped by your server. The version you are downloading has been minified, Its up to you to do the gzipping. This is correct. The webmaster/developers/whoever chose to be a bit underhanded there and say it's 14k with gzip, but fail to mention that the user must arrange for the code to get gzipped. Shame on them. They've metamorphed from programmers to marketing people. You cannot simply gzip the file and serve it as-is - that won't work (at least, not on most browsers). You need to arrange for your web server to feed the data compressed. There are a number of ways to do this, but (IMO) none of them are suitable for beginners (and all of them require either configuration changes on your web server or coding in a second language, like PHP). Follow the gzipped link from jquery.com and you'll find an article which covers one way to accomplish this with PHP. Alternately, search this forum, going back about 1 month, to find some discussions on it. The approach proposed at the link mentioned above is sub-optimal because it requires writing a file to your web server, which won't work under all hosted accounts (for reasons described in my comments posted at that site).
[jQuery] Re: Downloading 1.2 minified, getting 46kb instead of 14kb ??!?
On Sep 14, 4:46 pm, Rey Bango [EMAIL PROTECTED] wrote: I think underhanded is a little harsh and I'm not sure John Resig, who is the one who put that up there, was attempting to do anything wrong. Perhaps misleading is a better term than underhanded, but only slighlty so. It would be poor form to upload 1.2 and say only 46kb, after 1.1.x's claim to fame was only 21kb. Everyone would think that code bloat had set in. But claiming that jQuery is now 14k is highly misleading - it definitely is not 14k unless the user takes (and is able to take) extra measures to ensure that he gets that space savings. Considering how involved you are on the list and knowing how much effort everyone on the project puts into the jQuery, I'm a little disappointed that you would make such remarks. Just as disappointed as i was to see the only partially true link which claims that jQuery 1.2 is 14k. jQuery 1.2 (minified) is 46kb, and that's that. It can only be shrunk down with extra client-side support. Not everyone has the technical know-how for how to get it shrunk down. Not everyone has the administrative access to change their .htaccess (and those who can may not have access to mod_deflate or mod_gzip - my hoster doesn't offer them, for example). And those who are running under ASP/IIS environments might not have any option at all for compression. For them, jQuery 1.2 is 46kb. Likewise for people working from local HTML files, without an intermediary web server. The link on the home page claiming that jQ 1.2 is 14kb is going to cause a large number of posts to this list, just like this thread, asking if the size discrepancy is a bug. My answer is, yes, it's a bug on the home page, where it is misleadingly labeled as 14kb. That said, i'll stop responding to those posts and will let others point the confused users to the proper entry in the FAQ.
[jQuery] Re: problem with spaces between html elements in ie
On Sep 13, 7:16 am, mrsheep [EMAIL PROTECTED] wrote: yes, i tried that but i need to have breakable spaces so that the text jumps to the next line if there is no enough horizontal space in the div. This is a shot in the dark, but have you tried using multiple spaces? It might be that the browser engine then collapses those into a single space. Another kludge might be to use \n instead of a pure space. As a rule, browsers will collapse runs of whitespace to a single space when rendering HTML, but i've never heard of a browser collapsing a single whitespace into nothing (but hey... it's MSIE...).
[jQuery] Re: div show hide images
On Sep 13, 2:33 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: what i'd like to do is change the (x) link to an image which changes when that div is hidden. you can see it in action here:http://propertyireland.net any ideas? One approach is not to use a text (x), but to use an image and add/ remove a given CSS class to the header bar. The CSS class can define a different background image for the opened and close states. An example of this can be seen here: http://wanderinghorse.net/computing/javascript/jquery/togglepane/demo.html Look at the third example (with red header bars). When opening/closing those (clicking on the headers), the different graphic is controlled by a CSS class change.
[jQuery] Re: YAAB - Yet Another API Browser
On Sep 13, 8:42 am, Glen Lipka [EMAIL PROTECTED] wrote: Would love thoughts and advice. The code is pretty procedural and ugly. Hiya! Comment/bug: In FF 2.0.0.6, when clicking an entry (any entry), the text for the entry OVERLAYS the TODO list, making it essentially unreadable. If i expand my window to full-screen (1600x1200) (and i despise working with full-screen windows) then the text is not overlaid, but spaced out reasonably. An additional problem i see here is one common to other API browsers i've seen: they're arranged strictly alphabetically, which means that they're only useful if you know exactly what you're looking for. The jQuery web site does a good job of breaking down the API int general categories of features, which makes browsing much easier for the generic case, IMO. Perhaps you can find a way to consolidate such a feature in your browser?
[jQuery] Re: Vibrator Plugin
On Sep 13, 12:44 am, Glen Lipka [EMAIL PROTECTED] wrote: Ben Nadel and I were playing with his latest experiment. Results: A fun plugin, with very few real world use cases.http://www.commadot.com/jquery/vibrateCompare.php Here's a real-world use case for you: the Oktoberfest starts in Munich, Germany on September 22. You can set up an Oktoberfest web site and use this plugin for the menus to help compensate for the drunken users' impaired abilities. Alternately, use it as a simulation of what it must be like to use the web after visiting Oktoberfest. http://www.oktoberfest.de/
[jQuery] Re: Compressing your js files with Ant
On Sep 13, 4:45 pm, Priest, James (NIH/NIEHS) [C] [EMAIL PROTECTED] wrote: This seems like a great solution to having editable scripts in your repository but deploying minimized scripts to production. Be careful with that, though, because minimization is a change to the source, which means that the source you test is NOT the source which you're uploading to your production environment. In working environments with strict QA controls in place (e.g. a bank), this type of shortcut would not be considered acceptable work practice. While minification/packing rarely leads to semantic changes in JS code, it does on occasion happen. It is easy to write code which might run in uncompressed form yet may not be correct once minification occurs (e.g., forgetting to add a semicolon after: var x = function() {...};).
[jQuery] Re: jQuery.dequeue is not a function
On Sep 12, 3:10 pm, Gordon [EMAIL PROTECTED] wrote: However, I just got the error message jQuery.dequeue is not a functionhttp://localhost/js/jquery/interface/interface_drag.js Line 8 interface_drag.js is basically a barebones version of the jQuery interface library with just the bare nimimum needed for draggables built into it. If we can't see the code, it will be hard to judge where the error is. Have you got a page where we can see the error in action?
[jQuery] Re: NEWBIE Question: children() skips first element?
On Sep 12, 9:20 pm, John Resig [EMAIL PROTECTED] wrote: .html() only gets the innerHTML for the first matched element. i think that's what the OP is saying: the element's HTML he's getting back is *not* that of the first child element: div id=content div id=panelPreview class=fieldset_theme div id=panelPreview_inner class=hPanel ... /div /div /div Now his children() call: alert($('#content').children().html()); should return a result starting with div id=panelPreview..., but is instead starting with the HTML from the *next* inner-most DIV (in fact the first child of #panelPreview, not the first child of #content): The resulting html starts with 'div id=panelPreview_inner class=hPanel' :?
[jQuery] Re: NEWBIE Question: children() skips first element?
On Sep 12, 10:52 pm, Richard D. Worth [EMAIL PROTECTED] wrote: as John pointed out, html() returns innerHTML, not outer, so div id=panelPreview... should only be expected if $('#content').html() were called. Doh, of course. /me smacks forehead.
[jQuery] Re: jQuery 1.2 seems to break the Treeview plugin
On Sep 12, 6:07 pm, Alex [EMAIL PROTECTED] wrote: New page with 1.2 min/gzip: http://deadguy.reliccommunity.com/treeview_1.2.html This is beside the point, but i'd like to point out that the min/gzip label which is used on jquery.com is quite misleading. It implies that the code is already gzipped, which it is not. The gzip part only applies if you're web server is set up to compress all output running through it (e.g. mod_deflate or mod_gzip) or if you use a custom PHP (or similar) script to achieve the same result. While most hard-core jQuery users are capable of doing so, most beginners won't have a clue as to how to do so. IMO the gzip label should be removed from the web site, as it is quite likely to mislead people into thinking that they are getting a 14k package which in fact they are downloading a 45k package. Hey, look! Suddenly jQuery dropped from 21k (1.1.x) to 14k (1.2.x)!!! Wrong!
[jQuery] Re: Visual jQuery
On Sep 11, 12:27 pm, Dan Atkinson [EMAIL PROTECTED] wrote: Hey all! Is there an update for Visual jQuery (http://visualjquery.com/ 1.1.2.html), or is it always up to date with the latest version of jQuery? Or has it merely been left to die? :-( If you're interested in up-to-date docs, someone posted this link some weeks ago: http://corky.net/dotan/log/2007/01/jquery-documentation-in-pdf.html Those are up to date as of 1.1.4.
[jQuery] Re: NEWS: jQuery 1.2 Released
On Sep 11, 6:06 am, John Resig [EMAIL PROTECTED] wrote: Full release notes and download information:http://docs.jquery.com/Release:jQuery_1.2 [grumble] 1) i've got a philosophical beef with the change in clone()'s behaviour. Calling clone(false) is not functionally the same as calling clone().empty(), as clone().empty() can require an arbitrarily large amount of extra work which will then be discarded by the empty() call. i rather liked the option to deep- or shallow-clone an object (though i admittedly only used deep copying once, preferring shallow clone for most of my use cases to date). 2) i'm at a complete loss to understand why the load/getIfModified() convenience funcs were removed. To save a few bytes in the core lib? If so, those bytes have simply moved into client code (in the form of the more verbose $.ajax() call), possibly multiple times (once per call point). The end result is probably a net enlargement of included JS, IMO. 3) eq()/lt()/gt() are dead. Long live eq()/lt()/gt(). Again, the client-side code doubles from lt(3) to slice(0,3) (5 chars to 10 chars). If i hung out on the developer's list i would probably understand the reasoning behind deprecating eq/lt/gt, but since i don't hang out on that list i'll just grumble about the change. 4) $(...).evalScripts() automatically happens now. Does that mean that if i load the JS code of a script for display (e.g. a view code link which load()s the code), that the loaded code is now executed? If so, i think that's evil. If not, ignore this item. [/grumble] :)
[jQuery] 1.2/1.1 slice() vs lt(): what is preferred way to handle both of these cases?
Hi, all! i'm going through my plugins and making sure they work in 1.1.{3,4} and 1.2, and i've come across an ugly case... i use lt(), which isn't available in 1.2. Of course, lt() can be replaced by slice(), but that isn't in 1.1.x. My plugin would work in both versions if it weren't for this tiny incompatibility. What is the preferred way to check the jQuery object for cases like this? Something like if( 'slice' in jQuery.fn ) ??? How are other users dealing with this? i explicitly do not want to force the user to load the 1.1.x compatibility plugin, nor do i want to force the user to upgrade to 1.2 just because of a 1-line change in my plugin (s/lt/slice/). Many thanks in advance. PS: this probably isn't the last time i'll bitch about the removal of gt/lt/eq() ;). :)
[jQuery] Re: 1.2/1.1 slice() vs lt(): what is preferred way to handle both of these cases?
On Sep 11, 10:38 pm, Josh Bush [EMAIL PROTECTED] wrote: You could add lt in at the top of your plugin if it's missing. Something like: if(!jQuery.fn.lt){ jQuery.fn.lt=function(n){ return this.slice(0,n); } } i don't feel right about adjusting the global jQuery API for the user, so i did the following local kludge (which stays hidden inside plugin-only objects, rather than modifying the shared jQuery object): var wrappers = jQuery(' div',this); var contents = jQuery('div:last',wrappers); var heads = jQuery('div:first',wrappers); if( ! heads.lt ) { // accommodate jQuery 1.2 incompatibility... heads.lt = function(index) { return heads.slice(0,index); }; heads.gt = function(index) { return heads.slice(index+1); }; }
[jQuery] Re: NEWS: jQuery 1.2 Released
On Sep 11, 11:18 pm, John Resig [EMAIL PROTECTED] wrote: Only using shallow copy? You're definitely in a very, very, small minority, then. What are the use cases for shallow copying a large DOM structure, that has a ton of child elements? Shallow copying is useful, e.g., when copying images. Granted, however, that a deep copy is just as cheap for images because they don't have child elements. In my boardgaming interface i use(d) shallow clones to copy playing pieces from the piece tray to the game board. Because we want to move away from one-use specialty methods. arguing against the removal would be the same as arguing for the inclusion of getIfNotCached or getSynchronous. Fair enough. I'm confused about your complaint of file size, as well - we're literally talking about the difference between: $.get(url) and $.ajax({url: url, ifModified: true}); i was assuming that the convenience funcs were removed to save a few bytes in the (growing) core. Under that assumption, the extra bytes simply moved from the core into the client code. Your justification for removing the convenience funcs goes deeper than saving a few bytes in the core, though, so my assumption was incomplete/incorrect. 3) eq()/lt()/gt() are dead. Long live eq()/lt()/gt(). Again, the ... You don't have to hang on the dev list to be in tune with what's happening. These changes were put up on the wiki back in mid-June:http://docs.jquery.com/JQuery_1.2_Roadmap i was aware they were going away, just not clear about exactly why they are going away (other than because you can do the same thing with slice [by typing a bit more]). That being said, those method - 3 of them - were specialty methods that were only capable of performing one task - and they weren't terribly good at it either, as they had to interact with the selector engine in order to use it (which is, comparably, quite slow). Slice is a couple things: 1) Faster. 2) Uses an existing idiom, making it easier to use and learn. 3) More Powerful. 4) A reduction of the API. All fair enough points, though i would argue that greater-than and less-than are more commonly used idioms than slice. Since those functions are all long-timers in the API, wouldn't it make sense to keep them and reimplement them in terms of slice()? Of the 7 plugins i've published, only one of them is incompatible between 1.1 and 1.2, and only because lt() and gt() went away. Were it not for that, i wouldn't have had to edit any code to accommodate both 1.1 and 1.2. (OTOH, the fact that only 1 of 7 plugins uses gt/lt may indicate that those funcs are relatively seldom used.) With the coming of slice(), there is now a greater discrepancy between the functional API and the selectors, because there is no longer a symmetry between $(x).gt(2) and $(x:gt(2)), like there was before. Now it's $(x:gt(2)) vs $(x).slice(3). The off by one in the slice() forces me to stop and think every time i see it. No, evalScripts only occurs when when HTML is injected into the DOM - so if you load HTML from a remote page, the scripts contained in the HTML won't be executed until the HTML is actually inserted into the document. Excellent :). Thanks for that clarification.
[jQuery] Learning JQuery book typo: plugins repo URL is 404
Hiya! i'm not sure where to post bugs related to the Learning jQuery book, so i'll drop it here: Page 309 says: The jquery.com Plugin Repository at http://jquery.com/Plugins/ is a great place to start when looking for documentation. That URL is a 404, though - plugins should be lower-case. Perhaps the webmaster can adjust for that, rather than waiting on the next edition of the book. :)
[jQuery] Re: rounded border plugin?
On Sep 11, 11:14 pm, Matt [EMAIL PROTECTED] wrote: Hi All, I'm new to JQuery, and relatively new to JS. I noticed there are a few plugins for doing rounded corners, but the ones I've seen seem to work on background colors only. Perhaps this one: http://methvin.com/jquery/jq-corner.html (You didn't tell us which one(s) you've tried already.) What I would ideally like is to have only rounded borders, in which the background and/or border color would change if the area inside the border was selected. Is there anything like this? i'm not real clear what you mean by that. When you say selected, do you mean has the input focus or do you mean user dragged the mouse over the text, selecting it, or something different?
[jQuery] Re: jquery 1.2 feedback
On Sep 12, 12:59 am, Web Specialist [EMAIL PROTECTED] wrote: I'm using Jorn's Form Validation in a monster form. Using jQuery 1.2minified version returns all validation in =~ 16 sec. Using uncompressed version returns in 6 sec. Comparing with an older version I don't have any improvement. That speed difference is almost certainly caused by odd circumstances, not by the compression. A minified jQuery version is semantically identical to an uncompressed version. A MIN'd copy essentially only has whitespaces and comments removed, and those are meaningless for the JS engine, which means they have no effect on execution speed. During the JS compilation phase, only meaningful tokens are converted to bytecode for the JS interpreter, while whitespace and comments are literally stripped out. Now... if you have a really odd JS engine which does not compile the source code to bytecode (or recompiles it on each call) then i could understand a menial speed diff between MIN'd and uncompressed code, but i would be surprised if any commercial JS engine out there does that. A packed version is decompressed at the time the outer-most code is run (when jQuery is first included), after which the compression overhead is gone. This means that PACKing only has an overhead at load- time (which may or may not be less than the time it would take to transfer an unpacked copy). It has no effect on the execution speed of the JS code once the initial expansion is done, however. If your MIN'd code is using YUIMin (as opposed to Doug Crockford's jsmin), then it is functionally similar to the conventional PACK process, in that it will have an initial overhead while the code is unpacked, but afterwards the bytecode engine will have uncompressed code and the decompression will play no role on the execution speed.
[jQuery] Re: licensing for distribution
On Sep 10, 6:36 pm, CodeMates [EMAIL PROTECTED] wrote: Do you offer any license for distributing jQuery? We have a community script in development and we wanted to add jQuery for the tabs design. http://docs.jquery.com/Licensing :)
[jQuery] Re: .min.js and .pack.js
On Aug 27, 2:51 pm, motob [EMAIL PROTECTED] wrote: Besides file size, what is the difference between a .min and .pack version of a js file? I see this a lot with the various plugins and jquery library. A very brief overview of each can be seen here: http://wanderinghorse.net/computing/javascript/jquery/colorpicker/ Scroll down to the bottom of that page. What are the pitfalls and benefits of using each? The only pitfall i'm aware of is that the packing process occasionally (very rarely) does something which changes the semantics of a piece of code (changes its meaning), leading to a bug which isn't there in the unpacked source. It is impossible for a human to decode the packed code, so debugging these problems is difficult. The so-called YUI minifier (see the above link) is newer and works similarly to the conventional packers, but does not suffer that problem, at least in theory.
[jQuery] Re: Problems to migrate from 1.1.2 to 1.1.4
On Aug 27, 12:43 pm, oscar esp [EMAIL PROTECTED] wrote: Just to begining I got some error when I load some pluguins. All errors are related with $... When I try to execute the same code with 1.1.4 I get some errors: By example loading jQeury-calendar.js Runtime error: $.fn is null or not an object... This error happens when your jQuery file is not loading. Double-check the name/path of your jQuery include file. If you are using firebug, be aware that firebug unfortunately does not show include failures as a script error - you need to look at the Net tab to see the error.
[jQuery] Re: general JS Q: when to use the delete operator?
On Aug 27, 8:39 pm, traunic [EMAIL PROTECTED] wrote: read throughhttp://simon.incutio.com/slides/2006/etech/javascript/js-tutorial.001... today and feel like I did not know anything; That's a nice overview, and i also learned/clarified a few things by reading it. than designing!). I honestly thought of myself as pretty advanced, but there are some basic foundation principals I just was not even aware of. Feeling very red faced today Like you, i've been working with it (mostly casually) for many years, but still often come across some behaviour which ends up biting/ surprising me. JS is unfortunately a language which is all too easy to abuse (or get abused by), largely because it's so free-form when compared to lower-level languages like C/C++. It's really easy to learn to write unstructured and/or sloppy code in JS, and it takes a lot of self-discipline to get into the habit of writing Clean Code in JS. :)
[jQuery] Re: Order of execution with onclick and click
On Aug 27, 6:45 pm, Mike Miller [EMAIL PROTECTED] wrote: I have an html element that has an onclick attribute set which calls a couple of JS functions. Using jquery I am adding a click event to the same element. Can anyone tell me what the expected execution of js functions will be? There was a series of posts a few weeks ago where John Resig said that it is not supported to have both a local onclick and a click() handler. Use one or the other, but not both. IIRC (maybe wrong), the click() function simply overwrites the onclick handler.
[jQuery] Re: textareas and contains()
On Aug 28, 12:51 am, MrNase [EMAIL PROTECTED] wrote: What I was trying to do here was to make a mootools example in jQuery. In mootools, all you need is: if(txt.val().contains('hello')) txt.trigger('burn', 'hello world!'); It would seem that val() returns a String object and that mootools adds the contains() method to String.prototype. Extending built-in types in this way is considered poor practice, partly because it makes code which uses those built-in types incompatible across toolkits. It can confuse people into thinking that those features are built in to the language, when they're really not. There are other down-sides to this type of extension, as well. Therefore I was looking for a jQuery way to do it but contains() doesn't work as expected. :( contains() is not a String method in jQuery, but is a member of the jQuery class and looks for an Element (or Elements) contained within another element.
[jQuery] Re: Plugin Repository - Report New Bugs and Request New Features?
On Aug 26, 5:23 am, Karl Swedberg [EMAIL PROTECTED] wrote: Why is hardly anyone using these on the plugin pages? The path of least resistance. They all post here instead. And the developers here normally say either won't fix that or I just posted an update, which means no long-term tracking is needed. :/ It's seems a shame not to use what looks like a nice tool. i agree 100%, and i think it would help if the plugin developers started directing people to the bug db. The bug db has a higher barrier to entry than the list does (one has to create an account on the web site), though, so that might keep some people away (most list- goers have a Google account already). As I've been working on the clueTip plugin, one of the hardest things for me has been to keep track of what people want out of it and what they're finding wrong with it. If memory serves me properly, most people report bugs to you via this list or your blog. Okay, sorry, I'm rambling. i think you've brought a very useful topic to the surface. A summary of my stance is: it's a problem of education - the developers should get in the habit of teaching the users to file bug reports by simply requesting them to please file a bug report at http://...; That may be overkill for trivial reports which you know you can fix in a few minutes, but for bugs which won't/can't be fixed immediately, i feel it's a good solution. :)
[jQuery] Re: Plugin Repository - Report New Bugs and Request New Features?
On Aug 26, 9:03 am, Ganeshji Marwaha [EMAIL PROTECTED] wrote: For starters, i don't know if i have write access to the jquery svn repository to checkin my plugin. You don't need it - anyone can submit a plugin to the plugin web site, which is independent of the svn tree. You just need to create an account on the plugins site, then you're all set to go. Third, the main jquery page still points to the docs.jquery.com/plugins wiki instead of the plugin page. Many people are still using that. Someone posted a few weeks ago saying that they would install a redirect on the plugins page soon. When... i don't remember. And, as Stephan says it is both a problem of education and the barrier to entry. Perhaps we can get the webmasters to allow anonymous posts to the bug db (assuming that the underlying framework allows it, which i'm not sure about at all). :)
[jQuery] Re: Adding a 'reset' feature to form
On Aug 26, 9:50 pm, Steve Finkelstein [EMAIL PROTECTED] wrote: I was curious if there is a way to integrate a 'Reset All' button to clear all the values to their original values if possible, using some JQuery plugin? Something quick and hackish would work. No need for a hack - HTML has this feature already: http://www.htmlcodetutorial.com/forms/_INPUT_TYPE_RESET.html
[jQuery] Re: Plugin Repository - Report New Bugs and Request New Features?
On Aug 26, 11:04 pm, Jörn Zaefferer [EMAIL PROTECTED] wrote: You can use Google Code just like jQuery does. And in contrast to sourceforge.net, your project creation request isn't delayed or denied on some random basis. Thanks for that tip. :) What services do they provide? i'm poking around code.google.com and can find absolutely zero info about what services they provide to hosted projects. i know i could find out by creating a new project, but i don't want to create a project just to find out what they offer.
[jQuery] Re: attr({'type':'hidden'}) in IE6
On Aug 27, 5:49 am, Minh [EMAIL PROTECTED] wrote: Getting an error when I tried to set a input attribute to hidden in v1.1.2, v.1.1.3.1 and v1.1.4. Using $ (#inputID).attr({'type':'hidden'}) and $ (#inputID).attr(type,hidden). Input elements are special cases in that their 'type' setting completely changes how the are created and rendered. (In my opinion, the fact that type=xxx is used, instead of a separate TAG, is a design flaw in HTML.) Once an input element's type is set, it cannot feasibly be changed. Consider, for example, changing from type=submit to type=text. What should happen to: a) the onclick handler? b) the onfocus handler? c) should the value of the button now become the value of the text field? d) etc. etc. etc. Obviously, you do not want onclick on a type=text to submit your form. Similarly, changing the other onXXX events could produce weird/ undesired side effects when switching type= between arbitrary types.
[jQuery] Re: Why is the + being turned into a space?
On Aug 27, 6:34 am, barophobia [EMAIL PROTECTED] wrote: It would seem that this is PHP's fault since Firebug reports the correct data. But that's why this is so weird. When I take $.ajax out of the loop PHP says that I have submitted [EMAIL PROTECTED]. Our of curiousity, does the $.ajax call still behave as desired if you change the 'POST' to 'GET'? i'm not well-versed in the subtleties of character translation via-a-vis POST and GET, but my gut tells me that the problem may be related to that. (??)
[jQuery] Re: How to Inject style sheets/.CSS
On Aug 25, 8:58 am, Erik Beeson [EMAIL PROTECTED] wrote: http://erikandcolleen.com/erik/projects/jquery/cssinject/cssinject3.html That is slick, Erik :). You know... in case you've got tons of extra energy and time... with a bit of hacking (well, a week or three of work), you could turn that into a point-n-click CSS experimentation/prototyping tool. :)
[jQuery] Re: Very confused!
On Aug 24, 3:10 pm, Scott Sauyet [EMAIL PROTECTED] wrote: var new_name = n.replace(/\[\d?\]/, '[' + OINDEX + ']'); For your code you don't need the \d?, because your template doesn't have a number in it. That said, your template code is incorrect: JQ(tpl).find('[EMAIL PROTECTED]').each(function(){ Carefully count the [ and ] characters in that string and you'll find that they're mismatched and cannot match your regex: var new_name = n.replace(/\[\d?\]/, '[' + OINDEX + ']'); Also, it wouldn't surprise me if you need to escape the [ and ] inside the find() command, as detailed in the FAQ: http://docs.jquery.com/Frequently_Asked_Questions#How_do_I_select_an_element_that_has_weird_characters_in_its_ID.3F But apparently your working example demonstrates that that's not necessary. THAT i can't explain, though. :)
[jQuery] Re: It is possible to do in js with jquery?
On Aug 25, 6:17 pm, gianiaz [EMAIL PROTECTED] wrote: $vml = $('v:oval').appendTo(divStruttura); But it seems it doesn't work, it is my fault or jquery can't handle this type of elements? To create DOM elements, jQuery passes on the element string to your browser and lets the browser create the DOM. Then jQuery works with the DOM elements instead of the HTML/XML. (This is, in fact, the only sensible way to implement the DOM-generation parts of jQuery.) That means that jQuery supports only elements which the browser's internal DOM engine supports.
[jQuery] yuimin 1.1 released
Hi, all! We discussed yuimin a couple weeks ago. i just came across an updated version and thought this might interest some of you: http://www.julienlecomte.net/blog/2007/08/20/yui-compressor-version-11-now-available/ In my experience, yuimin compresses better than packer or jsmin in almost all (but not all) cases. An interesting exception is the jQuery sources, which is compresses to around 31k. That said, when using a combination of (some packer)+gzip compression, yuimin+gzip has provided the best overall compression i've found. It's too slow for real-time compression, but certainly good when posting packed versions to a web site. If you'd like to see some compressed size comparisons, simply check out the download links on my plugins site, where i host uncompressed/ packed/jsmin'd/yuimin'd sources: http://wanderinghorse.net/computing/javascript/jquery/ Happy hacking!
[jQuery] Re: jqGalView (yet another image gallery)
On Aug 24, 8:24 pm, Benjamin Sterling [EMAIL PROTECTED] wrote: Hello All, Wanted to announce yet another image gallery! What is different between this one and other million out there, well, I made it :). The url:http://benjaminsterling.com/2007/08/24/jquery-jqgalview-photo-gallery/ Ooooh, i like that. Some spontaneous suggestions: a) When i see the open thing drop down, my instinct is to click on it, but this is impossible (it goes away when the mouse goes over it). This behaviour is a bit confusing. After tinkering, it is clear that i am supposed to click on the image, but perhaps it would be clearer if the Open thingie didn't disappear unless i mouse out of the image. b) The scrolling behaviour of a clicked image is a tad confusing because the back label only appears at certain times (again, my instinct is to try to click it). c) The 1 and 2 link-like things at the bottom of an image... what are they supposed to do? i see no change in the image when clicking those (Firefox 2.0.0.6). But i love the overall look/feel.
[jQuery] Re: Beginner not getting it.
On Aug 24, 9:16 pm, atomicnuke [EMAIL PROTECTED] wrote: But I just get an error in firebug '$ is not defined on line $ (document).ready(function(){ As others have pointed out, the problem is almost certainly that your js file is not being found. Unfortunately, Firebug hides the error messages related to scripts not being found in the Net tab instead of the error console. i've been bitten by this problem several times.
[jQuery] Re: general JS Q: when to use the delete operator?
On Aug 24, 11:09 pm, traunic [EMAIL PROTECTED] wrote: wade = function(boo){ bar = boo + 3; if(bar 10){...} delete bar; }; ... if I am understanding correctly you are saying that 'wade' and 'bar' would both be global variables in this instance. Yes. If you don't qualify a local variable with 'var', JS treats it as a global. Also that 'far' would be automatically cleaned up by the engine after any call to 'mark' returns. Is this correct? Yes and no - 'far' is MADE AVAILABLE FOR CLEANUP at that point, but is not necessarily cleaned up that instant. The garbage collector runs at arbitrary times which are completely non-deterministic (which simply means 100% unpredictable). There is nothing in the language standard specifying exactly when the garbage collector must do its work. And to take this to an extreme: ... wade: function(boo){ bar = boo + 3; ... Is 'bar' still global? If you don't qualify it with 'var' then JS treats it as global. That said, it will not be introduced into the global namespace until it is actually referenced (when wade() is called, or you use bar in another global context, whichever comes first). :)
[jQuery] Re: OT: Is this a Javascript bug?
On Aug 23, 3:39 pm, Pops [EMAIL PROTECTED] wrote: $(start).value -= 1*$(rows).value;// - WORKS AS EXPECTED $('start').value is a STRING, but no -= operator is available for strings, so it converts the value to a number. $(start).value += 1*$(rows).value; // - BUG!! Aha - .value is a STRING, but operator += IS defined for Strings, so it uses it and appends to the value. To me, that looks look like a JS type casting bug or inclusive addition bug? It's not a bug, but a confusion about how the operators and type conversion apply. IMO += should not be overloaded for strings, to avoid exactly this type of problem. The fact that SOME of the built-in types have special operator overloads, but users of the language cannot overload any operators (except, indirectly, toString()), is a language design flaw, IMO.
[jQuery] Re: JSON MIME type?
On Aug 23, 5:33 pm, Michael Randolph [EMAIL PROTECTED] wrote: I'm using the jQuery Form plugin to call an ASP.NET 2.0 page. The call works just fine, but the response never comes back right. If the Response.ContentType is set to text/plain the page gets forwarded to a plain text JSON result. json is in fact plain text. It is only turned into an Object by passing that text to eval(). Once you get the response text, simply do: eval(responseText).
[jQuery] Re: Place value of navigator.cookieEnabled into an object. Why won't this work?!?!?
On Aug 23, 3:11 pm, Andy Matthews [EMAIL PROTECTED] wrote: userInfo['v_cookies'] = navigator.cookieEnabled; alert(navigator.cookieEnabled); ... Does anyone know what I can do to get around this? Alternately, is there a better, or more reliable way to check if the browser has cookiesEnabled? While i see no particular problem with your code, are you SURE you don't have a typo in your function body? Double-check the spelling of 'cookieEnabled'. The last line of your post has a different spelling (one which i was able to google).
[jQuery] Re: Place value of navigator.cookieEnabled into an object. Why won't this work?!?!?
On Aug 23, 5:53 pm, Stephan Beal [EMAIL PROTECTED] wrote: While i see no particular problem with your code, are you SURE you don't have a typo in your function body? Double-check the spelling of 'cookieEnabled'. The last line of your post has a different spelling (one which i was able to google). After more googling around, it seems that cookieEnabled (as opposed to cookiesEnabled) is indeed the proper spelling: http://developer.mozilla.org/en/docs/DOM:window.navigator.cookieEnabled While i disagree highly with their choice of spellings, it seems that that's simply the way it is. So... i can't offer you an answer as to why your code isn't working. The only suggestion i can offer is to try window.navigator instead of simply navigator. ??
[jQuery] OT: building a CSS-only nav system
This showed up on digg today and i thought it might interest some of you, or inspire some of you to write a plugin: http://www.pupinc.com/browser/
[jQuery] Re: Get size for elements that don't exist yet
On Aug 22, 11:42 am, Gordon [EMAIL PROTECTED] wrote: flickering occurs. You can mitigate the flickering problem by making sure the elements you add to the dome have a css ('visibility', 'hidden') but that still leaves the other problems. FYI: visibility:hidden is different than visibility:none. 'hidden', according to Eric Meyers' O'Reilly book, acts as if the element is still there, but invisible. That is, it's space is still taken up. visibility:none acts as if the element is not part of the DOM, for purposes of display. So you can probably get rid of the flickering by using 'none' instead of 'hidden'. So basically, what I'm wondering is, if there is a CSS rule that defines an element's parameters, That's what CSS does - defines the parameters for matching elements. Not all elements accept all parameters. Not only that, but to match a rule, an element must exist. i suspect the closest you're going to be able to get is to use visibility:none, where element exists, but is treated as if it's outside the DOM for rendering purposes. and if no examples of said element exist in the DOM yet, would it be possible to get the parameters direct from the stylesheet? AFAIK, most browsers don't directly support scripting the style sheet(s), though i have heard rumors that Firefox allows us. There isn't (yet) a standard way to do, though.
[jQuery] Re: $('#id').Pulsate(500, 100) .stop ??
On Aug 22, 10:03 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: These docs: http://interface.eyecon.ro/docs/animate detail a stop() method which might or might be able to stop the animation prematurely. ok. but how i can stop $('#id').Pulsate(500, 100); $('#id').Pulsate(500, 100).stop() ??? because i must stop Pulsate any time. have you a idea ? i can only guess that the stop() function is what you want, as i'm neither the author nor a user of the plugin providing that feature. In any case, $(...).Pulsate(...).stop() is certainly not what you want because it will stop the animation immediately after you stop it. According to the docs, $(...).stop() is what you'd want. But, again, that's only a guess based on the documentation.
[jQuery] Re: Get size for elements that don't exist yet
On Aug 22, 1:58 pm, Klaus Hartl [EMAIL PROTECTED] wrote: Stephan Beal wrote: FYI: visibility:hidden is different than visibility:none. 'hidden', according to Eric Meyers' O'Reilly book, acts as if the element is ... Do not mix up visibility and display properties. There is no value of none for the visibility property. That is supposed to for display. http://www.w3.org/TR/CSS21/visufx.html#visibilityhttp://www.w3.org/TR/CSS21/visuren.html#display-prop Doh, you're right. i confused visibility and display. My intention was to differentiate display:none vs visibility:hidden.
[jQuery] Re: Get size for elements that don't exist yet
On Aug 22, 3:49 pm, duma [EMAIL PROTECTED] wrote: If you're talking about accessing the included stylesheets, you certainly can do that by accessing document.styleSheets. ... document.styleSheets is part of the DOM Level 1 standard. The CSSStyleSheet object is DOM Level 2. That may be, but it appears to be poorly supported across the browsers. Googling returns remarkably little useful information about the class, but here's a summary of browser support: http://www.itmill.com/reference/dom2/CSSStyleSheet.html Apparently only Mozilla 1.0+ and Opera 9+ support it in a standards- compliant form.
[jQuery] Re: Passing variables to a dynamically loaded script
On Aug 21, 2:15 pm, Christopher [EMAIL PROTECTED] wrote: What I have ended up doing (and haven't tested beyond firefox2) is using a regular $.get and doing an eval() in the callback. This seems to allow me to use the variable I need within test.js, but it really seems that there should be a better way of doing this. Maybe it is just my dislike for eval() that makes me not like what I am using now. Any suggestions? i just wrote a long write-up for you on how to do this but Firefox crashed and i lost it... so here's a summary. You can't send vars directly to JS, unfortunately, but one way to simulate this is to use a PHP (or other server-side) filter: $.get('myScript.php', {foo:'bar'}); // this will return JS code, not PHP code myScript.js: ... foo = REPLACEMENT_FOO; ... myScript.php: $txt = file_get_contents('myScript.js'); $txt = preg_replace( '/\bREPLACEMENT_FOO\b/', $_GET['foo'], $txt ); echo $txt; Obviously, you need to do error handling and checking $_GET['foo'] and such, but you get the general idea. If you need help understanding preg_replace(), i recommend googling for perl compatible regular expressions, as there is TONS of information available on them out there. :)
[jQuery] Re: Cycle Plugin Killing me
On Aug 21, 4:14 pm, Mitch [EMAIL PROTECTED] wrote: Im going to do this from now on, its a really good idea. I wish there was some kind of program that could scan the jQuery and correct braces or at least tell you where they are wrong. Almost every modern text editor can do this for you. To name just a small number of them: xemacs emacs vi vim kate kwrite ... there are certainly some for Windows which can do this, too. (Xemacs runs on Windows but has a pretty high learning curve.)
[jQuery] Re: $('#id').Pulsate(500, 100) .stop ??
On Aug 21, 9:58 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: i use $('#id').Pulsate(500, 100); but i cannot found where i can stop my pulsate or how i can do this ? The docs: http://interface.eyecon.ro/docs/fx say that the arguments are (duration,times), which means that your pulsing will stop after it has run 100 times (of 500ms each, or after a total of 50 seconds). These docs: http://interface.eyecon.ro/docs/animate detail a stop() method which might or might be able to stop the animation prematurely.
[jQuery] Re: Cycle Plugin Killing me
On Aug 21, 9:32 pm, Mitch [EMAIL PROTECTED] wrote: ... I would like to point out something that I think would make your cycle plugin much easier to use which is this. ... div id=birds class=pics img src=../images/Acadian Flycatcher_X2.jpg / img src=../images/Acorn Woodpecker_X2.jpg / img src=../images/Alder Flycatcher_X2.jpg //div Speaking of improvement, here's my idea: It would be nice to be able to pass additional images to the plugin function call. The reason for this is to support Unobtrusive JS: in the DIV you have a single IMG file which will show up whether or not JS is available. When the plugin is called, if it is passed an array of image names, those images are added before the plugin does the rest of its processing. This allows the JS users to have a cycling show and the non-JS users to see the first image without any effects. As proof of concept, here's some code for a trivial image cycler which demonstrates this feature... the part to look at is the addImages stuff: /// // Miniature jQuery plugin for rotating through a set of images. jQuery.fn.goshenImageFader = function( options ) { options = jQuery.extend({ fadeOutSpeed:750, fadeInSpeed:500, delay:4500, addImages:[], forceImgAttr:null },options); if( options.addImages.length ) { for( var i = 0; i options.addImages.length ; ++i ) { var img = jQuery(img/); img.hide() .attr('src',options.addImages[i]) .appendTo(this); } } var imgs = jQuery('img',this); imgs.gt(0).hide(); if( options.forceImgAttr ) { for( var k in options.forceImgAttr ) { imgs.attr(k,options.forceImgAttr[k]); } } var pos = 0; var current = 0; function cycle() { function doIn(to) { imgs.eq(to).fadeIn( options.fadeInSpeed ); } function doOut(from,to) { imgs.eq(from).fadeOut( options.fadeOutSpeed, function(){doIn(to)} ); } pos = (pos = (imgs.length-1)) ? 0 : ++pos; doOut( current, pos ); current = pos; }; setInterval( cycle, options.delay ); return this; }; It's then called like so: $('#FrontPageImageFader').goshenImageFader({ addImages:[ '/pics/homes/timberframe/thumb-50/ Kitchen_view_frontpage_byGoshens.jpg', '/pics/homes/timberframe/WalnutCreek_Porch- front.jpg', '/pics/homes/timberframe/LaurelGap-Loft2.jpg' ] }); i think a similar feature would be trivial to add to Cycle and would help Cycle gracefully degrade in browsers w/o JS.
[jQuery] Re: jCorner problem?
On Aug 21, 9:58 pm, Mark [EMAIL PROTECTED] wrote: This is the result I am expecting --http://www.augustine.com/images/test/expected.jpg . This is what I get --http://www.augustine.com/images/test/actual.jpg . I am using standard corner syntax, $(this).corner(); .. this 'actual' result only occurs in Internet Explorer when the page is refreshed with the cursor ON the window, if you move it away from the window you get the 'expected.jpg' result, thoughts? workarounds? Can you tell us what browser/version you're using, and what jQuery and jCorner versions? Also, if you can provide a link to a page demonstrating the problem, that would be really helpful. :)
[jQuery] Re: Testing IE6 and IE7 with Virtual PC
On Aug 21, 11:26 pm, Bernd Matzner [EMAIL PROTECTED] wrote: You need Virtual PC 2007 to run it, which is available for free here:http://www.microsoft.com/windows/products/winfamily/virtualpc/default... The latter is also nice for creating a Linux test environment you can run from within Windows. Another alternative for running a Linux environment from Windows is the Free (GPL'd) qemu tool (http://fabrice.bellard.free.fr/qemu/), which runs under Linux, Mac OS/X, Windows, and OpenSolaris (and probably others). You can find several pre-configured Linux images for qemu on my web site: http://wanderinghorse.net/computing/qemu/ Simply download an image and open it with qemu and you're all set. You may need to install Apache and whatnot, but for some images (e.g. Debian) that is trivial as long as the qemu network emulation is working (it normally does). :D
[jQuery] Re: Killing ajax calls
On Aug 22, 1:05 am, Tamm [EMAIL PROTECTED] wrote: I'm working on a function that sends far too many ajax calls, an easy way to take care of the problem would be to kill all ajax calls before sending a new one (i.e. if it isn't done yet, nvm the result) the xhr object idea works for one call or if you know all the previous calls but I simply want to kill ANY ajax calls currently not completed... John Resig made a post about a week (maybe two?) ago with some prototype code implementing serial ajax queues. If i'm not mistaken, that code should provide a way to kill the queue, or at least stop any requests which haven't already gone out. You'll have to search the archives to find the link, though... i didn't bookmark it.
[jQuery] Re: Problems with IE after a jquery load
On Aug 20, 11:27 am, danzinger [EMAIL PROTECTED] wrote: So, the fadeIn works in Firefox and IE, but the fadeOut called from the loaded php file doesnt work in IE Someone could help me with this? Can you post a link to an example? Based solely on the description it will be difficult guess at a solution.
[jQuery] Re: Feature suggestion: animating through stylesheets
On Aug 20, 7:18 am, John Resig [EMAIL PROTECTED] wrote: I've re-done the original demo using jQuery's step function (dunno why I didn't think of this before). Much improved:http://dev.jquery.com/~john/ticket/animatetest/ error: console is not defined ?? console.log() is called a couple of times. FF 2.0.0.6 with firebug.