Cross-Browser Element.matches

Developer
Size
2,265 Kb
Views
56,672

How do I make an cross-browser element.matches?

What is a cross-browser element.matches? How do you make a cross-browser element.matches? This script and codes were developed by Austin Wulf on 11 July 2022, Monday.

Cross-Browser Element.matches Previews

Cross-Browser Element.matches - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Cross-Browser Element.matches</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="wrapper"> <p>Open your console to see the results</p> <p> <button>click me</button> </p>
</div> <script src="js/index.js"></script>
</body>
</html>

Cross-Browser Element.matches - Script Codes CSS Codes

.wrapper { padding: 20px;
}

Cross-Browser Element.matches - Script Codes JS Codes

'use strict';
console.clear();
function matchesSelector(el, selector) { var method = Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.matchesSelector; return method.call(el, selector);
}
document.addEventListener('click', function (event) { var match = matchesSelector(event.target, 'button'); console.log('event.target matches selector `button`:', match);
});
Cross-Browser Element.matches - Script Codes
Cross-Browser Element.matches - Script Codes
Home Page Home
Developer Austin Wulf
Username atwulf
Uploaded July 11, 2022
Rating 3
Size 2,265 Kb
Views 56,672
Do you need developer help for Cross-Browser Element.matches?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Austin Wulf (atwulf) Script Codes
Create amazing SEO content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!