CSS Selectors can not be written as ordered lists
- Dominant language
- JavaScript
- Stars
- 10
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
One of the limitations of JSON-LD 1.0 is that it does not allow ordered nested lists. Therefore a selector like this, is **not permitted**:
```json
{
"@context": {
"selector": {
"@id": "https://axrl.org/selector",
"@type": "https://axrl.org/CSSSelector",
"@container": "@list"
}
},
"selector": [
".foo", [".bar", ".baz"]
]
}
```
Allowing this has been approved fir JSON-LD 1.1, which is currently in draft. I want to avoid using draft features. There are two ways to deal with this situation:
1. We abandon the current selector format in favour of a more verbose one
2. We do not declare in the context that the selector has an order, and adopt this once JSON-LD 1.1 is more stable.
I'm going for option 2, since it seems to be the least impactful. I'm going to keep this issue open as a record of that decision though, and a reminder to revisit this once JSON-LD 1.1 makes it to Candidate Recommendation.
The result of not defining this as an ordered list is that when expanding / flattening the JSON-LD, the nested array will be flattened (`[['foo', 'bar'], 'baz']` becomes `['foo', 'bar', 'baz']`). In practice, that shouldn't be an issue. Since iframes can't be shadow roots, there shouldn't be any confusion about what to do with that selector.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.