Discuss general web development related issues. For Opera bugs, use the Bug Report Wizard: https://bugs.opera.com/wizard/. For Opera feature requests and queries, use Desktop wish-list: http://my.opera.com/community/forums/forum.dml?id=24.
By zim32
Saturday, 24. October 2009, 16:10:49

range object
Hello everyone. Can you tell me where i can find information about range object (it's properties and methods). I have a working Javascript code in Firefox, but it's not working in Opera 10. Thanks very much
By JeroenH
Sunday, 25. October 2009, 13:53:16

The
standard itself documents all standard properties. If something is not working, we can't help you without an example: we need a full document or, preferably, a minimal test case.
By zim32
Sunday, 25. October 2009, 17:21:24

W3C is good ). I've changed my code. Now it's working but i have some trouble (in opera) using this peace of code (this is a part of code which is doing some formatting stuff with selected text inside content editable div)
next_element = bound_element.nextSibling; //bound_element is span, next_element seems to be text node
new_range = document.createRange();
new_range.setStart(sel_range.startContainer,sel_range.startOffset);//sel_range - previous selection
new_range.setEnd(next_element,0);
new_range.surroundContents(newNode);
newNode.style.fontWeight = "bold";
After using this part of code all is working fine but opera doesn't respond for 5-10 seconds. Finally newNode appears. Where is the problem? Thanks!
By JeroenH
Monday, 26. October 2009, 10:05:06

Without more context about "bound_element", it's still not possible to help you any further. Where does it come from?
Wrapping just the selection with new_node works fine for me.
Also, the W3C Range api is horrible, for one specific reason: surroundContents. It throws BAD_BOUNDARYPOINTS_ERR for its main use case.
Did you look at the execCommand api in html5?
By zim32
Monday, 26. October 2009, 11:32:22

I know that opera doesn't support execCommand... Am i wrong?
"Also, the W3C Range api is horrible, for one specific reason: surroundContents. It throws BAD_BOUNDARYPOINTS_ERR for its main use case." that is why i have to use nextSibling. And after using nextSibling i have a problem discribed earlier.
Post edited Monday, 26. October 2009, 11:48:25
By JeroenH
Monday, 26. October 2009, 12:37:08

Originally posted by zim32:
I know that opera doesn't support execCommand... Am i wrong?
Opera does
support it since Opera 9, although the clipboard functions aren't supported.
Originally posted by zim32:
And after using nextSibling i have a problem discribed earlier.
I haven't been able to reproduce that. Your code always fails with the exception, because your range starts in the startContainer and ends in the next_element. It should end at the end of startContainer if you want to avoid the exception. Without knowing how you get bound_element, we can't get any further.