Closed Bug 309996 Opened 19 years ago Closed 19 years ago

optgroup tag in page causes onscroll event not to fire.


(Core :: DOM: Events, defect)

Windows XP
Not set





(Reporter: brieb, Unassigned)



(2 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7

When doing some javascript prgramming with window.onscroll, my test pages were
not working.  Upon eliminating code to get the onscroll to work, I found that it
was the presence of the <optgroup> tag that broke the onscroll from triggering.

Reproducible: Always

Steps to Reproduce:
1. Create a document with <BODY onScroll="javascript:alert('foo')> 
2. Add a <select> element that has two <option> elements
3. encapsulate one of the options in a <optgroup>

Actual Results:  
onscroll did not trigger

Expected Results:  
onscroll should have triggered when i scrolled

Tested and confirmed on both win and mac firefoxes.  My document file
essentially looked like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<body onscroll="javascript:alert('here');">
 <SELECT name="ComOS">
     <OPTION selected label="none" value="none">None</OPTION>

     <OPTGROUP label="PortMaster 3">
       <OPTION label="3.7.1" value="pm3_3.7.1">PortMaster 3 with ComOS
 </SELECT><br />

Test text<br/>
Test text<br/>
Test text<br/>
Test text<br/>
Test text<br/>

When I took the optgroup tags out... it worked.
Please verify this in the latest beta, the onscroll event handling was more or
less rewritten during the alphas. 
With Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20050924
Firefox/1.6a1 ID:2005092412 I see the same thing: scrolling the page in the w/no
optgroup testcase fires body.onscroll, scrolling the page in the w/optgroup
testcase doesn't.
Assignee: nobody → events
Component: General → DOM: Events
Product: Firefox → Core
QA Contact: general → ian
Version: unspecified → Trunk
I got exactly the same problem with the newest Firefox Final Release under both Windows Me and Suse Linux 8.2:
Mozilla/5.0 (Windows; U; Win 9x 4.90; de; rv:1.8) Gecko/20051111 Firefox/1.5
Mozilla/5.0 (X11; U; Linux i686; de; rv:1.8) Gecko/20051111 Firefox/1.5
This still occurs in Firefox release. 

I just wasted a lot of time spotting it! Weirdest bug I've seen in a while.

I haven't been able to find a workaround (except removing the optgroup), other than changing my script to use a timer to check scroll position. This is somewhat less than ideal.

It doesn't matter how you set onscroll (body onscroll=, window.onscroll=, or window.addEventListener); none are called.

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20060111 Firefox/

(Note to those who don't know: please vote for this bug. I believe that after a certain number of votes (3?) it gets confirmed automatically, which would be the first step towards any developer having a chance of seeing it.)
Bug 305160 fixed this; the fix will be in Firefox 2.

*** This bug has been marked as a duplicate of 305160 ***
Closed: 19 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.