Help needed with event testing script

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mark Szlazak

    Help needed with event testing script

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

    RESOLVED (events) in Core - DOM: Events. Last updated 2008-11-13.


    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("scr ollBack ()", 1);
    }

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

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

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

  • Martin Honnen

    #2
    Re: Help needed with event testing script



    Mark Szlazak wrote:
    [color=blue]
    > 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").[/color]

    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

    Comment

    • Mark Szlazak

      #3
      Re: Help needed with event testing script

      Martin Honnen wrote:[color=blue]
      > Mark Szlazak wrote:
      >[color=green]
      > > Apparently there is a textarea onscroll event bubbling bug in[/color][/color]
      Firefox[color=blue][color=green]
      > > 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[/color][/color]
      to[color=blue][color=green]
      > > see if a the event handler works (assigns the "bubbling" variable a
      > > "true").[/color]
      >
      > If script scrolls then I am not sure Mozilla fires the scroll event,[/color]
      it[color=blue]
      > should fire it when the user scrolls. At least for a window a quick[/color]
      test[color=blue]
      > shows that window.scrollTo () doesn't fire the scroll event and even[/color]
      if[color=blue]
      > onscroll worked for textareas then I don't think the scroll event[/color]
      would[color=blue]
      > be fired if script manipulates the scroll settings.
      >
      >
      >
      >
      > --
      >
      > Martin Honnen
      > http://JavaScript.FAQTs.com/[/color]

      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.

      Comment

      • Martin Honnen

        #4
        Re: Help needed with event testing script



        Mark Szlazak wrote:

        [color=blue]
        > Also, do you have any suggestions for checking if the textarea onscroll
        > event in Firefox is working?[/color]

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


        --

        Martin Honnen

        Comment

        • Mark Szlazak

          #5
          Re: Help needed with event testing script


          Martin Honnen wrote:[color=blue]
          > Mark Szlazak wrote:
          >
          >[color=green]
          > > Also, do you have any suggestions for checking if the textarea[/color][/color]
          onscroll[color=blue][color=green]
          > > event in Firefox is working?[/color]
          >
          > That bug you have found has a test case:
          > <https://bugzilla.mozill a.org/show_bug.cgi?id =229089>
          >
          >
          > --
          >
          > Martin Honnen
          > http://JavaScript.FAQTs.com/[/color]

          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.

          Comment

          • Mark Szlazak

            #6
            Re: Help needed with event testing script


            Martin Honnen wrote:[color=blue]
            > Mark Szlazak wrote:
            >[color=green]
            > > Apparently there is a textarea onscroll event bubbling bug in[/color][/color]
            Firefox[color=blue][color=green]
            > > 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[/color][/color]
            to[color=blue][color=green]
            > > see if a the event handler works (assigns the "bubbling" variable a
            > > "true").[/color]
            >
            > If script scrolls then I am not sure Mozilla fires the scroll event,[/color]
            it[color=blue]
            > should fire it when the user scrolls. At least for a window a quick[/color]
            test[color=blue]
            > shows that window.scrollTo () doesn't fire the scroll event and even[/color]
            if[color=blue]
            > onscroll worked for textareas then I don't think the scroll event[/color]
            would[color=blue]
            > be fired if script manipulates the scroll settings.
            >
            >
            >
            >
            > --
            >
            > Martin Honnen
            > http://JavaScript.FAQTs.com/[/color]

            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.getEle mentById('ta');
            ta.value = "";
            ta.onscroll = function () { bubbling = true; }
            if (ta.addEventLis tener) {
            ta.addEventList ener("input",
            function () { if (ta.scrollHeigh t > 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>

            Comment

            Working...