WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
13399
Support document.getSelection()
https://bugs.webkit.org/show_bug.cgi?id=13399
Summary
Support document.getSelection()
Justin Garcia
Reported
2007-04-18 17:35:56 PDT
<
rdar://problem/3138411
> MASTER: document.getSelection() and document.selection window.getSelection() is the most common way to access the selection object, followed by document.getSelection() followed by document.selection. All three return a selection object, that supports various methods/properties depending on what browser the user is running. We support window.getSelection(), but it would probably be a good idea for us to add document.getSelection() and document.selection, for compatibility.
Attachments
Add attachment
proposed patch, testcase, etc.
Justin Garcia
Comment 1
2008-01-29 20:18:46 PST
The original radar, <
rdar://problem/3138411
>, was accidently closed. Opened: <
rdar://problem/5714333
> Add document.getSelection() and document.selection
Justin Garcia
Comment 2
2008-02-21 16:34:49 PST
I don't think we want to add support for document.selection. This is an IE specific extention and their selection object is too different than Safari's or FF's. In a few of the dupes of <
rdar://problem/3138411
> I see code like this: <a href="javascript:bm=document.selection?document.selection.createRange().text:document.getSelection();void(pmentry=window.open('
http://jens.apple.com/pm/index.php?m=bookmarklet&p=new&title='+escape(document.title)+'&url='+escape(window.location.href)+'&body='+escape(bm),'pmentry','width=700,height=520,toolbar=0,status=1,location=0,scrollbars=1,menubar=1,resizable=1
'))">pMachineBM</a> If we added support for document.selection we'd fall into the IE specific code path, which has us calling more IE specific extentions that neither Safari nor FF supports (selection.createRange() for example returns a TextRange object, not a DOM Range object, which has all sorts of IE specific extentions). Perhaps at a later time if we extend DOM Range to support more methods we can implement document.selection. I think that for now, supporting code that works in FF is good enough.
Alexey Proskuryakov
Comment 3
2008-02-22 23:19:30 PST
Fixed by Justin in <
http://trac.webkit.org/projects/webkit/changeset/30515
>.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug