selectionStart / selectionEnd and FF 1.0pr

S

snoopy

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

bodytext = (document.all) ?
document.selection.createRange().text:document.getSelection();
if (selectedtext.createTextRange) {
selectedtext.caretPos = document.selection.createRange().duplicate();
}
else if (document.postform.body.setSelectionRange){
bodytext =
document.postform.body.value.substring(document.postform.body.selectionStart
,document.postform.body.selectionEnd)
}

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
 
M

Martin Honnen

snoopy wrote:

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

bodytext = (document.all) ?
document.selection.createRange().text:document.getSelection();
if (selectedtext.createTextRange) {
selectedtext.caretPos = document.selection.createRange().duplicate();
}
else if (document.postform.body.setSelectionRange){
bodytext =
document.postform.body.value.substring(document.postform.body.selectionStart
,document.postform.body.selectionEnd)
}

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?

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

snoopy

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.....
 
R

Randy Webb

snoopy said:
Ahh - sorted.
The useragent wasnt being detected correctly.

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

Seems 1.0pr is detected as firefox 0.10 (and not 1.0) for some wierd
reason.....

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

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
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top