Defect #938
Do not use window.onload
| Status: | 却下(Invalid) | Start date: | 02/01/2012 | |
|---|---|---|---|---|
| Priority: | 通常(Normal) | Due date: | ||
| Assignee: | % Done: | 100% |
||
| Category: | - | Spent time: | - | |
| Target version: | - |
Description
Using window.onload breaks other plugins. Please use Event.observe(window, 'load', function(){ codeHere; }); instead. Thanks!
History
#1
Updated by Haru Iida 4 months ago
Hi.
What plugin are you talking about?
We have many plugins in this site.
#2
Updated by Scott Duensing 4 months ago
Basically anything else that uses window.onload is going to have issues. redmine_git_hosting was the one I had problems with. It also was using window.onload directly (but has since been fixed). Only one method can be assigned to window.onload. Without looking for an existing method to be there and then chaining to it after your own is called, bad things can happen. That is what Event.observe is designed to prevent. See: http://www.prototypejs.org/api/event/observe
Thanks for your plugin!
#3
Updated by Haru Iida 4 months ago
I mean, what plugin did you find this problem?
Code review? Wiki Extensions? Worktime? or else?
We are developing many plugins by many developers.
I want to know who should be assigned this issue.
#4
Updated by Scott Duensing 4 months ago
Oh! I misunderstood. It was in Code Review.
#5
Updated by Haru Iida 4 months ago
- Project changed from r-labs to Code Review
- Assignee set to Haru Iida
Thanks.
I will check my code.
#7
Updated by Haru Iida 4 months ago
I searched "window.onload" in my codes but I couldn't find it.
Which file did you find it?
#8
Updated by Scott Duensing 4 months ago
Arrrgh! Sorry! I went back to look a second time and it seems I was wrong. It's not your plugin causing the problem - it appears to be part of Redmine itself. I'll follow up with them.
Sorry for the confusion and wasting your time. Thanks again for the plugin!