Detecting if onscroll events working / supported in Firefox

M

Mark Szlazak

Is there a way to detect if an textarea onscroll event is working in
Firefox (or Mozilla). I know that there is an onscroll event bubbling
bug with current vesions of these browsers so I want to detect this
problem with a test like "if (textarea.onscroll == 'undefined' ||
!textarea.onscroll) {}." Any help would be appreciated.
 
M

Mark Szlazak

Mark said:
Is there a way to detect if an textarea onscroll event is working in
Firefox (or Mozilla). I know that there is an onscroll event bubbling
bug with current vesions of these browsers so I want to detect this
problem with a test like "if (textarea.onscroll == 'undefined' ||
!textarea.onscroll) {}." Any help would be appreciated.

I've tried the following code and it seems to work in IE and Firefox on
a Win2k box. Does anyone see problems with it as a test used for
branching to workaround code when a buggy Moz/Firefox browser is being
used?

<html>
<head>
<script>
function isBubbling (ta) {
var bubbling = false, str = '';

ta.onscroll = function () { bubbling = true; }

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

ta.value = "";
return bubbling;
}

onload = function ()
{
var ta = document.getElementById('ta');

if (isBubbling(ta))
{
alert('bubbling');
}
else
{
alert('not bubbling');
}
}
</script>
</head>
<body>
<textarea id="ta" rows=5 cols=40></textarea>
</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top