Bug Tracker

Opened 11 years ago

Closed 10 years ago

#4333 closed bug (invalid)

Jquery Selector and window onload

Reported by: onthefloor Owned by:
Priority: major Milestone: 1.3.2
Component: unfiled Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:

Description

Hi there:

So i updated to 1.3.2 version today, and i found a bug : So when i add function at parameter, this parameter is an function pointer, so when the page was loading i call this function : example:

function addLoadEvent(function_) {

var old= window.onload; document.getElementById("preLoadDiv").style.display = "block"; if (typeof window.onload != 'function') {

window.onload = function_;

} else {

window.onload = function() {

if (old) {

old();

} function_();

}

}

}

And when i was calling : addLoadEvent(function() {

$("#preLoadDiv").hide("slow"); });

It was work perfectly in 1.3.1 version, please fix it, thank you. My pages use that function.

Attachments (3)

test.html (825 bytes) - added by onthefloor 11 years ago.
example html
jquery-1.3.2.js (55.9 KB) - added by onthefloor 11 years ago.
jquery-1.3.1.js (54.0 KB) - added by onthefloor 11 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 11 years ago by onthefloor

I forgot the essence. The #preLoadDiv layout was changing the display option to block, but when the page was loaded, the layout wasnt changing to hide.

comment:2 Changed 11 years ago by dmethvin

Can you put together a complete example with html and script? The snippet you have there isn't clearly showing a problem.

Changed 11 years ago by onthefloor

Attachment: test.html added

example html

Changed 11 years ago by onthefloor

Attachment: jquery-1.3.2.js added

Changed 11 years ago by onthefloor

Attachment: jquery-1.3.1.js added

comment:3 Changed 11 years ago by onthefloor

Hi, I attached an example html file. Try it first with the 1.3.2 version, then with the 1.3.1

Have you got an idea ?

comment:4 Changed 10 years ago by dmethvin

Resolution: invalid
Status: newclosed

That is a really bad way to chain event handlers. Instead of addLoadEvent, just use $(document).load() or $(document).ready().

Note: See TracTickets for help on using tickets.