{"action":"created","issue":{"url":"https://api.github.com/repos/symfony/symfony/issues/18609","repository_url":"https://api.github.com/repos/symfony/symfony","labels_url":"https://api.github.com/repos/symfony/symfony/issues/18609/labels{/name}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/18609/comments","events_url":"https://api.github.com/repos/symfony/symfony/issues/18609/events","html_url":"https://github.com/symfony/symfony/issues/18609","id":150085172,"number":18609,"title":"[DomCrawler] closest() and outerHtml()","user":{"login":"rafis","id":3502395,"avatar_url":"https://avatars.githubusercontent.com/u/3502395?v=3","gravatar_id":"","url":"https://api.github.com/users/rafis","html_url":"https://github.com/rafis","followers_url":"https://api.github.com/users/rafis/followers","following_url":"https://api.github.com/users/rafis/following{/other_user}","gists_url":"https://api.github.com/users/rafis/gists{/gist_id}","starred_url":"https://api.github.com/users/rafis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rafis/subscriptions","organizations_url":"https://api.github.com/users/rafis/orgs","repos_url":"https://api.github.com/users/rafis/repos","events_url":"https://api.github.com/users/rafis/events{/privacy}","received_events_url":"https://api.github.com/users/rafis/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/symfony/symfony/labels/DomCrawler","name":"DomCrawler","color":"DDDDDD"},{"url":"https://api.github.com/repos/symfony/symfony/labels/Feature","name":"Feature","color":"02e10c"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-04-21T14:07:20Z","updated_at":"2016-06-30T07:45:50Z","closed_at":null,"body":"Can you please add `closest()` to DomCrawler?\r\n\r\nhttp://james.padolsey.com/jquery/#v=2.1.3&fn=jQuery.fn.closest\r\n\r\nThis is pseudo-code, not tested:\r\n\r\n```php\r\n    public function closest($selector)\r\n    {\r\n        if (!count($this)) {\r\n            throw new \\InvalidArgumentException('The current node list is empty.');\r\n        }\r\n\r\n        $node = $this->getNode(0);\r\n        while ($node = $node->parentNode) {\r\n            if (XML_ELEMENT_NODE === $node->nodeType) {\r\n               $parent = $this->createSubCrawler($node)->filter($selector);\r\n               if ($parent->count()) {\r\n                  return $parent;\r\n               }\r\n            }\r\n        }\r\n\r\n        return null;\r\n    }\r\n```"},"comment":{"url":"https://api.github.com/repos/symfony/symfony/issues/comments/229585258","html_url":"https://github.com/symfony/symfony/issues/18609#issuecomment-229585258","issue_url":"https://api.github.com/repos/symfony/symfony/issues/18609","id":229585258,"user":{"login":"javiereguiluz","id":73419,"avatar_url":"https://avatars.githubusercontent.com/u/73419?v=3","gravatar_id":"","url":"https://api.github.com/users/javiereguiluz","html_url":"https://github.com/javiereguiluz","followers_url":"https://api.github.com/users/javiereguiluz/followers","following_url":"https://api.github.com/users/javiereguiluz/following{/other_user}","gists_url":"https://api.github.com/users/javiereguiluz/gists{/gist_id}","starred_url":"https://api.github.com/users/javiereguiluz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javiereguiluz/subscriptions","organizations_url":"https://api.github.com/users/javiereguiluz/orgs","repos_url":"https://api.github.com/users/javiereguiluz/repos","events_url":"https://api.github.com/users/javiereguiluz/events{/privacy}","received_events_url":"https://api.github.com/users/javiereguiluz/received_events","type":"User","site_admin":false},"created_at":"2016-06-30T07:45:50Z","updated_at":"2016-06-30T07:45:50Z","body":"I'm 👎 for adding these new methods. The reason is that we must be cautious when adding new features (they will potentially introduce bugs and they must be maintained forever). When lots of people ask for something, you know that you are missing that feature, but that's not the case for these methods because this is the first time the are asked for."}}
{"actor":{"display_login":"javiereguiluz"}}