[jQuery] Re: empty() is very slow

2009-08-28 Thread Josh Powell
Change the onclick event handler into a jQuery .live() event and you'll be fine for sure. On Aug 26, 1:57 pm, oleOhle wrote: > OK, thanks everybody! I think I understand. > > Actually my second attempt could easily be rewritten to match exactly > what jQuery does. It really boils down to the rem

[jQuery] Re: empty() is very slow

2009-08-26 Thread oleOhle
OK, thanks everybody! I think I understand. Actually my second attempt could easily be rewritten to match exactly what jQuery does. It really boils down to the remove() function, which does some magic to remove data and events related to the contained DOM elements. Since I only have one HTML onCl

[jQuery] Re: empty() is very slow

2009-08-26 Thread MorningZ
"What is jQuery doing to empty an element?" That's so easy to see/find-out for yourself open up the jquery.js file, search for "emtpy" and voila empty: function() { // Remove element nodes and prevent memory leaks jQuery(this).children().remove(); // Remove

[jQuery] Re: empty() is very slow

2009-08-26 Thread Josh Powell
.empty and .html looks in every node that it removes/replaces and checks for and removes event bindings in order to prevent memory leaks. If you know you do not have bound events, first use plain old javascript to set element.innerHTML = ''; and then remove/replace the element using .empty()/.htm

[jQuery] Re: empty() is very slow

2009-08-26 Thread James
I've found something that worked a faster to empty something when I tested it. function replaceHtml(el, html) { var oldEl = typeof el === "string" ? document.getElementById(el) : el; if (oldEl == null) return null; var newEl = oldEl.cloneNode(false); newEl.innerHTM

[jQuery] Re: empty() is faking ?

2009-05-04 Thread Olivier Percebois-Garve
That explains my issue very well and will save me a lot of headaches. (and gives a few ideas for a debug plugin) thank you -Olivier Ricardo wrote: Could not make much sense out of your video either :D The thing is: when you log an object or element in firebug, it's just a reference to the ob

[jQuery] Re: empty() is faking ?

2009-05-04 Thread Ricardo
Could not make much sense out of your video either :D The thing is: when you log an object or element in firebug, it's just a reference to the object itself, not a snapshot of it at that instant in time. It will always show the object as it is *now*. Try this in the console: x = {a:1}; console.l

[jQuery] Re: empty() is faking ?

2009-05-04 Thread Olivier Percebois-Garve
Ricardo wrote: On May 4, 11:33 am, Olivier Percebois-Garve wrote: Hi I'm puzzled with this :http://pastebin.me/49fef93928aff (in firebug click on the jquery object, then expand "0") Using empty() or remove() on the lis of a ul, it seems that jQuery is "faking" to remove them, i.e the lis

[jQuery] Re: empty() is faking ?

2009-05-04 Thread Ricardo
On May 4, 11:33 am, Olivier Percebois-Garve wrote: > Hi > > I'm puzzled with this :http://pastebin.me/49fef93928aff > > (in firebug click on the jquery object, then expand "0") > > Using empty() or remove() on the lis of a ul, it seems that jQuery is > "faking" to remove them, > i.e the lis will

[jQuery] Re: empty() is faking ?

2009-05-04 Thread Mike Nichols
this is probably due to the refresh problems in firebug On May 4, 7:33 am, Olivier Percebois-Garve wrote: > Hi > > I'm puzzled with this :http://pastebin.me/49fef93928aff > > (in firebug click on the jquery object, then expand "0") > > Using empty() or remove() on the lis of a ul, it seems that

[jQuery] Re: empty().append() slow

2008-11-06 Thread Brandon Aaron
It has to do more than just set innerHTML to a blank string to avoid memory leaks. :( -- Brandon Aaron On Thu, Nov 6, 2008 at 6:28 PM, jquertil <[EMAIL PROTECTED]> wrote: > > thanks Karl, > > didn't make a difference. I suppose I'll have to preload everything > and show/hide things... ugh. > > do

[jQuery] Re: empty().append() slow

2008-11-06 Thread jquertil
thanks Karl, didn't make a difference. I suppose I'll have to preload everything and show/hide things... ugh. does empty() go through the entire element node tree and remove things one by one or something? I kept thinking it just sets innerHTML=''.

[jQuery] Re: empty().append() slow

2008-11-06 Thread Karl Rudd
Try making the selector more specific. So instead of $('.full') use $('div.full'). Karl Rudd On Fri, Nov 7, 2008 at 11:19 AM, jquertil <[EMAIL PROTECTED]> wrote: > > if I have a lot of elements inside ... > > and then do $('.full').empty().append ('blah'); > > it takes a long time. Is there a wa

[jQuery] Re: Empty

2008-10-28 Thread joel boonstra
> I have the following on a JQuery Code: > >    $('').appendTo('#Themes') >    .append(subject) >    .append('') >    .append(levels) >    .append('') > > How can I add > >    .append(subject) >    .append('') > > only if subject is not empty and > >    .append(levels) >    .append('') > > only if

[jQuery] Re: empty class return undefined .. bug ?

2008-05-12 Thread Ariel Flesler
No Richard, that's a bug on jQuery.attr, undefined is returned instead of ''. 'class' works as well as 'className'. I hope this gets revised, it's one of the fixes of on this ticket: http://dev.jquery.com/ticket/2548 Cheers -- Ariel Flesler http://flesler.blogspot.com On 12 mayo, 09:01, "Ric

[jQuery] Re: empty class return undefined .. bug ?

2008-05-12 Thread Richard D. Worth
The name of the class attribute is className, so you want: $('#myid').attr('className'); - Richard Richard D. Worth http://rdworth.org/ On Sun, May 11, 2008 at 12:48 PM, Adwin Wijaya <[EMAIL PROTECTED]> wrote: > > I have code .. to check what class in every id .. > > i found that if the class=

[jQuery] Re: :empty pseudo-class and whitespaces

2007-12-04 Thread Karl Swedberg
On Dec 4, 2007, at 12:23 AM, Christoph Roeder wrote: Thanks, I think this is much better. Chris On Dec 3, 3:03 pm, Karl Swedberg <[EMAIL PROTECTED]> wrote: Does that help clarify it? If not, feel free to edit it directly in the wiki or reply to this with a suggestion for revision. excelle

[jQuery] Re: :empty pseudo-class and whitespaces

2007-12-03 Thread Christoph Roeder
Thanks, I think this is much better. Chris On Dec 3, 3:03 pm, Karl Swedberg <[EMAIL PROTECTED]> wrote: > Does that help clarify it? If not, feel free to edit it directly in > the wiki or reply to this with a suggestion for revision.

[jQuery] Re: :empty pseudo-class and whitespaces

2007-12-03 Thread Karl Swedberg
It's not a bug in :empty. I just changed the documentation to this: Matches all elements that have no children (including text nodes). Then, for the "demo" tab, I changed it to this: Finds all elements that are empty - they don't have child elements or text. Does that help clarify