::-moz-selection (::selection) css selector does not seem to be working with the JP Context Menu module

RESOLVED WONTFIX

Status

Add-on SDK
General
RESOLVED WONTFIX
8 years ago
8 years ago

People

(Reporter: Erik Vold, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

8 years ago
User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6
Build Identifier: 

I'd like to add a context menu to a selection with this css selector:

https://developer.mozilla.org/En/CSS/%3a%3aselection

Reproducible: Always

Steps to Reproduce:
1. create a context menu item with context: ["::-moz-selection"]
2. add the menu item
3. build the jetpack and test
Actual Results:  
Nothing appears when you right click.

Expected Results:  
When right clicking on a selection, a 'Copy HTML' menu item should be available.

I know about the method myk presented at the summit to achieve the same result, but I'd like to see this done with css selectors, since there appears to be a selector for this.

Comment 1

8 years ago
AFAIK Gecko supports ::-moz-selection but not ::selection.  If you open the error console with the extension you linked to you'll see some unrecognized selector warnings.

However, changing to ::-moz-selection still doesn't work (but does get rid of the warnings).  AFAICT ::-moz-selection doesn't actually match nodes in the page; it's just a pseudo-element whose purpose is to style the selected content.

The intention of selector contexts is to match nodes that the user right-clicks.  No node matches ::-moz-selection, and even if some did, the user can right-click anywhere in the page while a selection exists, including nodes that aren't "selected" and therefore wouldn't match ::-moz-selection.

So I think it's right that ::-moz-selection doesn't work here, and I'm WONTFIXing for now.  But if you have more thoughts, feel free to add them.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 8 years ago
Hardware: x86 → All
Resolution: --- → WONTFIX
Summary: ::moz-select css selector does not seem to be working with the JP Context Menu module → ::-moz-selection (::selection) css selector does not seem to be working with the JP Context Menu module
(Reporter)

Comment 2

8 years ago
"The intention of selector contexts is to match nodes that the user
right-clicks.  No node matches ::-moz-selection, and even if some did, the user
can right-click anywhere in the page while a selection exists, including nodes
that aren't "selected" and therefore wouldn't match ::-moz-selection."

This makes sense, so does WONTFIXing atm. Although the matching node could be the root node of selection.html if this were to be implemented.

Thanks,

E
The Add-on SDK is no longer a Mozilla Labs experiment and has become a big enough project to warrant its own Bugzilla product, so the "Add-on SDK" product has been created for it, and I am moving its bugs to that product.

To filter bugmail related to this change, filter on the word "looptid".
Component: Jetpack SDK → General
Product: Mozilla Labs → Add-on SDK
QA Contact: jetpack-sdk → general
You need to log in before you can comment on or make changes to this bug.