[jQuery] Re: So sad, jquery 1.4rc1 continue to leak in ie7

2010-01-14 Thread Phaedra
I'm not so sure to understand how to use process explorer this way, a
memory increase/decrease is not always significant.

I don't think pm can tell me how many nodes are leaking

On 14 Gen, 12:35, Olivier Percebois-Garve  wrote:
> Hi
>
> To make sure that a leak is a leak, you should better use process explorer
> first (http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx).
> Sieve tends to leak by himself. Sieve is only good at giving you indication
> of where the bug might come from, but it should not be trusted too much...
>
> Olivvv
>
> On Thu, Jan 14, 2010 at 12:21 PM, Phaedra  wrote:
> > As subject said, i've tried the new release of jquery in a real single
> > page environnement, and it leaks again and again when trying to remove
> > elements, with or without events attached.
>
> > When i add a node to the dom, it correctly add 1 node instead of 2
> > (older versions of jquery), but when i try to remove it, ie not
> > releasing it from memory.
>
> > Using sieve to test it.


[jQuery] So sad, jquery 1.4rc1 continue to leak in ie7

2010-01-14 Thread Phaedra
As subject said, i've tried the new release of jquery in a real single
page environnement, and it leaks again and again when trying to remove
elements, with or without events attached.

When i add a node to the dom, it correctly add 1 node instead of 2
(older versions of jquery), but when i try to remove it, ie not
releasing it from memory.

Using sieve to test it.



[jQuery] Re: Single page application and jQuery

2009-09-24 Thread Phaedra

I've some news.

The nightly of jquery is not changed in this part (.html())

In the trunk, some changes are done by resig, that resolve the problem
for the .html method, using innerhtml.
So, the clock example is now not leaking at all.

But the .remove methond continue with this:
element.parentNode.removeChild(element), that does not remove the
leaking node in ie7.

I think this is better:

var garbage = document.getElementById("garbage");
if (!garbage) {
garbage = document.createElement("div");
garbage.setAttribute("id", "garbage");
document.body.appendChild(garbage);
}
garbage.appendChild(this);
garbage.innerHTML = "";

What do you think? It's not better to use a generic GC in jquery for
dom elements?
this solve the problem in ie7.

Again, inserting a node into body, using DBJ way does not change
anithing, but in the trunk version the leaks are reduced.

Each time i insert a div node into body, it create 2 nodes into the
dom instead of 1. with garbage code in the remove method,
only one is correctly removed from memory, leaving only one leaking
element.

I hope Mr. Resig can read this post, because he is working on this
recently.




[jQuery] Re: Single page application and jQuery

2009-09-23 Thread Phaedra

> Phaedra, how are you identifying the number of leaked nodes?

I'm using sieve 0.08. I take note of the used nodes in the home page,
then, i open a dialog (jquery), again take note of the nodes.
After closing it they are always there, removed in the dom but
always there in memory. These nodes are free fom events.

Same in the two examples, a blank page with a button with a onclick
event.

I can accept that the clock example was not well formed, but this was
intentionally, apart of caching the selector.
Changing the html inside the div call the "empty" function of jquery,
that does nothing about memory leaks.
So, i agree that .text() was better, but my example was about memory
leaks, not performance. When ie7 number of used nodes grow, it slow
down, making the spa too slow.


[jQuery] Re: Single page application and jQuery

2009-09-23 Thread Phaedra

> Phaedra, how are you identifying the number of leaked nodes?

I'm using sieve 0.08. I take note of the used nodes in the home page,
then, i open a dialog (jquery), again take note of the nodes.
After closing it the nodes are always there, removed in the dom but
always there in memory. These nodes are free of events.

Same in the two examples, a blank page with a button with a onclick
event.

I can accept that the clock example was not well formed, but this was
intentionally, apart of caching of the selector.
Changing the html inside the div call the "empty" function of jquery,
that does nothing about memory leaks.
So, i agree that .text() was better, but my example was about memory
leaks, not performance. Where ie number of used nodes grow, the
browser slow down, making the spa too slow.



[jQuery] Re: Single page application and jQuery

2009-09-22 Thread Phaedra

So, no one looking at this topic? or no one know nothing about?


[jQuery] Jquery uploader script problem

2008-11-14 Thread Phaedra

Hi to all, i've a little problem with this script, i can't make it
works in ie.
The problem is that it always opens a new windows when i submit the
upload form, even if i use the target property to a just created
iframe.

In FF, it will target the iframe as expected.

Can you help me?

Here's the code:

function createIFrame() {
$("")
.attr("id", "uploadFrame")
.attr("name", "uploadFrame")
//.attr("src", "javascript:false") not working
.css("position", "absolute")
.css("visibility", "hidden")
.appendTo("body");
}

function iFrameCallBack(e) {
if ( e ) {
   $("#uploadFrame").load(e);
}
}

function removeIFrame() {
$("#uploadFrame").remove();
}

function insertNewUpload() {
uploadCounter += 1;
// Creating the form for the new file upload
$("")
.appendTo("#allegati")
.attr("action", "upload")
.attr("method", "POST")
.attr("id", "uploadform" + uploadCounter)
.attr("enctype", "multipart/form-data")
.attr("target", "uploadFrame");

// Creating the input for the file
$("")
.appendTo("#uploadform"+uploadCounter)
.attr("name", "file" + uploadCounter)
.attr("size", "50")
.change(function(e) { fileUpload($(this)) });
}

function removeUpload($elm) {
createIFrame();
$elm.parent().submit();
iFrameCallBack(confirmDelete($elm));
removeIFrame();
}

function fileUpload($elm) {
createIFrame();
$elm.parent().submit();
iFrameCallBack(confirmUpload($elm));
removeIFrame();
insertNewUpload();
return false;
}

function confirmDelete($elm) {
$elm.parent().remove();
}

function confirmUpload($elm) {
$elm.parent().css("backgroundColor", "#DFFFDF");

// Creating the remove file button
$("")
.appendTo($elm.parent())
.attr("value", "rimuovi")
.addClass("std_btn")
.css("width", "6em")
.css("font-size", "1em")
.click(function(e) { removeUpload($(this)); });

var s = " "+$elm.val()+"";
var h = "";
$(s).appendTo($elm.parent());
$(h).appendTo($elm.parent());

$elm.remove();
}