{"action":"created","issue":{"url":"https://api.github.com/repos/jquery/jquery/issues/2580","labels_url":"https://api.github.com/repos/jquery/jquery/issues/2580/labels{/name}","comments_url":"https://api.github.com/repos/jquery/jquery/issues/2580/comments","events_url":"https://api.github.com/repos/jquery/jquery/issues/2580/events","html_url":"https://github.com/jquery/jquery/issues/2580","id":105418203,"number":2580,"title":"(FR) .tail access function","user":{"login":"pyhedgehog","id":1286400,"avatar_url":"https://avatars.githubusercontent.com/u/1286400?v=3","gravatar_id":"","url":"https://api.github.com/users/pyhedgehog","html_url":"https://github.com/pyhedgehog","followers_url":"https://api.github.com/users/pyhedgehog/followers","following_url":"https://api.github.com/users/pyhedgehog/following{/other_user}","gists_url":"https://api.github.com/users/pyhedgehog/gists{/gist_id}","starred_url":"https://api.github.com/users/pyhedgehog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pyhedgehog/subscriptions","organizations_url":"https://api.github.com/users/pyhedgehog/orgs","repos_url":"https://api.github.com/users/pyhedgehog/repos","events_url":"https://api.github.com/users/pyhedgehog/events{/privacy}","received_events_url":"https://api.github.com/users/pyhedgehog/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-08T16:24:14Z","updated_at":"2015-09-09T17:17:34Z","closed_at":"2015-09-09T16:59:01Z","body":"It's not as easy to get text between sibling elements:\r\n```HTML\r\n<div>text1<span>text2</span>text3 to grab<span>text4</span>text5</div>'\r\n```\r\nIf I want to get \"`text3 to grab`\", I need to write something like this:\r\n```JavaScript\r\nvar a = $('span:first-child');\r\nvar b = a.parent().contents();\r\nconsole.log($(b[Array.prototype.findIndex.call(b,function(elem){return $(elem).is(a);})+1]).text());\r\n```\r\nAlso I need to add [Array.findIndex polyfill](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex#Polyfill).\r\nLet's stole [`tail`](https://docs.python.org/2/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element.tail) name for function that will return (and possibly change/add) next text node sibling.\r\n\r\nSee also cheeriojs/cheerio#743."},"comment":{"url":"https://api.github.com/repos/jquery/jquery/issues/comments/138981518","html_url":"https://github.com/jquery/jquery/issues/2580#issuecomment-138981518","issue_url":"https://api.github.com/repos/jquery/jquery/issues/2580","id":138981518,"user":{"login":"pyhedgehog","id":1286400,"avatar_url":"https://avatars.githubusercontent.com/u/1286400?v=3","gravatar_id":"","url":"https://api.github.com/users/pyhedgehog","html_url":"https://github.com/pyhedgehog","followers_url":"https://api.github.com/users/pyhedgehog/followers","following_url":"https://api.github.com/users/pyhedgehog/following{/other_user}","gists_url":"https://api.github.com/users/pyhedgehog/gists{/gist_id}","starred_url":"https://api.github.com/users/pyhedgehog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pyhedgehog/subscriptions","organizations_url":"https://api.github.com/users/pyhedgehog/orgs","repos_url":"https://api.github.com/users/pyhedgehog/repos","events_url":"https://api.github.com/users/pyhedgehog/events{/privacy}","received_events_url":"https://api.github.com/users/pyhedgehog/received_events","type":"User","site_admin":false},"created_at":"2015-09-09T17:17:34Z","updated_at":"2015-09-09T17:17:34Z","body":"Ok. What about adding method/selector for prev/next node sibling in addition for element sibling?"}}