From 5c344ae3e3c5d1c2e3bbbb9aade09ed4a4629560 Mon Sep 17 00:00:00 2001 From: Isabelle Viktoria Maciohsek Date: Tue, 20 Oct 2020 11:44:29 +0300 Subject: [PATCH] Update supportsTouchEvents --- snippets/supportsTouchEvents.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/snippets/supportsTouchEvents.md b/snippets/supportsTouchEvents.md index 3b84f438d..0b47b373e 100644 --- a/snippets/supportsTouchEvents.md +++ b/snippets/supportsTouchEvents.md @@ -1,16 +1,15 @@ --- title: supportsTouchEvents -tags: browser,intermediate +tags: browser,beginner --- -Returns `true` if touch events are supported, `false` otherwise. +Checks if touch events are supported. -- Check if `ontouchstart` exists in `window` or `window.DocumentTouch` is true and the current `document` is an instance of it. +- Check if `ontouchstart` exists in `window`. ```js const supportsTouchEvents = () => - window && - ('ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch); + window && 'ontouchstart' in window; ``` ```js