CSS selector interpretation currently limited (possibly to CSS 2.1)
Summary:
CLI's select-by-selector and the GUI dialog don't accept CSS selectors with an = sign, such as path[style*="1.9"], and some selectors with : such as :not(path). Other selectors are accepted but then appear differently than specified.
Steps to reproduce:
Using CLI
- Issue 1:
- Download the attached file (
example.svg). - Open the file using the CLI in shell mode:
inkscape example.svg --shell --with-gui - Type the command
select-by-selector:path[style*="1.9"]
- Download the attached file (
Using GUI
- Open Inkscape
- Open the "Selectors and CSS" panel (Shift+Ctrl+Q)
- Click on the "+" button ("Add a new CSS selector")
- Issue 1:
- Type a selector that contains
=, such aspath[style*="1.9"].
- Type a selector that contains
- Issue 2:
- Type a selector that contains
:, such asg:last-child.
- Type a selector that contains
- Issue 3:
- Type a selector that starts with
:, such as:not(path).
- Type a selector that starts with
What happened?
- In case of the CLI, the command is echoed and nothing is being selected.
- In case of the GUI,
- Issue 1: a message is shown inside the dialog - "Invalid CSS selector."
- Issue 2: a new selector is added with a
.appended at the beginning (in the cases of e.g.path[style]andg:last-child), which has a different meaning (selection by CSS class instead of element name (i.e. tag)). - Issue 3: the dialog closes as if the selector was accepted, but nothing is added to the list (in the case of e.g.
:not(path)).
What should have happened?
- Issue 1: some things should be selected, as can be demonstrated using a web browser (Firefox example).
- Issue 2: the selector should appear in the list as entered, without extra symbols that change its meaning.
- Issue 3: the selector should appear in the list.
Sample attachments:
- example.svg
- See also: Stack Overflow question on the topic.
Version Info:
- Inkscape Version: 1.1-dev (ede11a8, 2020-06-14)
- Operating System: Win 10 Pro N
- Operating System version: 1909, build 18363.720Edited by Nathan Lee