W3C home > Mailing lists > Public > public-css-archive@w3.org > October 2016

Re: [csswg-drafts] [css-selectors] Query a parent node begining from a child node

From: Damian Senn via GitHub <sysbot+gh@w3.org>
Date: Tue, 18 Oct 2016 07:55:51 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-254434094-1476777350-sysbot+gh@w3.org>
You can already achieve this with the `element.closest()` method.

```js
el.querySelector('#add-subitem').addEventListener('click', e => {
  var li = e.target.closest('li');
});
```

-- 
GitHub Notification of comment by topaxi
Please view or discuss this issue at 
https://github.com/w3c/csswg-drafts/issues/612#issuecomment-254434094 
using your GitHub account
Received on Tuesday, 18 October 2016 07:56:03 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:04 UTC