The default bug view has changed. See this FAQ.

selection on a display:none iframe returns different value than WebKit/Opera

NEW
Unassigned

Status

()

Core
Selection
7 years ago
5 years ago

People

(Reporter: Ojan Vafai, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

7 years ago
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
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.
(Reporter)

Comment 2

7 years ago
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.
(Reporter)

Comment 3

7 years ago
Created attachment 464145 [details]
display:none after getting selection

Comment 4

6 years ago
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.
(Reporter)

Comment 5

5 years ago
http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2010-August/027767.html

Comment 6

5 years ago
It appears getSelection no longer exists in HTML5.  I'm not sure what the relevant spec would be.

Comment 7

5 years ago
Found it:
http://dvcs.w3.org/hg/editing/raw-file/tip/editing.html

I've filed:
https://www.w3.org/Bugs/Public/show_bug.cgi?id=15134
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.
You need to log in before you can comment on or make changes to this bug.