[jQuery] Rhino and jQuery...
Hi all. I'm interested in using jQuery's dom selector in Rhino so I can parse through XML. Anyone know if the xpath parser is dependent on the browser's xml/xpath implementation... sorry, I haven't looked at the code. Rich ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] WordPress+jQuery...
Hi all. For you WordPress users out there, I'd like to show you a WordPress plugin I wrote with the help of jQuery. It's called WP-Amazon (it helps bloggers make money off their postings :-)). Anyway, check out the demo here: http://manalang.com/wp-amazon/ Rich ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] SVN request...
John, et al. (committers), Any chance you guys can http enable the svn repository? I use the svn repo quite a bit so I can build custom versions of jQuery at my company. The problem is that I'm VPN'd in all day long and our internal proxy doesn't allow proxying of svn connections. This is a fairly simple thing to do... just need to enable mod_dav and mod_dav_svn then point it to your repo. Not high on any priority list... just a nice to have. Thanks! Rich ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery 1.1: can't get click event to cancel default action and stop bubbling...
I found my problem... and it's all due to the $(a,c) problem (i.e., c in most of my cases is a jQuery object... with 1.1, if it's not an element, c defaults to document). This bug ends up assigning events to elements I didn't intend to assign events to. Rich On 1/16/07, Rich Manalang <[EMAIL PROTECTED]> wrote: John, I think this is somehow related to the $(a,c) problem in 1.1. In some complex cases (lots of dom traversing while inside an event) the event handler that stops bubbling and cancels the default action ends up doing it for the wrong node... not the one selected. I'm trying to debug more, but I'm a bit tangled up... I'll update soon. Rich On 1/16/07, Rich Manalang < [EMAIL PROTECTED]> wrote: > > Hi John. I created a test page, but can't reproduce it on that page. > However, I can give you access to the app that this is running on so you can > see for yourself. > > I'll email send the info to your gmail acct. > > Thx! > > Rich > > On 1/16/07, John Resig < [EMAIL PROTECTED]> wrote: > > > > Do you have a demo of this running anywhere - perhaps a simpler one > > that doesn't use Ajax? I haven't been able to duplicate this. > > > > --John > > > > On 1/16/07, Rich Manalang < [EMAIL PROTECTED]> wrote: > > > I don't know if others are having as tough a time moving to 1.1 as I > > am, I > > > hope I'm doing something stupid. Anyway, here's my latest find... > > > > > > I was using the toggle() function to toggle a div in an open/close > > state, > > > but then after the 1.1 upgrade, the toogle wasn't canceling the > > default > > > action on the tag that it was attached to (the tag has an > > href). > > > So, I put in a ticket for this ( > > > http://jquery.com/dev/bugs/bug/828/). > > > > > > So, as a workaround, I thought I'd try using the click event instead > > (even > > > though I know that toggle uses the click event internally). Here's > > my code: > > > > > > $(".maxmin").unbind().bind('click',function() { > > > var p = $(this).parents(".container"); > > > var pb = $(".content",p[0]); > > > if (pb.css('display') != 'none') { > > > pb.hide(); > > > > > > $.get(scriptURI,{tab:$.query("tab"),pageletname: > > > p.attr("id"),min:1}); > > > } else { > > > pb.show(); > > > > > > $.get(scriptURI,{tab:$.query("tab"),pageletname:p.attr > > ("id"),min:0}); > > > } > > > return false; > > > }) > > > > > > Notice the "return false" at the end of the function... this is > > supposed to > > > stop bubbling and cancel the default action it's not. > > > > > > Is anyone else experiencing this with 1.1? > > > > > > Rich > > > > > > ___ > > > jQuery mailing list > > > discuss@jquery.com > > > http://jquery.com/discuss/ > > > > > > > > > > > > > ___ > > jQuery mailing list > > discuss@jquery.com > > http://jquery.com/discuss/ > > > > ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery 1.1: can't get click event to cancel default action and stop bubbling...
John, I think this is somehow related to the $(a,c) problem in 1.1. In some complex cases (lots of dom traversing while inside an event) the event handler that stops bubbling and cancels the default action ends up doing it for the wrong node... not the one selected. I'm trying to debug more, but I'm a bit tangled up... I'll update soon. Rich On 1/16/07, Rich Manalang <[EMAIL PROTECTED]> wrote: Hi John. I created a test page, but can't reproduce it on that page. However, I can give you access to the app that this is running on so you can see for yourself. I'll email send the info to your gmail acct. Thx! Rich On 1/16/07, John Resig <[EMAIL PROTECTED]> wrote: > > Do you have a demo of this running anywhere - perhaps a simpler one > that doesn't use Ajax? I haven't been able to duplicate this. > > --John > > On 1/16/07, Rich Manalang < [EMAIL PROTECTED]> wrote: > > I don't know if others are having as tough a time moving to 1.1 as I > am, I > > hope I'm doing something stupid. Anyway, here's my latest find... > > > > I was using the toggle() function to toggle a div in an open/close > state, > > but then after the 1.1 upgrade, the toogle wasn't canceling the > default > > action on the tag that it was attached to (the tag has an > href). > > So, I put in a ticket for this ( > > http://jquery.com/dev/bugs/bug/828/). > > > > So, as a workaround, I thought I'd try using the click event instead > (even > > though I know that toggle uses the click event internally). Here's my > code: > > > > $(".maxmin").unbind().bind('click',function() { > > var p = $(this).parents(".container"); > > var pb = $(".content",p[0]); > > if (pb.css('display') != 'none') { > > pb.hide(); > > > > $.get(scriptURI,{tab:$.query("tab"),pageletname: > > p.attr("id"),min:1}); > > } else { > > pb.show(); > > > > $.get(scriptURI,{tab:$.query("tab"),pageletname:p.attr("id"),min:0}); > > } > > return false; > > }) > > > > Notice the "return false" at the end of the function... this is > supposed to > > stop bubbling and cancel the default action it's not. > > > > Is anyone else experiencing this with 1.1? > > > > Rich > > > > ___ > > jQuery mailing list > > discuss@jquery.com > > http://jquery.com/discuss/ > > > > > > > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery 1.1: can't get click event to cancel default action and stop bubbling...
Hi John. I created a test page, but can't reproduce it on that page. However, I can give you access to the app that this is running on so you can see for yourself. I'll email send the info to your gmail acct. Thx! Rich On 1/16/07, John Resig <[EMAIL PROTECTED]> wrote: Do you have a demo of this running anywhere - perhaps a simpler one that doesn't use Ajax? I haven't been able to duplicate this. --John On 1/16/07, Rich Manalang <[EMAIL PROTECTED]> wrote: > I don't know if others are having as tough a time moving to 1.1 as I am, I > hope I'm doing something stupid. Anyway, here's my latest find... > > I was using the toggle() function to toggle a div in an open/close state, > but then after the 1.1 upgrade, the toogle wasn't canceling the default > action on the tag that it was attached to (the tag has an href). > So, I put in a ticket for this ( > http://jquery.com/dev/bugs/bug/828/). > > So, as a workaround, I thought I'd try using the click event instead (even > though I know that toggle uses the click event internally). Here's my code: > > $(".maxmin").unbind().bind('click',function() { > var p = $(this).parents(".container"); > var pb = $(".content",p[0]); > if (pb.css('display') != 'none') { > pb.hide(); > > $.get(scriptURI,{tab:$.query("tab"),pageletname: > p.attr("id"),min:1}); > } else { > pb.show(); > > $.get(scriptURI,{tab:$.query("tab"),pageletname:p.attr("id"),min:0}); > } > return false; > }) > > Notice the "return false" at the end of the function... this is supposed to > stop bubbling and cancel the default action it's not. > > Is anyone else experiencing this with 1.1? > > Rich > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > > > ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] jQuery 1.1: can't get click event to cancel default action and stop bubbling...
I don't know if others are having as tough a time moving to 1.1 as I am, I hope I'm doing something stupid. Anyway, here's my latest find... I was using the toggle() function to toggle a div in an open/close state, but then after the 1.1 upgrade, the toogle wasn't canceling the default action on the tag that it was attached to (the tag has an href). So, I put in a ticket for this (http://jquery.com/dev/bugs/bug/828/). So, as a workaround, I thought I'd try using the click event instead (even though I know that toggle uses the click event internally). Here's my code: $(".maxmin").unbind().bind('click',function() { var p = $(this).parents(".container"); var pb = $(".content",p[0]); if (pb.css('display') != 'none') { pb.hide(); $.get(scriptURI,{tab:$.query("tab"),pageletname:p.attr ("id"),min:1}); } else { pb.show(); $.get(scriptURI,{tab:$.query("tab"),pageletname:p.attr ("id"),min:0}); } return false; }) Notice the "return false" at the end of the function... this is supposed to stop bubbling and cancel the default action it's not. Is anyone else experiencing this with 1.1? Rich ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] jQuery 1.1 regression: $(a, c)... if c is a jQuery object, c = document...
I know this has already been reported... http://jquery.com/dev/bugs/bug/804 ... but does anyone know if this will be fixed or if it's going to be how it is moving forward? Rich ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Difference between ajaxStop and ajaxComplete
anyone know the difference between these two? Rich ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Fast way to remove duplicate array entries?
It is sorted, but it's an array of objects. Is there a way to hash an object? On 12/20/06, Christof Donat <[EMAIL PROTECTED]> wrote: Hi, > Anyone know of a fast way to remove dups in an array? Is the array sorted? Then you can do function arrayUniq(a) { var rval = [a[0]]; var o = a[0]; for( var i = 1; i < a.length; i++ ) if( a[i] != o ) { rval.push(a[i]); o = a[i]; } return rval; } Christof ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Fast way to remove duplicate array entries?
Anyone know of a fast way to remove dups in an array? Thanks! Rich ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] How to detect if an iFrame's location (URL) has changed...
Yeah... I'm finding that it's tough to get around this issue since I've been reading that IE's onload event can't be relied upon for frames. I've tried encapsulating my code as a class and surrounding it with a try/catch so I can avoid the document.domain error, but when IE throws a "Permission denied" exception it seems to kill the try/catch all together. IE sucks! Rich On 12/18/06, Jörn Zaefferer <[EMAIL PROTECTED]> wrote: Rich Manalang schrieb: > Anyone know of a good solution to this? You could take a look at YUI's onAvailable-event implementation. Maybe you can check for the existance of an element inside the iframe. Though that won't help if you don't control the iframes content. -- Jörn Zaefferer http://bassistance.de ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] How to detect if an iFrame's location (URL) has changed...
Hi all. I've been having a tough time detecting if an iframe on a page has changed. My strategy has been to attach an onload event on the iframe to check if the location.href has changed from the previous. This works great on Firefox, but not on IE. Here's my current code: var iframeURL = frames['target-frame'].location.href; //this saves off the initial iFrame URL $(frames['target-frame']).load(function(){ var currIframeURL = frames['target-frame'].location.href; //this is the new iFrame URL if (iframeURL != currIframeURL) { alert(iframeURL +" " + currIframeURL); iframeURL = currIframeURL; // saves off the new iFrame URL } }); The problem I'm having with IE is that if I execute the onload immediately, it gives me a security error when accessing frames['target-frame'].location... presumably because IE fires my onload before the document in the frame actually loads triggering a document.domainsecurity violation. To get around it, I've set a timeout on the onload so that it doesn't execute right away, but this is not reliable because of latency issues, etc. I thought about adding a callback in the documents in the iframe page, but I won't have control of that 100% of the time... so I need a solution that I can implement on the parent document. Ideally, it would be nice if I can check an object in the frame to see if it's available, but IE thinks that the frame is already available at the time my onload fires. Anyone know of a good solution to this? Thanks! Rich ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] [Interface] Bug... TTabs doesn't work 100% in Firefox 2
TTabs works great on IE... but on Firefox, if you insert a tab in a textarea with a scroll, it scrolls back to the top of the textarea. I'm not sure how to report bugs on interface... so, I apologize for the bug post in this forum. Rich ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] mirror of dean edwards packer anywhere?
If you download the jQuery source, you'll find the packer.js file, the javascript.jar and the associated ant build files to run the packer. Take a look at the pack.js file in the build directory. Rich On 12/13/06, Webunity | Gilles van den Hoven <[EMAIL PROTECTED]> wrote: Anybody know a mirror of dean edwards packer? The .NET application doesn have thesame compression results. Thanx Gilles ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Elegant Loading Indicator
that's fine too... but you still need to trigger the loading indicator to show up when an ajax request goes out. On 12/12/06, Andy Matthews <[EMAIL PROTECTED]> wrote: Why not just create the style for the loading bar in your stylesheet? Then you don't have to do that in jQuery. -Original Message- *From:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of *Rich Manalang *Sent:* Tuesday, December 12, 2006 3:59 PM *To:* jQuery Discussion. *Subject:* Re: [jQuery] Elegant Loading Indicator I do love the simplicity of this... although I had to modify it for my own purposes :-) // Adds a wait indicator to any ajax requests $(document.body).ajaxStart(function() { $(document.body).append('Loading...'); $('#loading').css({padding:"2px", fontSize:"9pt", position:"fixed", top:"0", right:"0", background:"red", color:"white"}); }).ajaxStop(function() { $('#loading').remove(); }); Rich On 12/8/06, Chris W. Parker <[EMAIL PROTECTED]> wrote: > > On Friday, December 08, 2006 2:13 AM Barry Nauta <> said: > > > For me, the wait cursor indicates an upcoming page refresh (oldschool > > web?), hence I will probably wait for this cursor to disappear before > > doing anything else. The beauty of Ajax (one of) IMHO is that you can > > continue to work on a page... > > Good point. In this case then the author can use the arrow+hour glass > icon. For sure this is available on Windows but I'm not sure about Linux > and OSX. > > > Chris. > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Elegant Loading Indicator
I do love the simplicity of this... although I had to modify it for my own purposes :-) // Adds a wait indicator to any ajax requests $(document.body).ajaxStart(function() { $(document.body).append('Loading...'); $('#loading').css({padding:"2px", fontSize:"9pt", position:"fixed", top:"0", right:"0", background:"red", color:"white"}); }).ajaxStop(function() { $('#loading').remove(); }); Rich On 12/8/06, Chris W. Parker <[EMAIL PROTECTED]> wrote: On Friday, December 08, 2006 2:13 AM Barry Nauta <> said: > For me, the wait cursor indicates an upcoming page refresh (oldschool > web?), hence I will probably wait for this cursor to disappear before > doing anything else. The beauty of Ajax (one of) IMHO is that you can > continue to work on a page... Good point. In this case then the author can use the arrow+hour glass icon. For sure this is available on Windows but I'm not sure about Linux and OSX. Chris. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] jQuery is now on gotAPI.com!!!
FYI -- for all those that know about http://gotapi.com, jQuery documentation (ver 1.0.3) is now available on their site. If you don't see it under the "AJAX and Frameworks" section, you may need to refresh your browser cache. Rich ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Efforts to Convert Folks to jQuery
I just contributed the jQuery API doc to gotapi.com... let's see how long it takes them to get it up. Rich On 12/7/06, Edwin Martin <[EMAIL PROTECTED]> wrote: Rey Bango wrote: > Guys, some of you may know of my efforts to get jQuery more exposure. > I think it would be a good idea to have jQuery on sites like gotapi.com. They're open for contributions (code, that is). Site: http://www.gotapi.com/ How to contribute your API: http://www.gotapi.com/contribute/index.html Edwin Martin (jquery-enthousiast since a week). -- http://www.bitstorm.org/edwin/en/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery API docs on gotAPI.com
Thanks. I've attached what I've come up with: simple.xsl: transforms the standard index.xml (comes with jQuery source) into a simple one page doc with anchored methods simple.css: the stylesheet used by simple.xsl gotapi.xsl: generates the gotapi.com specific xml format ( http://gotapi.com/contribute/index.html) Let me know if it's worthy of checking in. Rich On 12/8/06, Jörn Zaefferer <[EMAIL PROTECTED]> wrote: Rich Manalang schrieb: > Here's an early sample of what I was thinking of: > > http://manalang.com/jquery/docs/gotapi.xml > > I need to figure out how to add the method signatures into the anchor. I'm using these XSLT snippets to generate ids and hrefs # : And the simply called with this inside a anchor: Or with this inside the target element (li in my case): You could extract the common part of both into another template... -- Jörn Zaefferer http://bassistance.de ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ html, body { font-family: Arial; font-size:1em; margin: 5px 10px; } h1 { text-align: left; color: #000; margin:0; padding:0; } h1 a { color:#80; text-decoration:none; } h2 { font-size:1.2em; } h3 { font-size:1em; margin:0; padding:0; } h4 { font-size:.9em; margin:0; padding:0; } .tooltip { cursor:pointer; } .tooltipdemo { color:#000; font-size:.7em; font-weight:normal; background:#99; } a.name { color:#80; margin:0 5px 0 0; text-decoration:underline; } .arg-type { color:#666; } .arg-type, .arg-name { font-weight:normal; border-bottom:1px dotted #666; } .type { font-weight:normal; color:#666; margin:0 0 0 10px; } .type .tooltip { font-weight:normal; border-bottom:1px dotted #666; } .desc, .example p { font-size:1.4ex; } .example { border-top:2px solid #ccc; background:#eee; margin:15px 0px; padding:5px 10px; } .example h3 { margin:0; padding:0; } pre { background:#cc; padding: 10px; font-size:.9em; border-left:5px solid #ccc; } http://www.w3.org/1999/XSL/Transform";> - jQuery API Documentation: Version http://jquery.com"; title="jQuery Home">jQuery API Documentation Version: # ( or , ) returns Example: HTML: Result: http://www.w3.org/1999/XSL/Transform";> http://jquery.com/api/ - or , () # ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery API docs on gotAPI.com
Here's an early sample of what I was thinking of: http://manalang.com/jquery/docs/gotapi.xml I need to figure out how to add the method signatures into the anchor. Thoughts? Rich On 12/8/06, Rich Manalang <[EMAIL PROTECTED]> wrote: Hi Jörn. I've just started working on a gotApi.com friendly jquery doc. I'm shooting for very basic... something that would look decent in the gotApi interface. If what you had in mind was expanding out the work you already have, great, but maybe it should be a separate project... since your doc page is really mimicking the gotAPI page and is not suited for the gotAPI interface. What do you think? Rich On 12/8/06, Jörn Zaefferer <[EMAIL PROTECTED]> wrote: > > bmsterling schrieb: > > Jörn, > > I'd be interested in helping, I don't know xslt to the extent that you > have > > for that api, but I would def love to help. > > > I zipped the files: http://joern.jquery.com/api-draft/api-docs.zip > > Take a look at the style/docs.xsl, most of it should be pretty > self-explanatory. > > Or check the style/screen.css and try to improve that. > > Or try to get the quicksearch plugin working, see js/doc.js and > js/quicksearch.js. It would be nice to apply the quicksearch to both > navigation and content. > > -- > Jörn Zaefferer > > http://bassistance.de > > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery API docs on gotAPI.com
Hi Jörn. I've just started working on a gotApi.com friendly jquery doc. I'm shooting for very basic... something that would look decent in the gotApi interface. If what you had in mind was expanding out the work you already have, great, but maybe it should be a separate project... since your doc page is really mimicking the gotAPI page and is not suited for the gotAPI interface. What do you think? Rich On 12/8/06, Jörn Zaefferer <[EMAIL PROTECTED]> wrote: bmsterling schrieb: > Jörn, > I'd be interested in helping, I don't know xslt to the extent that you have > for that api, but I would def love to help. > I zipped the files: http://joern.jquery.com/api-draft/api-docs.zip Take a look at the style/docs.xsl, most of it should be pretty self-explanatory. Or check the style/screen.css and try to improve that. Or try to get the quicksearch plugin working, see js/doc.js and js/quicksearch.js. It would be nice to apply the quicksearch to both navigation and content. -- Jörn Zaefferer http://bassistance.de ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] jQuery API docs on gotAPI.com
Hi all. I'd like to submit the jQuery API docs to the gotAPI.com folks ( http://www.gotapi.com/contribute/index.html). To do this we have to submit the jQuery doc in an XML format that has URLs that point to the jQuery doc hosted on jquery.com (http://jquery.com/api/). However, the problem with our current API doc pages is that the methods aren't linkable... an anchor seems to be appended to the method URLs, but they're not real anchors since if you try to navigate to a specific method with the anchor, it doesn't work (i.e., http://jquery.com/api/#get). John R, what's the state of the API docs? Is it currently being reworked? I noticed that 1.0.3 isn't up yet. If so, can we make sure that the new version has permalinks for each method? Rich ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Stop using thickbox!
If it was as fast and as cool looking as YUI's BasicDialog ( http://www.jackslocum.com/blog/2006/11/04/033-beta-2-basicdialog-yahooextview-and-more/), I'm sure a lot of people would use it... you wouldn't need to convince them. But I think it needs work... good start though. Rich On 11/25/06, Webunity | Gilles van den Hoven <[EMAIL PROTECTED]> wrote: And use my window plugin :) Why? Thickbox was made for images Window plugin was made for popups (dialogs) Just my $0.02 -- Gilles http://gilles.jquery.com/window/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery namespacing your code
Suppose you work on a site with other developers. You create a function called "GetCookie". One of your collegues creates a function called the same thing, but it does something a little differently. So, your code collides. With namespaced code you can define your function inside of a "package". This package has a namespace you provide... org.krstic.util.GetCookie. Because your code has a namespace, it's less likely to collide with someone else' code. This is how the world of Java, Python, Ruby, .Net, and other modern OO languages work. If you take a look at Dojo and YUI, you'll find that those libraries are namespaced. jQuery does not have to be namespaced...although, you can argue that it collides with other libraries that use the $() convenience selector. If you work on a site or product that has lots of javascript and multiple developers working on it, namespaces are a good thing. Rich On 11/16/06, Dragan Krstic <[EMAIL PROTECTED]> wrote: unction package(ns) { >ns = ns.split('.'); >var cur = window, i; >while ( i = ns.shift() ) { >if ( !cur[i] ) cur[i] = {}; >cur = cur[i]; >} > > } > > For us, less expirienced, can someone explain this code? And what is benefit od namespaces? ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery namespacing your code
great... thx John! What other OO stuff did you have in mind? Rich On 11/16/06, John Resig <[EMAIL PROTECTED]> wrote: I took a stab at making it a little bit simpler: function package(ns) { ns = ns.split('.'); var cur = window, i; while ( i = ns.shift() ) { if ( !cur[i] ) cur[i] = {}; cur = cur[i]; } } so, at the top of your code just add: package("foo.bar.baz"); and it makes sure that that namespace exists. While I don't think this belongs in jQuery's core - adding this in to a central OO/inheritance plugin might be a good idea. --John On 11/16/06, Rich Manalang <[EMAIL PROTECTED]> wrote: > Hi all. With a lot of developers writing javascript these days, it's easy > to write something that collides with someone else's code. I like Dojo's > and YUI's approach to namespaced code. So, I decided to create a plugin for > jQuery that allows you to create namespaced objects... it's actually a > transposed version of YUI's namespace function: > > jQuery.namespace = function(ns) { > if (!ns || !ns.length) { return null } > var levels = ns.split("."); > if (eval('typeof '+levels[0]+'=="undefined"')) { > eval(levels[0]+'={}'); > } > var nsobj = eval(levels[0]); > for (var i=1; i nsobj[levels[i]] = nsobj[levels[i]] || {}; > nsobj = nsobj[levels[i]]; > } > return nsobj; > }; > > Feed it a namespace: > > $.namespace("org.jquery.utils") > > Then start using your new namespaced object: > > org.jquery.utils.HelloWorld = function() {alert('hi')} > > This would actually be a nice feature to add to the base jQuery library... > any thoughts on that? > > Rich > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > > > ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] jQuery namespacing your code
Hi all. With a lot of developers writing javascript these days, it's easy to write something that collides with someone else's code. I like Dojo's and YUI's approach to namespaced code. So, I decided to create a plugin for jQuery that allows you to create namespaced objects... it's actually a transposed version of YUI's namespace function: jQuery.namespace = function(ns) { if (!ns || !ns.length) { return null } var levels = ns.split("."); if (eval('typeof '+levels[0]+'=="undefined"')) { eval(levels[0]+'={}'); } var nsobj = eval(levels[0]); for (var i=1; i___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] tabs.png
sure... sorry about spamming the list... it was an accident.On 11/13/06, Klaus Hartl <[EMAIL PROTECTED]> wrote: Rich Manalang schrieb:> [nice tabs background]Hi Rich,may I use it? ;-) -- Klaus___jQuery mailing listdiscuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] tabs.png
tabs.png Description: PNG image ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Interface Sortables onchange property
Hi. I'm trying to fire off an alert (testing) during a sortables onchange event. Here's my code:var personalizeHPTabs = function() { alert('hi... I'm here');};var triggerHPTabsPersonalization = function() { $('ul.hptabs-sortable').Sortable( { accept : 'hptab-sort-item', helperclass : 'sorthelper', opacity: 0.8, fx: 200, tolerance: 'intersect', axis: 'vertically', onchange: personalizeHPTabs })}The weird thing is it never fires for the onchange property... I did get it to fire on the onStop, but I only want it to trigger when a change actually occurs. Any ideas? Rich ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Table column resize and drag-n-drop columns
Has anyone done either of these with jQuery? If so, can you post any examples?Thanks!Rich ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] jQuery leaks...
I was just reading Jack Slocum's article on easy ways to avoid javascript leaks (http://www.jackslocum.com/yui/2006/10/02/3-easy-steps-to-avoid-javascript-memory-leaks/). He mentions a FF plugin called the Leak Monitor (http://dbaron.org/mozilla/leak-monitor/). I just tried this on one of my web apps that use jQuery... and sure enough, I found some leaks... Leaks in window 0x4c333a8: [+] [leaked object] (49afa20, http://myhostname/monkeygrease/lib/jquery/jquery.js, 1186-1203) = function () { if (!jQuery.isReady) { jQuery.isReady = true; if (jQuery.readyList) { for (var i = 0; i < jQuery.readyList.length; i++) { jQuery.readyList[i].apply(document); } jQuery.readyList = null; } if (jQuery.browser.mozilla || jQuery.browser.opera) { document.removeEventListener("DOMContentLoaded", jQuery.ready, false); } } } [ ] guid = 1 [ ] prototype (1f7b208) = [object Object] I need to track down the cause, but just wondering if anyone's had leak problems with jQuery? Rich ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Interface Elements Autocomplete no longer available in Interface lib download...
Not sure who to contact, but I noticed that the Autocompleter plugin that used to come with the Interface Elements library is no longer part of the library. Anyone know why? Rich ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Interface Elements Autocomplete plugin
Yep... the page that has the autocompleter is on the same domain as the XML source. Rich ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Interface Elements Autocomplete plugin problems...
Hi. I just started using the Interface Elements Autocomplete plugin (http://interface.eyecon.ro/docs/autocomplete) for a web app I support. It works great on IE/Firefox (win) under most circumstances. However, on Firefox, when document.domain is set, it fails to work. I tried debugging it using Firebug, but it wasn't throwing any errors. Just wondering if anyone's had this problem before.Unfortunately, I can't remove the document.domain setting... it's part of the web app and I have no control over that.Rich ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Capturing modifier key events
What's the best way to capture modifier key events with Jquery (i.e., <1>)?Rich ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/