Closed
Bug 301466
Opened 19 years ago
Closed 19 years ago
Unable to copy text with adjacent HTML
Categories
(Firefox :: Menus, defect, P1)
Firefox
Menus
Tracking
()
VERIFIED
FIXED
Firefox1.5
People
(Reporter: mozilla, Assigned: Gavin)
Details
(Keywords: regression, testcase)
Attachments
(2 files)
|
135 bytes,
text/html
|
Details | |
|
1.19 KB,
patch
|
mconnor
:
review+
mconnor
:
approval1.8b4+
|
Details | Diff | Splinter Review |
20050715 trunk If you double-click a word that is surrounded by HTML such as <b> or <span>, and then right-click, the context menu does not have a "copy" option even though the word is selected.
| Reporter | ||
Comment 1•19 years ago
|
||
Double-click on either the word "bold" or "span" and then right-click. Witness the wrong context menu.
Comment 2•19 years ago
|
||
worksforme with build 2005-07-19-06, SeaMonkey trunk. Are you using Firefox?
| Reporter | ||
Comment 3•19 years ago
|
||
Yes. I am surprised that the context menu switching is different between Mozilla and Firefox.
| Assignee | ||
Updated•19 years ago
|
Assignee: nobody → gavin.sharp
Component: XP Toolkit/Widgets: Menus → Menus
OS: Windows XP → All
Priority: -- → P1
Product: Core → Firefox
QA Contact: xptoolkit.menus → menus
Hardware: PC → All
Target Milestone: --- → Firefox1.1
| Assignee | ||
Comment 4•19 years ago
|
||
The check for an empty selection was slightly flawed, so this makes sure that the empty text fragment is in fact the only item in the selection.
Attachment #189919 -
Flags: review?(mconnor)
| Assignee | ||
Updated•19 years ago
|
Status: NEW → ASSIGNED
Whiteboard: [patch-r?]
| Reporter | ||
Comment 5•19 years ago
|
||
Forgive my ignorance, but why is nodeValue returning a null? Is the HTML tag considered childNode[0] and so it has no text to return? If so, I would say that this bug is directly related to the discussion in bug 157065 about Firefox selecting things from the source when they are not visible in the document. In this case the <b> or <span> tags.
| Assignee | ||
Comment 6•19 years ago
|
||
(In reply to comment #5) > Forgive my ignorance, but why is nodeValue returning a null? Is the HTML tag > considered childNode[0] and so it has no text to return? If so, I would say that > this bug is directly related to the discussion in bug 157065 about Firefox > selecting things from the source when they are not visible in the document. In > this case the <b> or <span> tags. nodeValue isn't returning null. The goal of this code is to determine whether there is a selection. It does this by retrieving the rangeFragment, which is an array of nodes that are selected. When there is no selection, the rangeFragment contains only an empty text node. When you double-click select the bolded text, rangeFragment contains an empty text node, a "bold" node, and a text node who's value is " " (in that order). To determine whether there is a selection, the code currently just checks that the first node is an empty text node, and doesn't verify that it is the only node in the selection. My patch corrects this. This has nothing to do with bug 157065.
Comment 7•19 years ago
|
||
Comment on attachment 189919 [details] [diff] [review] patch good catch guys, thanks for picking this one up.
Attachment #189919 -
Flags: review?(mconnor)
Attachment #189919 -
Flags: review+
Attachment #189919 -
Flags: approval1.8b4+
| Reporter | ||
Comment 8•19 years ago
|
||
I see what you are saying. How is it possible to end up with a null selection (a text node with zero characters selected)? Just curious how to get into that condition in a test case.
| Assignee | ||
Comment 9•19 years ago
|
||
Checking in browser/base/content/browser.js; /cvsroot/mozilla/browser/base/content/browser.js,v <-- browser.js new revision: 1.458; previous revision: 1.457 done
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Whiteboard: [patch-r?]
| Assignee | ||
Comment 10•19 years ago
|
||
(In reply to comment #8) > I see what you are saying. How is it possible to end up with a null selection (a > text node with zero characters selected)? Just curious how to get into that > condition in a test case. It isn't possible to select "nothing". The selection simply returns an empty text node to indicate "no selection". As to why it does that, you'd have to ask someone else :).
Comment 11•19 years ago
|
||
Uhm, bug 301357 is basically the same bug. I posted a patch there, and I think it might be a better patch, since it removes the whole cloneContents() entirely, since I don't think it is necessary in this case. It fixes also the testcase in this bug.
Comment 12•19 years ago
|
||
(In reply to comment #11) > Uhm, bug 301357 is basically the same bug. I posted a patch there, and I think > it might be a better patch, since it removes the whole cloneContents() entirely, > since I don't think it is necessary in this case. > It fixes also the testcase in this bug. Cool! I am assuming that that patch isn't the one which got checked in to fix this, right?
Comment 13•19 years ago
|
||
Nevermind that last post. Saw the comments in the other bug. Sorry, and thanks.
You need to log in
before you can comment on or make changes to this bug.
Description
•