Cross-Browser Element.matches
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 - 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);
});
Developer | Austin Wulf |
Username | atwulf |
Uploaded | July 11, 2022 |
Rating | 3 |
Size | 2,265 Kb |
Views | 56,672 |
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!
Name | Size |
Styling Native Select Inputs | 2,466 Kb |
A Pen by Austin Wulf | 2,743 Kb |
JQuery Pagination Plugin | 4,890 Kb |
CSS Rotate, Scale, and Crop | 1,755 Kb |
Simple Custom Select Box | 5,854 Kb |
Recursion Practice | 3,228 Kb |
Hiding Sticky Navigation | 4,622 Kb |
SVG Loading Indicator | 2,687 Kb |
Chord Name Translator | 3,388 Kb |
Grid System Sandbox | 4,452 Kb |
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!
Name | Username | Size |
A Pen by Matt Popovich | Mpopv | 3,349 Kb |
A Pen by Alexandru Pora | Axpro | 1,615 Kb |
Virtual vinyl | Davidpanik | 3,474 Kb |
Shop Talk logo made in CSS | Hugo | 19,368 Kb |
Large canvas mousemove experiment | Jibbon | 2,885 Kb |
Scifi-style Interative Form | Aaronchuo | 4,566 Kb |
CSS Chat Bubbles | Boylett | 2,094 Kb |
Zip Button test | Lje7462 | 1,932 Kb |
Lightrays v2 | Sinthetyc | 2,903 Kb |
Blog Concept - Single Post | Marionebl | 9,603 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!