diff --git a/addon/services/resize-detector.js b/addon/services/resize-detector.js index a41fcd3..5684892 100644 --- a/addon/services/resize-detector.js +++ b/addon/services/resize-detector.js @@ -16,7 +16,14 @@ export default Ember.Service.extend({ }, setup(selector, callback) { - let element = document.querySelector(selector) + let element; + + if (selector instanceof HTMLElement) { + element = selector; + } else { + element = document.querySelector(selector); + } + if (!element) { error(`service:resize-detector - could not find an element matching ${selector}`); return; @@ -25,7 +32,14 @@ export default Ember.Service.extend({ }, teardown(selector, callback) { - let element = document.querySelector(selector) + let element; + + if (selector instanceof HTMLElement) { + element = selector; + } else { + element = document.querySelector(selector); + } + if (element) { this.detector.removeListener(element, callback); }