Scrolling the text in the box with javascript is not working

RESOLVED INCOMPLETE

Status

()

Core
DOM: Core & HTML
RESOLVED INCOMPLETE
15 years ago
9 years ago

People

(Reporter: bhaskar_seth, Unassigned)

Tracking

Trunk
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

15 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3) Gecko/20030308
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3) Gecko/20030308

In http://www.arte-tv.com/dossier/dossier.jsp?refresh=false&node=177826&lang=de
you can't scroll the text down with the scrollbar, which appears in the box. It
shows as a Tooltip "Scroll down" but it is not working, in the Status-Bar it
displays: Javascript: void(0)

Reproducible: Always

Steps to Reproduce:
1. Load the page
2. Try to scroll down the text in the box on the left side
3.

Actual Results:  
Couldn't scroll down the text.

Expected Results:  
Should have scrolled down the text in the box.

Comment 1

15 years ago
Confirming bug with Mozilla trunk binary 2003022808 on WinNT.

The main file to look at is http://www.arte-tv.com/commun/scroll.js,
which contains this function:


// *** DIV SCROLLING FUNCTION ***
function scrScrollBy(amount)
{
  with (this)
  {
        etc.
        etc.


    divHeight = document.all ? divRef.clientHeight : 
                (isDOM ? divRef.offsetHeight : divRef.document.height);


    // Are we scrolling out of range? If so, return to top/bottom.
    if ((cBot + amount) > divHeight) amount = divHeight - cBot;
    if ((cTop + amount) < 0) amount = 0 - cTop;


        etc.
        etc.
  }
}


The |this| variable is a "DHTMLScroller" object, created from
scroll.js, and it has many object properties. The |this.divRef|
property, for example, is a reference to an element in the HTML.
Example: |this.divRef| = document.getElementById('mainContentDiv').


In IE6, |document.all| evaluates to |true|, so the above code sets 
|this.divHeight| to |this.divRef.clientHeight| and plugs it into
the above formuas to see whether the scroll is out of range or not.

In Mozilla, |document.all| evaluates to |false| and the flag |isDOM|
is |true|, so the code sets |this.divHeight| to |this.divRef.offsetHeight|
and plugs this into the formulas.


Unfortunately, we get different values for |this.divRef.offsetHeight|
vis-à-vis |this.divRef.clientHeight|. The result is that in Mozilla,
the scroll is  determined to be out of range. The code then ensures
that that no scroll occurs; which is why nothing happens in Mozilla.

Specifically, in Mozilla |amount| is set to 0 by the formulas above.
The scroll movement is by |amount|, so nothing happens in Mozilla.
Status: UNCONFIRMED → NEW
Ever confirmed: true

Comment 2

15 years ago
This has nothing to do with JavaScript Engine. This may simply be due
to the site misusing the |offsetHeight| attribute in Mozilla, or it may
be a bug on our part. Reassigning to DOM experts for further analysis.

Here are some useful javascript:URLs to debug with.
After loading the site, try
                                                                               
                                                                               
                          IE6     Moz
javascript:alert(mainDiv.cTop)                                 0       0
javascript:alert(mainDiv.cBot);                               259     259
javascript:alert(mainDiv.divHeight);                          2002    170
javascript:alert(getRef(mainDiv.divs[0][0]).offsetHeight);    2002    170
javascript:alert(getRef(mainDiv.divs[0][0]).offsetTop);       127     127        
javascript:alert(getRef(mainDiv.divs[1][0]).offsetTop);       138     138
javascript:alert(getRef(mainDiv.divs[1][0]).offsetHeight);    237     237     
javascript:alert(getRef(mainDiv.divs[0][0]).clientHeight);    2002     0


Notice the occasional conflicts:  2002 vs. 170 is the main one for us.
These javascript:URLs may also be helpful:

javascript:var div=document.getElementById('mainContentDiv');
javascript:alert(div.offsetHeight);
javascript:alert(div.style.clip);


In IE6, you can scroll the main div by using this URL:

javascript: void(mainDiv.scrollBy(100));

But in Mozilla nothing will happen, since the scrollBy() method
is just an alias of the scrScrollBy() function analyzed above -
Assignee: rogerl → jst
Component: JavaScript Engine → DOM Level 0
QA Contact: pschwartau → ashishbhatt
Mass-reassigning bugs to dom_bugs@netscape.com
Assignee: jst → dom_bugs
URL is 404.  Site seems to have been redesigned.  Please file a new bug
report if the problem still occurs in Firefox 3.

-> INCOMPLETE
Status: NEW → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.