]> _ Git - cubist_gtag.git/commitdiff
wip #3037 @0:15
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 12 Sep 2019 08:50:40 +0000 (10:50 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 12 Sep 2019 08:50:40 +0000 (10:50 +0200)
resources/public/js/gtag.js

index 4719ae0e7ed966b19abe66813873b72a395c53c2..f3712e3b939a59bc8b00b5001416781ee8317d18 100644 (file)
@@ -1,6 +1,5 @@
-var matches = function matches(element, selector) {
-    return element.matches ? element.matches(selector) : element.msMatchesSelector ? element.msMatchesSelector(selector) : element.webkitMatchesSelector ? element.webkitMatchesSelector(selector) : null;
-};
+require('element-closest-polyfill');
+require('element-matches-polyfill');
 
 function cubistga() {
     this.initEvents();
@@ -15,7 +14,7 @@ cubistga.prototype.initEvents = function () {
     });
 
     document.addEventListener('click', function (e) {
-        if (matches(e.target,'a[data-ga]')) {
+        if (e.target.matches('a[data-ga]')) {
             $this.handleGtag(e.target);
         }
         if (e.target.closest('a[data-ga]')) {