Exception thrown in KHTMLPart::selection()

John Tapsell john at geola.co.uk
Fri Dec 31 15:48:18 GMT 2004


Hi all,
  There's a function selection()  which returns a DOMRange:

DOM::Range KHTMLPart::selection() const

(kdelibs/khtml/khtml_part.cpp)

  I use it to get a domrange for the text the user selects, then I turn this 
into html.  This works fine, but if the end of your selection is an image 
(and probably any non-text element), it throws an exception.

  Is there any one that can advise me about whether I can change the nature of 
this function, or what to do?  I really don't know this code that well.

I have my clipboard copy  code in cvs, currently disabled, because of this 
crash :(

To enable the clipboard code, and test the crash, uncomment the marked line 
in:
QString KHTMLPart::selectedTextAsHTML() const

Any help at all is appreciated.

JohnFlux





More information about the kfm-devel mailing list