Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles
The element-closestselector method is a DOM method that returns the first element matching the specified selector, or the closest ancestor element excluding elements matched by :not matching the specified selector. If no element matches the selector, it will return null .
Last updated on : 2023-03-20
Browser Versions
IE
Edge
Firefox
Chrome
Safari
Opera
Fully Supported
Partially
No Support
Element.closest() on IE is not supported on any IE versions.
Element.closest() on Edge is fully supported on 15-111, and not supported on 12-14 Edge versions.
Element.closest() on Firefox is fully supported on 35-113, and not supported on 2-34 Firefox versions.
Element.closest() on Chrome is fully supported on 41-114, and not supported on 4-40 Chrome versions.
Element.closest() on Safari is fully supported on 9.1-16.4, and not supported on 3.2-8 Safari versions.
Element.closest() on Opera is fully supported on 28-95, and not supported on 9.5-27 Opera versions.
Element.closest() on Safari on iOS is fully supported on 9.3-16.4, and not supported on 3.2-8 Safari on iOS versions.
Element.closest() on Android Browser is fully supported on 97-111, and not supported on 2.1-4 Android Browser versions.
Element.closest() on Opera Mobile is fully supported on 64-73, and not supported on 10-12 Opera Mobile versions.
Element.closest() on Chrome for Android is fully supported on all Chrome for Android versions.
Element.closest() on Firefox for Android is fully supported on all Firefox for Android versions.
Element.closest() on Samsung Internet is fully supported on 5-20, and not supported on 4-4 Samsung Internet versions.
Data sourced from
Overall Browser Compatibility Score
Note:Element.closest() shows a browser compatibility score of 92. This is a collective score out of 100 to represent browser support of a web technology. The higher this score is, the greater is the browser compatibility. The browser compatibility score is not a 100% reflection for every browser and the web technology support. However, it does give you an estimate on how much you should rely on a particular web technology in terms of browser compatibility.
Test on 3000+ browsers for Element.closest() & more
Test your website for Element.closest() and other web technologies. Get 100 FREE automation test minutes!
Test NowKaneAI - Testing Assistant
World’s first AI-Powered E2E testing agent.
Did you find this page helpful?