(/**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx, includeCTX)
| 44 | } |
| 45 | |
| 46 | function closest(/**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx, includeCTX) { |
| 47 | if (el) { |
| 48 | ctx = ctx || document; |
| 49 | |
| 50 | do { |
| 51 | if ( |
| 52 | selector != null && |
| 53 | ( |
| 54 | selector[0] === '>' ? |
| 55 | el.parentNode === ctx && matches(el, selector) : |
| 56 | matches(el, selector) |
| 57 | ) || |
| 58 | includeCTX && el === ctx |
| 59 | ) { |
| 60 | return el; |
| 61 | } |
| 62 | |
| 63 | if (el === ctx) break; |
| 64 | /* jshint boss:true */ |
| 65 | } while (el = getParentOrHost(el)); |
| 66 | } |
| 67 | |
| 68 | return null; |
| 69 | } |
| 70 | |
| 71 | const R_SPACE = /\s+/g; |
| 72 |
no test coverage detected
searching dependent graphs…