Last Comment Bug 585229 - selection on a display:none iframe returns different value than WebKit/Opera
: selection on a display:none iframe returns different value than WebKit/Opera
Status: NEW
:
Product: Core
Classification: Components
Component: Selection (show other bugs)
: unspecified
: x86 Mac OS X
: -- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-08-06 17:15 PDT by Ojan Vafai
Modified: 2012-01-10 12:16 PST (History)
4 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
test case (237 bytes, text/html)
2010-08-06 17:15 PDT, Ojan Vafai
no flags Details
display:none after getting selection (396 bytes, text/html)
2010-08-09 13:22 PDT, Ojan Vafai
no flags Details

Description Ojan Vafai 2010-08-06 17:15:20 PDT
Created attachment 463717 [details]
test case

See attachment. At first glance, the WebKit/Opera behavior seems more consistent. It matches what you would get in a visible iframe that had no selection in it.

Equivalent webkit bug: https://bugs.webkit.org/show_bug.cgi?id=43655
Comment 1 Boris Zbarsky [:bz] 2010-08-09 08:18:36 PDT
Gecko's selection objects are tied to a presentation; there simply isn't one in a display:none iframe.  In particular, you can't select text in such an iframe programmatically, unlike a visible iframe.
Comment 2 Ojan Vafai 2010-08-09 13:22:12 PDT
That kind of makes sense to me, but if you get the selection and then display:none the iframe, you end up in the same situation (have a Selection object inside a display:none iframe). So you still need to deal with that case anyways.

Again, I don't feel strongly about this, but I slightly prefer the consistency of the webkit/opera approach. I'll bring this up on whatwg.
Comment 3 Ojan Vafai 2010-08-09 13:22:30 PDT
Created attachment 464145 [details]
display:none after getting selection
Comment 4 David Karger 2011-09-15 21:15:29 PDT
The buggy function, getSelection(), isn't mentioned anywhere in this bug, so it doesn't show up in search results.

While you are deciding what the proper behavior is, I think it would be helpful to update the mozilla developer docs on the function: https://developer.mozilla.org/en/DOM/window.getSelection asserts that the function always returns a selection object, which does not reflect the current behavior when display:none is in effect.
Comment 6 Eric Seidel 2011-12-09 15:44:10 PST
It appears getSelection no longer exists in HTML5.  I'm not sure what the relevant spec would be.
Comment 8 Aryeh Gregor (:ayg) (working until September 1) 2012-01-10 12:16:23 PST
IE, Webkit, and Opera all seem to agree that every Window has a Selection.  This is what the spec says too.  Gecko's behavior is more complicated and in the minority, so I haven't changed the spec.

Note You need to log in before you can comment on or make changes to this bug.