Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

range.startContainer - problem in FF

Status
Not open for further replies.

genaweb

Programmer
Oct 15, 2008
2
sorry for my english if it is incorrect, because i'm from russia...

thats my problem:

i get the Selection from iframe (designmode is in ON) by:
var selection = editor_window.getSelection();

then i get Range by
range = selection.getRangeAt(0);

after that i write
start = range.startContainer;

and try to debug the start value by
alert(start.nodeValue);

and it shows the text that is before selection. but not selected text.
i debugged the selection by alert and it contents correctly selected text.

In Opera start variable contents correctly selected text.

why does FF work like this?
 
Hi

I do not really understand what you want or not want.

But are you sure you want the whole [tt]nodeValue[/tt] of the [tt]startContainer[/tt] and not only the part starting at [tt]startOffset[/tt] ?

Feherke.
 
my real problem is in difference of working this code in Opera and FF.

Opera shows me startOffset as 0, but FF shows it as count of symbols BEFORE SELECTION... And so startContainer contents symbols befor selection. But Opera works correct...
 
Hi

[tt]startContainer[/tt] points to the element in which the selection starts. If you take an element's content, you will get the element's content, not a part of the element's content. I would say, Mozillas are doing it correctly.

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top