* A fast function to check if an element is still in the DOM. It * tries to use an id as ids are indexed by the browser, or falls * back to jQuery's `contains` method. * * @param {string|object} ref An id or a jQuery-wrapped HTML element * @return {boolean}
(ref)
| 2012 | * @return {boolean} |
| 2013 | */ |
| 2014 | function bodyContains(ref) { |
| 2015 | |
| 2016 | var id = (typeof ref === 'string') ? ref : ref.attr('id'); |
| 2017 | |
| 2018 | return id ? !!document.getElementById(id) : $.contains(document.body, ref[0]); |
| 2019 | } |
| 2020 | })(jQuery); |
| 2021 | |
| 2022 |