Registry /
web-framework / ember-cli-element-closest-polyfill
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default
✓ import 'ember-cli-element-closest-polyfill';
✗ import { closest } from 'ember-cli-element-closest-polyfill';
Importing the module automatically applies the polyfill; there is no named export. Just import the package once, typically in app.js.
addon
✓ // In ember-cli-build.js or as addon dependency: add 'ember-cli-element-closest-polyfill' to package.json dependencies
✗ import { polyfill } from 'ember-cli-element-closest-polyfill';
This is an Ember CLI addon; consumption is via 'ember install' or adding to package.json. No JS import is needed manually; the addon handles the polyfill.
Element.closest
✓ element.closest('.selector');
✗ element.closest('.selector', context);
After polyfill, Element.closest works per spec (one argument). No extra arguments supported.
Installs the addon and shows usage of Element.closest in an Ember component after polyfill is applied.
# Install the addon in your Ember app
ember install ember-cli-element-closest-polyfill
# After installation, you can use element.closest() in your Ember components or controllers.
// Example in a component:
import Component from '@glimmer/component';
import { action } from '@ember/object';
export default class MyComponent extends Component {
@action
handleClick(event) {
const button = event.target.closest('button');
if (button) {
console.log('Clicked a button:', button);
}
}
}
Errors
Common errors & fixes
closest is undefined
Browser does not support Element.closest and polyfill is not included (e.g., targets exclude IE11).
fixEnsure your target configuration includes browsers that need the polyfill, such as 'ie 11' in config/targets.js.
Cannot find module 'ember-cli-element-closest-polyfill'
Addon not installed or not listed in package.json dependencies.
fixRun 'ember install ember-cli-element-closest-polyfill' to add it to your project.
Audit
Dependencies
No dependency data recorded yet.