Element.closest()

Last updated on : 2022-04-10

Note:
Element.closest() shows a browser compatibility score of 85. 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.

Overview

The element-closest(selector) 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 .

Browser Compatibility

  • Element.closest() on IE is fully supported on None of the versions, partially supported on None of the versions, and not supported on 5.5-11 IE versions.
  • Element.closest() on Edge is fully supported on 15-99, partially supported on None of the versions, and not supported on 12-14 Edge versions.
  • Element.closest() on Firefox is fully supported on 35-100, partially supported on None of the versions, and not supported on 2-34 Firefox versions.
  • Element.closest() on Chrome is fully supported on 41-103, partially supported on None of the versions, and not supported on 4-40 Chrome versions.
  • Element.closest() on Safari is fully supported on 9.1-15.4, partially supported on None of the versions, and not supported on 3.2-8 Safari versions.
  • Element.closest() on Opera is fully supported on 28-83, partially supported on None of the versions, and not supported on 9.5-27 Opera versions.
  • Element.closest() on Safari on iOS is fully supported on 9.3-15.4, partially supported on None of the versions, and not supported on 3.2-8 Safari on iOS versions.
  • Element.closest() on Android Browser is fully supported on 97-99, partially supported on None of the versions, and not supported on 2.3-4 Android Browser versions.
  • Element.closest() on Opera Mobile is fully supported on 64-64, partially supported on None of the versions, and not supported on 10-12 Opera Mobile versions.
  • Element.closest() on Chrome for Android is fully supported on 97-100, partially supported on None of the versions, and not supported on below 97 Chrome for Android versions.
  • Element.closest() on Firefox for Android is fully supported on 95-98, partially supported on None of the versions, and not supported on below 95 Firefox for Android versions.
  • Element.closest() on Samsung Internet is fully supported on 5-16, partially supported on None of the versions, and not supported on 4-4 Samsung Internet versions.
85
Hightooltip

Browser Compatibility Score

Chrome IE
Low

Browser Support For IE Versions

-
Fully
-
Partially
5.5-11
No Support
Chrome Edge
High

Browser Support For Edge Versions

15-99
Fully
-
Partially
12-14
No Support
Chrome Firefox
High

Browser Support For Firefox Versions

35-100
Fully
-
Partially
2-34
No Support
Chrome Chrome
High

Browser Support For Chrome Versions

41-103
Fully
-
Partially
4-40
No Support
Chrome Safari
High

Browser Support For Safari Versions

9.1-15.4
Fully
-
Partially
3.2-8
No Support
Chrome Opera
High

Browser Support For Opera Versions

28-83
Fully
-
Partially
9.5-27
No Support
Chrome Safari on iOS
High

Browser Support For Safari on iOS Versions

9.3-15.4
Fully
-
Partially
3.2-8
No Support
Chrome Android Browser
Medium

Browser Support For Android Browser Versions

97-99
Fully
-
Partially
2.3-4
No Support
Chrome Opera Mobile
Medium

Browser Support For Opera Mobile Versions

64-64
Fully
-
Partially
10-12
No Support
Chrome Chrome for Android
High

Browser Support For Chrome for Android Versions

97-100
Fully
-
Partially
-
No Support
Chrome Firefox for Android
High

Browser Support For Firefox for Android Versions

95-98
Fully
-
Partially
-
No Support
Chrome Samsung Internet
High

Browser Support For Samsung Internet Versions

5-16
Fully
-
Partially
4-4
No Support

Test your website on 3000+ browsers

Test your website on 3000+ real browsers and operating systems for mobile and desktop with the LambdaTest cloud. Perform browser compatibility test for Element.closest() and many more web technologies that are a part of your website or web-application.

Last Modified date

2022-04-10

Browser Support for Element.closest()

  • ChromeChrome
  • Safari Safari
  • Firefox Firefox
  • IE Internet Explorer
  • Opera Opera
  • Edge Edge

References


Data sourced from

Test on a Real Browser

Test this and other features on your website for compatibility across
3,000 real browsers and devices using

Try LambdaTest
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope we're able to help you build browser compatible web experience.

Fast track your browser testing experience on 3000+ browsers and OS combinations with LambdaTest.

Sarah Elson (Product & Growth Lead)