468,288 Members | 1,971 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,288 developers. It's quick & easy.

Help needed with event testing script

Apparently there is a textarea onscroll event bubbling bug in Firefox
and Mozilla:

https://bugzilla.mozilla.org/show_bug.cgi?id=229089

I'm trying to check for this bug with the following script and it
*seems* to work. In IE it reports "bubbling" and in Firefox "not
bubbling" but I really have no direct way to confirm the Firefox
results until the bubbling bug is fixed.

Basically the test script assigns an onscroll event handler to a
textarea and then scrolls the textarea down then back up, checking to
see if a the event handler works (assigns the "bubbling" variable a
"true").

I had to code things with a few settimeouts otherwise Firefox, unlike
IE, wouldn't display the down then back up scrolling of the textarea.
Which may have been a problem.

Lacking a "debugged" Firefox browser, is there some further (indirect?)
tests and/or rational that would support or discredit this script as a
valid onscroll event check?

<html>
<head>
<script>
var bubbling, ta;

function checkBubbling () {
var str = '';
bubbling = false;
ta.onscroll = function () { bubbling = true; }

for (var i=0; i <= ta.rows; i++) str += '\n';
ta.value = str;
ta.scrollTop = ta.scrollHeight;

setTimeout("scrollBack ()", 1);
}

function scrollBack () {
ta.scrollTop = 0;
setTimeout("resetAndReport ()", 1);
}

function resetAndReport () {
ta.value = "";
if (bubbling)
{
alert('bubbling');
}
else
{
alert('not bubbling');
}
}

onload = function ()
{
ta = document.getElementById('ta');
ta.value = "";
checkBubbling();
}
</script>
</head>
<body>
<textarea id="ta" rows=5 cols=40></textarea>
</body>
</html>

Jul 23 '05 #1
5 1713


Mark Szlazak wrote:
Apparently there is a textarea onscroll event bubbling bug in Firefox
and Mozilla:

https://bugzilla.mozilla.org/show_bug.cgi?id=229089

I'm trying to check for this bug with the following script and it
*seems* to work. In IE it reports "bubbling" and in Firefox "not
bubbling" but I really have no direct way to confirm the Firefox
results until the bubbling bug is fixed.

Basically the test script assigns an onscroll event handler to a
textarea and then scrolls the textarea down then back up, checking to
see if a the event handler works (assigns the "bubbling" variable a
"true").


If script scrolls then I am not sure Mozilla fires the scroll event, it
should fire it when the user scrolls. At least for a window a quick test
shows that window.scrollTo() doesn't fire the scroll event and even if
onscroll worked for textareas then I don't think the scroll event would
be fired if script manipulates the scroll settings.


--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
Martin Honnen wrote:
Mark Szlazak wrote:
Apparently there is a textarea onscroll event bubbling bug in Firefox and Mozilla:

https://bugzilla.mozilla.org/show_bug.cgi?id=229089

I'm trying to check for this bug with the following script and it
*seems* to work. In IE it reports "bubbling" and in Firefox "not
bubbling" but I really have no direct way to confirm the Firefox
results until the bubbling bug is fixed.

Basically the test script assigns an onscroll event handler to a
textarea and then scrolls the textarea down then back up, checking to see if a the event handler works (assigns the "bubbling" variable a
"true").
If script scrolls then I am not sure Mozilla fires the scroll event,

it should fire it when the user scrolls. At least for a window a quick test shows that window.scrollTo() doesn't fire the scroll event and even if onscroll worked for textareas then I don't think the scroll event would be fired if script manipulates the scroll settings.


--

Martin Honnen
http://JavaScript.FAQTs.com/


OK, with regard to textarea scripts firing onscroll events, why is
there this difference between IE and Firefox?

Also, do you have any suggestions for checking if the textarea onscroll
event in Firefox is working?

Thanks. Mark.

Jul 23 '05 #3


Mark Szlazak wrote:

Also, do you have any suggestions for checking if the textarea onscroll
event in Firefox is working?


That bug you have found has a test case:
<https://bugzilla.mozilla.org/show_bug.cgi?id=229089>
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #4

Martin Honnen wrote:
Mark Szlazak wrote:

Also, do you have any suggestions for checking if the textarea onscroll event in Firefox is working?


That bug you have found has a test case:
<https://bugzilla.mozilla.org/show_bug.cgi?id=229089>
--

Martin Honnen
http://JavaScript.FAQTs.com/


Yes! It demonstrates the bug but provides no work-around.
I was hoping for bug detection without browser version detection but no
luck ... I guess.

Mark.

Jul 23 '05 #5

Martin Honnen wrote:
Mark Szlazak wrote:
Apparently there is a textarea onscroll event bubbling bug in Firefox and Mozilla:

https://bugzilla.mozilla.org/show_bug.cgi?id=229089

I'm trying to check for this bug with the following script and it
*seems* to work. In IE it reports "bubbling" and in Firefox "not
bubbling" but I really have no direct way to confirm the Firefox
results until the bubbling bug is fixed.

Basically the test script assigns an onscroll event handler to a
textarea and then scrolls the textarea down then back up, checking to see if a the event handler works (assigns the "bubbling" variable a
"true").
If script scrolls then I am not sure Mozilla fires the scroll event,

it should fire it when the user scrolls. At least for a window a quick test shows that window.scrollTo() doesn't fire the scroll event and even if onscroll worked for textareas then I don't think the scroll event would be fired if script manipulates the scroll settings.


--

Martin Honnen
http://JavaScript.FAQTs.com/


If the user has to scroll the textarea to get a fire from onscroll in a
bugfree firefox then what about user inputs that show the scrollbars
once enough lines are entered into the textarea. I'm thinking about a
script something like this:

<html>
<head>
<script>
var bubbling, ta;

onload = function ()
{
bubbling = false;
ta = document.getElementById('ta');
ta.value = "";
ta.onscroll = function () { bubbling = true; }
if (ta.addEventListener) {
ta.addEventListener("input",
function () { if (ta.scrollHeight > ta.clientHeight)
{
if (bubbling)
{
window.status = 'bubbling';
}
else
{
window.status = 'not bubbling';
}
}
},
false);
}
}
</script>
</head>
<body>
<textarea id="ta" rows=5 cols=40></textarea>
</body>
</html>

Jul 23 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Gonçalo Rodrigues | last post: by
1 post views Thread by Pekka Niiranen | last post: by
8 posts views Thread by Johnny Knoxville | last post: by
7 posts views Thread by Mike | last post: by
7 posts views Thread by mike | last post: by
5 posts views Thread by Andrew | last post: by
2 posts views Thread by rookiejavadude | last post: by
53 posts views Thread by souporpower | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.