Closed
Bug 437672
Opened 17 years ago
Closed 16 years ago
iframe.contentDocument.getSelection() reports selection when nothing is if BR element is on the line
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: douglas, Unassigned)
References
()
Details
(Keywords: regression)
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en_US; rv:1.9) Gecko/2008051909 (Gentoo) Firefox/3.0
Build Identifier: Mozilla/5.0 (X11; U; Linux x86_64; en_US; rv:1.9) Gecko/2008051909 (Gentoo) Firefox/3.0
In Firefox 3 (tested in RC1 and RC2 on mac and linux, didn't exist in FF2), the getSelection function is returning from cursor to the end of the page as a selection, even when nothing is selected
Reproducible: Always
Steps to Reproduce:
1.Go to URL http://xinha.gogo.co.nz/xinha-nightly/examples/ExtendedDemo.html
2. Go to HTML source view of Xinha (click the third icon from the right, looks like a page with angle brackets)
3. Paste the following HTML "General Resources<br />
<h3>mailing lists</h3>"
4. Go back to document view (re-click the same icon)
5. Now click the end of the first line and hit the enter key. The text of the second line will disapper.
Actual Results:
The second line has disappeared, since getselection reports a selection to the end of the iframe
Expected Results:
an inserted line, becuase there is no selection
This happens because a getSelection is performed to see if the user is attempting to replace text, which is reporting a selection starting at the cursor and continuing to the end of the iframe. That select is then replace with a newline (the enter key) and so the line disappears. In Firefox 2, javascript correctly reports an empty selection
Reporter | ||
Updated•16 years ago
|
Severity: major → blocker
Version: unspecified → 3.0 Branch
Reporter | ||
Updated•16 years ago
|
Flags: blocking-firefox3?
Comment 1•16 years ago
|
||
--> Core::DOM
Severity: blocker → major
Component: General → DOM
Flags: blocking-firefox3?
Keywords: regression
Product: Firefox → Core
QA Contact: general → general
Version: 3.0 Branch → 1.9.0 Branch
Comment 2•16 years ago
|
||
This will not block the final release of Firefox 3.0. A patch with tests may be considered for a 3.0.x release.
Flags: blocking1.9.0.1?
Flags: blocking1.9-
Reporter | ||
Comment 3•16 years ago
|
||
Regression happened between the two nightly builds:
WORKING -> 2006-10-21-06-trunk
BROKEN -> 2006-10-22-05-trunk
WORKING -> ftp://ftp.mozilla.org/pub/firefox/nightly/2006/10/2006-10-21-06-trunk/firefox-3.0a1.en-US.mac.dmg
BROKEN -> ftp://ftp.mozilla.org/pub/firefox/nightly/2006/10/2006-10-22-05-trunk/firefox-3.0a1.en-US.mac.dmg
The test case is WFM. I couldn't make anything funny happen no matter where I pasted that text. Douglas, could you clarify these steps any? Do I have to paste that text in a particular place?
Reporter | ||
Comment 6•16 years ago
|
||
I can reproduce the test case every time on many computers... You have to go to HTML mode before inserting the text, then return to document mode, but upon further inspection, the algorithm behind this page is so poorly written that I've come to believe it's miswritten, and is just dependent on the behavior pre-Firefox3, even if that behavior is wrong. I looked at the code differences in Firefox, and it's a change in nsRange.cpp which looks like it is a valid change (Before, trying to create a range in reverse resulted in an invalid range. Now, trying to create a range in reverse collapses the range... I see this as valid behavior, but I was hoping to wait till the end of the week to finish my testing...
Comment 7•16 years ago
|
||
Not wanted for 1.9.1, but if this turns out to really be a bug that needs fixing, patches would still be considered.
Flags: wanted1.9.1? → wanted1.9.1-
Reporter | ||
Comment 8•16 years ago
|
||
After much time, I'm still unable to understand the original javascript code that breaks. Careful examination of the C code that changed between the working and non-working versions above shows that the change was desired, and fixed a bug in firefox's implementation of a standardized API. I've completely replaced the buggy and unreadable code with a well documented implementation that makes sense. The fault lies in the ugly code that depended on a broken implementation in order to work. I'm closing this 'invalid'.
Status: UNCONFIRMED → RESOLVED
Closed: 16 years ago
Resolution: --- → INVALID
Assignee | ||
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
•