Closed
Bug 357524
Opened 19 years ago
Closed 19 years ago
window.getSelection.focusNode does not always return correct active input element
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 336936
People
(Reporter: dgl-mozilla, Unassigned)
References
()
Details
(Keywords: regression)
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20060601 Firefox/2.0 (Ubuntu-edgy)
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.8.1) Gecko/20061010 Firefox/2.0
Return value from window.getSelection() is not always updated correctly.
Reproducible: Always
Steps to Reproduce:
1. Load http://dgl.cx/2006/10/selection.html
2. Click on first text input
3. Hit enter
Actual Results:
Error that window.getSelection() is null
Expected Results:
Returns current selected text input.
It works as expected when keyboard is used (e.g. tab key to change active item), it does not work when the active item is changed via mouse. It also works if I change to a different tab and back again.
This seems to be a regression on Firefox 2.0rc3 - it works on Firefox 1.5 for me.
Comment 1•19 years ago
|
||
The actual error is: Error: window.getSelection().focusNode has no properties.
This is definitely a focus issue. I made a testcase that calls focus() on the element and simulates a kepress. This works initially, and also works when using the steps to reproduce in comment 0.
This regressed between 2006-07-19-04 and 2006-07-20-04. Check-ins: http://bonsai.mozilla.org/cvsquery.cgi?treeid=default&module=PhoenixTinderbox&branch=MOZILLA_1_8_BRANCH&branchtype=match&dir=&file=&filetype=match&who=&whotype=match&sortby=Date&hours=2&date=explicit&mindate=2006-07-19+03&maxdate=2006-07-20+05&cvsroot=%2Fcvsroot
I'm almost 100% this is a regression from bug 310241.
Assignee: nobody → general
Blocks: 310241
Status: UNCONFIRMED → NEW
Component: General → DOM
Ever confirmed: true
Keywords: regression
Product: Firefox → Core
QA Contact: general → ian
Summary: window.getSelection does not always return correct active input element → window.getSelection.focusNode does not always return correct active input element
Version: unspecified → 1.8 Branch
Comment 2•19 years ago
|
||
I guess killing the |else| in nsEventStateManager::ChangeFocusWith had some results other than what Mats mentioned in bug 310241 comment 20.
Comment 3•19 years ago
|
||
This reminds me of bug 336936.
Comment 4•19 years ago
|
||
The given example URL does not work in Opera, Safari or IE7 either,
so there's no compat issue to consider.
Selection has very little to do with focus, see bug 336936 comment 16
and forward.
If the example you gave represents the problem you're trying to solve,
then you could use the event to get the element:
var elm = event.srcElement ? event.srcElement : event.target;
alert(elm.id);
*** This bug has been marked as a duplicate of 336936 ***
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•