Re: [csswg-drafts] [css-selectors-4] Grammar of ns-prefix incorrect? (#10016)

> Is it intended that `|` is required if no `ident-token` or wildcard is specified?

It's not required to specify `|` in a type selector like `div`, because both consumers make it optional: `<ns-prefix>?`

> That would mean that selectors such as `|*` are valid. Is that the case?

Yes. See this XHTML example (requires `application/xhtml+xml`):
```xml
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<style>|* { background: green }</style>
<div xmlns="">Green</div>
</html>
```

In HTML it may be weirder to have elements without a namespace, but also possible:

```html
<!DOCTYPE html>
<style>|* { background: green }</style>
<script>
var el = document.createElementNS("", "div");
el.textContent = "Green";
document.documentElement.appendChild(el);
</script>
```


-- 
GitHub Notification of comment by Loirooriol
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10016#issuecomment-1972029105 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 29 February 2024 21:51:12 UTC