Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Converting Selection to a Range



On May 10, 2005, at 12:33 AM, Paul Ossenbruggen wrote:

In Safari 1.3+, how do you convert a selection retrieved from window.getSelection() to a Range as specified in DOM 2 Ranges? In Mozilla you use getRangeAt() and in IE you use selection.createRange (). It seems that neither is supported with Safari. I was unable to find the W3C DOM way of doing it either. If I use createRange on the document I get an initialized textRange but not one that represents the selection. Safari documentation on this is sparse. Am I missing something obvious?

We should really support both of those!

Unfortunately, Safari 1.3 doesn't support either. But I suggest you try using selection.type to find out the type and then selection.baseNode, selection.baseOffset, selection.extentNode, and selection.extentOffset to get the four values you need to create a range.

    -- Darin

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webcore-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webcore-dev/email@hidden

This email sent to email@hidden
References: 
 >Converting Selection to a Range (From: Paul Ossenbruggen <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.