Unified · Split
| @@ -12,12 +12,14 @@ $.id = (id) -> · 11 unmodified lines | |||
| 12 | document.getElementById(id) | 12 | document.getElementById(id) |
| 13 | 13 | ||
| 14 | $.hasChild = (parent, el) -> | 14 | $.hasChild = (parent, el) -> |
| 15 | return unless parent and el | ||
| 15 | loop | 16 | loop |
| 16 | return true if el is parent | 17 | return true if el is parent |
| 17 | return if el is document.body | 18 | return if el is document.body |
| 18 | el = el.parentElement | 19 | el = el.parentElement |
| 19 | 20 | ||
| 20 | $.closestLink = (el, parent = document.body) -> | 21 | $.closestLink = (el, parent = document.body) -> |
| 22 | return unless el and parent | ||
| 21 | loop | 23 | loop |
| 22 | return el if el.tagName is 'A' | 24 | return el if el.tagName is 'A' |
| 23 | return if el is parent | 25 | return if el is parent |