- From: Andres Rios via GitHub <sysbot+gh@w3.org>
- Date: Mon, 17 Oct 2016 17:44:54 +0000
- To: public-css-archive@w3.org
rianby64 has just created a new issue for
https://github.com/w3c/csswg-drafts:
== [css-selectors] Query a parent node begining from a child node ==
Hello! I'd like to know your opinion about this idea
```javascript
el.querySelector('#add-subitem').addEventListener('click', e => {
var li =
e.target.parentNode.parentNode.parentNode.parentNode.parentNode;
// this could be simplified via
// e.target.querySelector('< li')
// as the oposite to
// li.querySelector('#add-subitem')
});
```
If already exists the
[operator](https://www.w3.org/TR/css3-selectors/#child-combinators)
```>``` that search a child, so, what about if add a new operator in
order to search from a child node up to its parent?
I mean, as I show in the example above, instead of writing parentNode
a lot of times, I could use an operator(```<``` or something else)
that finds the parent based on a condition.
Thanks for your attention!
Please view or discuss this issue at
https://github.com/w3c/csswg-drafts/issues/612 using your GitHub
account
Received on Monday, 17 October 2016 17:45:01 UTC