selectionStart / selectionEnd and FF 1.0pr

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

    #1

    selectionStart / selectionEnd and FF 1.0pr

    Hi,
    Previously I have this code working in FF 0.9 in a web forum :

    bodytext = (document.all) ?
    document.select ion.createRange ().text:documen t.getSelection( );
    if (selectedtext.c reateTextRange) {
    selectedtext.ca retPos = document.select ion.createRange ().duplicate();
    }
    else if (document.postf orm.body.setSel ectionRange){
    bodytext =
    document.postfo rm.body.value.s ubstring(docume nt.postform.bod y.selectionStar t
    ,document.postf orm.body.select ionEnd)
    }

    With the advent of FF 1.0, this is now broken and returns bodytext as blank.
    Does anyone know of any changes in the scripting that would have caused this
    or suggest a remedy?

    Cheers


  • Martin Honnen

    #2
    Re: selectionStart / selectionEnd and FF 1.0pr



    snoopy wrote:

    [color=blue]
    > Previously I have this code working in FF 0.9 in a web forum :
    >
    > bodytext = (document.all) ?
    > document.select ion.createRange ().text:documen t.getSelection( );
    > if (selectedtext.c reateTextRange) {
    > selectedtext.ca retPos = document.select ion.createRange ().duplicate();
    > }
    > else if (document.postf orm.body.setSel ectionRange){
    > bodytext =
    > document.postfo rm.body.value.s ubstring(docume nt.postform.bod y.selectionStar t
    > ,document.postf orm.body.select ionEnd)
    > }
    >
    > With the advent of FF 1.0, this is now broken and returns bodytext as blank.
    > Does anyone know of any changes in the scripting that would have caused this
    > or suggest a remedy?[/color]

    What kind of element is document.postfo rm.body, a <textarea>, an <input
    type="text">, an <input type="password" >?
    Do you have a test case where it fails?


    --

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

    Comment

    • snoopy

      #3
      Re: selectionStart / selectionEnd and FF 1.0pr

      Ahh - sorted.
      The useragent wasnt being detected correctly.
      Seems 1.0pr is detected as firefox 0.10 (and not 1.0) for some wierd
      reason.....


      "Martin Honnen" <mahotrash@yaho o.de> wrote in message
      news:414d6c44$0 $26100$9b4e6d93 @newsread4.arco r-online.net...[color=blue]
      >
      >
      > snoopy wrote:
      >
      >[color=green]
      > > Previously I have this code working in FF 0.9 in a web forum :
      > >
      > > bodytext = (document.all) ?
      > > document.select ion.createRange ().text:documen t.getSelection( );
      > > if (selectedtext.c reateTextRange) {
      > > selectedtext.ca retPos = document.select ion.createRange ().duplicate();
      > > }
      > > else if (document.postf orm.body.setSel ectionRange){
      > > bodytext =
      > >[/color][/color]
      document.postfo rm.body.value.s ubstring(docume nt.postform.bod y.selectionStar t[color=blue][color=green]
      > > ,document.postf orm.body.select ionEnd)
      > > }
      > >
      > > With the advent of FF 1.0, this is now broken and returns bodytext as[/color][/color]
      blank.[color=blue][color=green]
      > > Does anyone know of any changes in the scripting that would have caused[/color][/color]
      this[color=blue][color=green]
      > > or suggest a remedy?[/color]
      >
      > What kind of element is document.postfo rm.body, a <textarea>, an <input
      > type="text">, an <input type="password" >?
      > Do you have a test case where it fails?
      >
      >
      > --
      >
      > Martin Honnen
      > http://JavaScript.FAQTs.com/[/color]


      Comment

      • Randy Webb

        #4
        Re: selectionStart / selectionEnd and FF 1.0pr

        snoopy wrote:
        [color=blue]
        > Ahh - sorted.
        > The useragent wasnt being detected correctly.[/color]

        It very seldom is, and this is just another case to back up the object
        detection route instead of browser detection.

        [color=blue]
        > Seems 1.0pr is detected as firefox 0.10 (and not 1.0) for some wierd
        > reason.....[/color]

        Because you are relying on an unreliable method to determine it.


        --
        Randy
        comp.lang.javas cript FAQ - http://jibbering.com/faq

        Comment

        • Thomas 'PointedEars' Lahn

          #5
          Re: selectionStart / selectionEnd and FF 1.0pr

          snoopy wrote:
          [color=blue]
          > Ahh - sorted.
          > The useragent wasnt being detected correctly.
          > Seems 1.0pr is detected as firefox 0.10 (and not 1.0) for some wierd
          > reason.....
          > [...]
          > [top post][/color]

          <http://pointedears.de/scripts/test/whatami>
          <http://jibbering.com/faq/>


          PointedEars
          --
          Stop Repeat Offenders. (Quit re-electing them.)

          Comment

          Working...