Re: [jQuery] the pitfalls of jquery
On 3/15/07, Benjamin Sterling [EMAIL PROTECTED] wrote: I've worked on a project for about two months now that uses jquery for everything. Using such plugins as jqModal, blockUI, jqDebug, jqQuick, dimensions plugin, form plugin, and jqHighlightFade as well as some code I pulled out of other plugins (nextUntil (Jorn), bgIframe(?), pngFixer(actual code came from a post on the forum, I just made it into a chain-able plugin) and well as other plugins specific to this app. Feel free to take a look: http://ov-oba.informationexperts.com/ (there are a bunch of style issues I am working on now) Now coming into jQuery I new a good amount of javascript, not an expert but pretty good. But the point to this message is to show how jquery has made my life much harder. Today, I was given a project which would entail using a lot of javascript for ajax calls and some other basic stuff, and the problems is, I CAN'T USE JQUERY I feel your pain. I had to port some of my jQuery code to an eBay listing, which has very strict rules about what js functions are allowed (though won't say which exact ones). Ended up rewriting the whole lot in standard js. It's quite good for the soul ;-) That said, if your restriction is purely ideological, I'd say go with the renaming thing. Chris -- Chris Ovenden http://thepeer.blogspot.com Imagine all the people / Sharing all the world ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery In The Wild: marmot.com
Anyone know why the text looks so awful on that site (Firefox on WinXP)? On 3/15/07, Adam Skinner [EMAIL PROTECTED] wrote: It's running Drupal! (and jQuery is drupal's primary javascript library) Jonathan Sharp wrote: Another jQuery sighting: http://marmot.com click on Clothing Equipment -js ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- View this message in context: http://www.nabble.com/jQuery-In-The-Wild%3A-marmot.com-tf3406390.html#a9492802 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Chris Ovenden http://thepeer.blogspot.com Imagine all the people / Sharing all the world ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery 1.1.2
Thanks for valuable info! But these aren't really attributes, at least in the HTML sense. They're what I call custom properties, and a central plank of object-oriented javascript t'boot. I use them all the time, but had no idea they were called expandos (horrid name), or - more importantly - that they could cause garbage collection problems. I'll read up on this. Thanks, again Chris On 3/1/07, Mike Alsup [EMAIL PROTECTED] wrote: Please correct me if I'm understanding this the wrong way. Strings are safe. Object references are not. That's correct. It's safe to store primitives in an expando because the aren't reference counted for garbage collection. But objects are trouble. An IE memory leak pattern is as simple as this: var o = document.getElementById('A'); document.getElementById('A').myprop = o; Jack Slocum has a good blog entry on avoiding memory leaks: http://www.jackslocum.com/blog/2006/10/02/3-easy-steps-to-avoid-javascript-memory-leaks/ Mike ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Chris Ovenden http://thepeer.blogspot.com Imagine all the people / Sharing all the world ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery 1.1.2
I'm confused. Are these expandos proprietory Microsoft attributes with a specific meaning, or can it also apply to a non-standard attribute that I may invent for a particular purpose (eg all collapsible elements on a page might have a custom attribute collapsible=true)? If it's the latter, I don't see how such attributes can reference anything at all, at least as far as the DOM model is concerned. They're just strings. Personally I avoid this kind of extra attribute; class is a pretty good catch-all for most needs of this kind. I know you can make them valid HTML by extending the DTD, but that seems like a lot of extra work for not much gain. Chris On 3/1/07, Karl Rudd [EMAIL PROTECTED] wrote: I believe so. As I said an expando attribute is basically any non-standard attribute that gets added to an element (doesn't matter how). As Klaus notes, the memory leakage is only a problem in IE when the attribute references other DOM elements (directly, or indirectly via closures). Karl Rudd On 3/1/07, Ⓙⓐⓚⓔ [EMAIL PROTECTED] wrote: so any non standard attribute accessed simple as object.hello is an expando? no matter if you call getAttribute or not?? On 2/28/07, Karl Rudd [EMAIL PROTECTED] wrote: Err no, actually expandos refers to non-standard attributes that get added to DOM elements. They expand the attributes that are available on an element. For instance adding an expando attribute called hello: input type=submit value=blah hello=Hello world! Because they're non-standard they can cause memory leak problems under Internet Explorer if they refer to other DOM elements. More info here: http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/expando.asp Karl Rudd On 3/1/07, Ⓙⓐⓚⓔ [EMAIL PROTECTED] wrote: Fil, did you ever get a definition of DOM 0 expandos... they're the shortcuts that were provided with dom level 0, that are short cuts for certain html(only) attributes, and collections of dom nodes. like a.href is an 'expando' whereas a. a.getAttribute('href') is not. and document.forms is an expando whereas a.getElementsbyTagname('form') is not. I'm pretty sure thats what it means! bonne chance! On 2/28/07, Fil [EMAIL PROTECTED] wrote: * Changed: Events are now internally stored in elem.$events rather than elem.events (due to a nasty bug relating to DOM 0 expandos). I'm translating this blog into French, but I can't figure how to translate this sentence. DOM 0 expandos ? Anyway this is available at http://www.jquery.info/spip.php?article42 -- Fil ___ 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 mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Chris Ovenden http://thepeer.blogspot.com Imagine all the people / Sharing all the world ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jqModal r7 release!
On 2/23/07, Brandon Aaron [EMAIL PROTECTED] wrote: On 2/23/07, Kelvin Luck [EMAIL PROTECTED] wrote: Apparently that causes JS errors when a page is served as content-type=application/xhtml+xml. A user of my date picker told me this and replacing the $('div')'s with $('div/div')'s fixed their problems... I know the general opinion seems to be that content-type=application/xhtml+xml is a waste of time but it's nice for a plugin to allow users to serve their pages as they like... Agreed. Thanks for the info Kelvin! That sounds like something that ought to be fixed in jQ itself. -- Chris Ovenden http://thepeer.blogspot.com Imagine all the people / Sharing all the world ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] History Plugin API
Hi All I have searched Google and my archives of this list, and can't find an API for the history plugin. Is there one, somewhere? Thanks! Chris -- Chris Ovenden http://thepeer.blogspot.com Imagine all the people / Sharing all the world ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] History Plugin API
On 2/21/07, Klaus Hartl [EMAIL PROTECTED] wrote: Chris Ovenden schrieb: Hi All I have searched Google and my archives of this list, and can't find an API for the history plugin. Is there one, somewhere? Thanks! Chris Chris, you'll find the documentation inline. http://dev.jquery.com/browser/trunk/plugins/history_remote/jquery.history.js?format=txt After all, there is not much API: Enable history for an Ajax driven link: $('a').remote('#output'); Such a link will load content from the URL of its href attribute into an element with the id output. (You can put in any selector suported by jQuery or a DOM element). You still have to activate history: $.ajaxHistory.initialize(); There is an undocumented feature. If you have links that do not load Ajax content but have attached some handler on the click event (for example showing a part of the page) you can history-enable that link as well: $('a').history(); I'll write up a little tutorial as soon as possible. Thanks, Klaus! I'll give it a try. Chris -- Chris Ovenden http://thepeer.blogspot.com Imagine all the people / Sharing all the world ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery and Rails
On 2/21/07, Yehuda Katz [EMAIL PROTECTED] wrote: 1) Are you using Rails? Yes, but still a newbie; migrating from PHP 3) Would you prefer an approach that generated JS by writing Ruby helpers that generated jQuery code, or an approach that made is easier to link up existing jQuery code into Rails? I have avoided RoR's automatic javascript stuff, because I read that it's not unobtrusive. But in any case I love to code in jQ (and I agree with Klaus that there are similarities between jQ and Ruby) so have kept it separate from the ruby stuff. I would be interested, though, in helper methods in templates which hijax links automatically in an unobtrusive way (including back button issues). 4) If you've used jQuery with Rails, what issues have you run into We have several mini-sites running as separate Rails instances. We have a module with common ruby code in it, but as yet we haven't found a nice way to share javascript resources across projects. Looking forward to seeing your first release! -- Chris Ovenden http://frontend.blogsome.com Imagine all the people / Sharing all the world ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] How to get the ID of the parent node?
On 2/21/07, Sam Collett [EMAIL PROTECTED] wrote: On 21/02/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, Following up from a question I asked yesterday, I wanted to get the closest parent DIV given an arbitrary nested element. But when I request the .id of that element, i repeatedly get an undefined message, even though this call, $(this).parent(div.sidebarToDo) yields an object. $('#todoList a.deleteTDItem').each(function(index) { var divId = $(this).parent(div.sidebarToDo ).id; alert(divId); // alwasy gives 'undefined' $(this).click = function() { $('#' + divId).remove(); }; }); This is the HTML in question: div class=sidebarToDo width=100% id=dToDo3 table cellpadding=0 cellspacing=0 border=0 width=100% tr tdinput id=cbTdId3 onClick=var textDecor = (this.checked ? 'line-through' : 'none'); $('#textId3').css('text-decoration', textDecor); type=checkbox id=tdcb3 /td td id=textId3 class=sidebarText style=text-decoration: noneStart Work/td td align=righta class=editTDItem href='#'img src=images/edit.gif alt=Edit border=0/a/td td align=righta class=deleteTDItem href=javascript:toggleDiv('dToDo3');img src=images/deleteLink.gif alt=Delete border=0/a/td /tr /table /div Thanks, - Dave You can get the id via attr: $(this).parent(div.sidebarToDo).attr(id) To spell it out a little more clearly, the API for attributes has changed in jQuery 1.0.3+ and shortcuts like .id() no longer work -- Chris Ovenden http://thepeer.blogspot.com Imagine all the people / Sharing all the world ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery and OOP
Nice question, Kolman. AFAIK, and I would love to hear different, is that this (ha ha) is the proper way to do it in Ecmascript languages. In fact, in 'neater' OOP languages like Java the same problem would occur if you had two parallel sets of objects, as we have here with the DOM and user-constructed objects; each instance needs to somehow reference its partner instance. It seems to be a limitation of OOP that there is no 'natural' way to do this. Chris On 10/24/06, Kolman Nándor [EMAIL PROTECTED] wrote: Hi, I am new to jQuery, and I have a question concerning object oriented programming. I have created a sample scenario. In the HTML code I add a button: input type=button value=Count id=btnCounter / In js, I create a class called Counter. In the constructor I add an event handler to the click event of the button. The function I specify as the handler is a method of the Counter class. I also store the button and the nr (the current value of the counter) as an object property. function Counter() { $('#btnCounter').click(this.count); this.button = $('#btnCounter'); this.nr = 0; } In the count method I set the incremented value of the counter to the text of the button. Counter.prototype = { count: function() { this.button.attr('value', this.nr++); } } And I need to create the object in the load event: $(window).load(function() { new Counter(); }); If I try to run the code I get: 'this.button has no properties'. I know that the 'this' in the count method will be the target of the event (the button). But that is not what I need, it is the reference of the Counter object. If I rewrite the constructor I can make it work: function Counter() { var oThis = this; $('#btnCounter').click( function() { oThis.count(); } ); this.button = $('#btnCounter'); this.nr = 0; } But this is quite ugly :(. Is there a nicer way to achieve this? Thx ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Chris Ovenden http://thepeer.blogspot.com Imagine all the people / Sharing all the world ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Window Dialogues
Looks horrid in IE7 while the fake window is being built. On 10/24/06, Ⓙⓐⓚⓔ [EMAIL PROTECTED] wrote: Wow that is pretty! But so big and unpleasantly written! I look forward to a jq version! On 10/23/06, Yehuda Katz [EMAIL PROTECTED] wrote: Anyone know of any good movable, expandable and minimzable window dialogs (like http://prototype-window.xilinus.com/index.html for Prototype) -- Yehuda Katz Web Developer | Wycats Designs (ph) 718.877.1325 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Chris Ovenden http://thepeer.blogspot.com Imagine all the people / Sharing all the world ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] IE7 .ready() bug was Re: Possible IE7 fadeOut bug
For confidentiality reasons I can't show you code I'm working in at the moment, but I have traced it to a problem with Matthias Miller's onreadystatechange hack inside the jquery source code; basically the script element created is not seen by IE7, causing a js error on the following line: script.onreadystatechange = function() { which in turn was causing the rest of jquery not to load. wrapping that clode block in if (script) { } solves that specific problem, but I suppose .ready() wouldn't work (I'm not using it) I am making a cross-domain script which self-loads jquery, if this sheds any light on the matter. I will try to construct a minimal test case. Chris On 10/20/06, Brandon Aaron [EMAIL PROTECTED] wrote: A link would be most helpful in trying to find a solution. Would it be possible to post a link? -- Brandon Aaron On 10/20/06, Chris Ovenden [EMAIL PROTECTED] wrote: Interesting - .css returned a function value, but .animate was undefined. I'm pretty sure the animation module is in there, though, as it's working in FF, and indeed (checking) FF returns the expected function. On 10/20/06, Brandon Aaron [EMAIL PROTECTED] wrote: Could you also try doing an alert(clickBlock.css) and alert(clickBlock.animate)? Thanks -- Brandon Aaron On 10/20/06, Chris Ovenden [EMAIL PROTECTED] wrote: On 10/20/06, Chris Ovenden [EMAIL PROTECTED] wrote: I forgot to say that if you uncomment the alert, it gives undefined in IE7. alert should read alert(clickBlock.fadeOut); // no 'this' On 10/20/06, Chris Ovenden [EMAIL PROTECTED] wrote: Hi I have a problem where fadeOut is undefined in IE7 (final), but working fine in Firefox (2.0RC3). The relevant code is: //alert(this.clickBlock.fadeOut); clickBlock.fadeOut(slow, function() { $(this).remove(); }); clickBlock is a regular jQuery object defined earlier by clickBlock = $(document.createElement(div)).id(block); I originally had clickBlock.remove(); here and it worked just fine. Can't check in IE6 at present, so don't know if it only affects IE7. If someone can confirm this as a bug, I'll file a bug report. -- Chris Ovenden http://thepeer.blogspot.com Imagine all the people / Sharing all the world -- Chris Ovenden http://thepeer.blogspot.com Imagine all the people / Sharing all the world -- Chris Ovenden http://thepeer.blogspot.com Imagine all the people / Sharing all the world ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Chris Ovenden http://thepeer.blogspot.com Imagine all the people / Sharing all the world ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Chris Ovenden http://thepeer.blogspot.com Imagine all the people / Sharing all the world ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Possible IE7 fadeOut bug
I forgot to say that if you uncomment the alert, it gives undefined in IE7. On 10/20/06, Chris Ovenden [EMAIL PROTECTED] wrote: Hi I have a problem where fadeOut is undefined in IE7 (final), but working fine in Firefox (2.0RC3). The relevant code is: //alert(this.clickBlock.fadeOut); clickBlock.fadeOut(slow, function() { $(this).remove(); }); clickBlock is a regular jQuery object defined earlier by clickBlock = $(document.createElement(div)).id(block); I originally had clickBlock.remove(); here and it worked just fine. Can't check in IE6 at present, so don't know if it only affects IE7. If someone can confirm this as a bug, I'll file a bug report. -- Chris Ovenden http://thepeer.blogspot.com Imagine all the people / Sharing all the world -- Chris Ovenden http://thepeer.blogspot.com Imagine all the people / Sharing all the world ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Possible IE7 fadeOut bug
On 10/20/06, Chris Ovenden [EMAIL PROTECTED] wrote: I forgot to say that if you uncomment the alert, it gives undefined in IE7. alert should read alert(clickBlock.fadeOut); // no 'this' On 10/20/06, Chris Ovenden [EMAIL PROTECTED] wrote: Hi I have a problem where fadeOut is undefined in IE7 (final), but working fine in Firefox (2.0RC3). The relevant code is: //alert(this.clickBlock.fadeOut); clickBlock.fadeOut(slow, function() { $(this).remove(); }); clickBlock is a regular jQuery object defined earlier by clickBlock = $(document.createElement(div)).id(block); I originally had clickBlock.remove(); here and it worked just fine. Can't check in IE6 at present, so don't know if it only affects IE7. If someone can confirm this as a bug, I'll file a bug report. -- Chris Ovenden http://thepeer.blogspot.com Imagine all the people / Sharing all the world -- Chris Ovenden http://thepeer.blogspot.com Imagine all the people / Sharing all the world -- Chris Ovenden http://thepeer.blogspot.com Imagine all the people / Sharing all the world ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Possible IE7 fadeOut bug
Interesting - .css returned a function value, but .animate was undefined. I'm pretty sure the animation module is in there, though, as it's working in FF, and indeed (checking) FF returns the expected function. On 10/20/06, Brandon Aaron [EMAIL PROTECTED] wrote: Could you also try doing an alert(clickBlock.css) and alert(clickBlock.animate)? Thanks -- Brandon Aaron On 10/20/06, Chris Ovenden [EMAIL PROTECTED] wrote: On 10/20/06, Chris Ovenden [EMAIL PROTECTED] wrote: I forgot to say that if you uncomment the alert, it gives undefined in IE7. alert should read alert(clickBlock.fadeOut); // no 'this' On 10/20/06, Chris Ovenden [EMAIL PROTECTED] wrote: Hi I have a problem where fadeOut is undefined in IE7 (final), but working fine in Firefox (2.0RC3). The relevant code is: //alert(this.clickBlock.fadeOut); clickBlock.fadeOut(slow, function() { $(this).remove(); }); clickBlock is a regular jQuery object defined earlier by clickBlock = $(document.createElement(div)).id(block); I originally had clickBlock.remove(); here and it worked just fine. Can't check in IE6 at present, so don't know if it only affects IE7. If someone can confirm this as a bug, I'll file a bug report. -- Chris Ovenden http://thepeer.blogspot.com Imagine all the people / Sharing all the world -- Chris Ovenden http://thepeer.blogspot.com Imagine all the people / Sharing all the world -- Chris Ovenden http://thepeer.blogspot.com Imagine all the people / Sharing all the world ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Chris Ovenden http://thepeer.blogspot.com Imagine all the people / Sharing all the world ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] So I guess Ajax is the end of the web
The beauty of jQuery is that all the nasty, cross-browser incompatibility stuff is kept under the hood. Even if the next ECMA standard horribly breaks existing Javascript implementations - which surely it won't, any more than Adobe would release a backwards-incompatible version of Flash - the jQ library could be rewritten to accommodate it so that all our $(...) statements work as before. -- Chris Ovenden http://thepeer.blogspot.com Imagine all the people / Sharing all the world ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Event Model Madness
On 9/1/06, Kelvin Luck [EMAIL PROTECTED] wrote: Michael Haggerty wrote: Since Flash likes to always appear on top, I have come up with a method to hide the player tied to the firing of Thickbox. This isn't an answer to your question but a suggestion for a workaround. If you embed the flash with wmode=transparent then it doesn't always like to be on top and your thickbox should work fine. The downside is that the performance of the flash movie will suffer - depends on the movie but this may be an easier solution, You can avoid the performance hit by using wmode=opaque instead of wmode=transparent. But be warned, both of these are slightly buggy - in particular check that any clickable areas are still where you expect them to be after scrolling the page in firefox 1.x -- Chris Ovenden http://thepeer.blogspot.com Imagine all the people / Sharing all the world ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/