From 318f761f022e01807ee58ea1dbd2d151f0cf1982 Mon Sep 17 00:00:00 2001 From: Joao Oliveira Date: Wed, 10 May 2017 16:06:45 +0100 Subject: [PATCH 1/2] Cross browser prefix detection Updated logic to set prefix so that it works in all browsers. --- src/core.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core.js b/src/core.js index d268b34..e56a7fd 100644 --- a/src/core.js +++ b/src/core.js @@ -32,7 +32,7 @@ * prefix.js: addresses prefixed APIs present in global and non-Element contexts */ prefix = (function () { - var keys = Object.keys(window).join(); + var keys = Object.keys(Object.getPrototypeOf(window)).concat(Object.keys(window)).join(); var pre = ((keys.match(/,(ms)/) || keys.match(/,(moz)/) || keys.match(/,(O)/)) || [null, 'webkit'])[1].toLowerCase(); return { dom: pre == 'ms' ? 'MS' : pre, From 4206b4e4bfa5d154dbf72d96c4bad4e05910fe55 Mon Sep 17 00:00:00 2001 From: Joao Oliveira Date: Mon, 15 May 2017 09:54:02 +0100 Subject: [PATCH 2/2] Updated regex to get prefix Merged all matches into a single regex expression --- src/core.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core.js b/src/core.js index e56a7fd..a4193df 100644 --- a/src/core.js +++ b/src/core.js @@ -33,7 +33,7 @@ */ prefix = (function () { var keys = Object.keys(Object.getPrototypeOf(window)).concat(Object.keys(window)).join(); - var pre = ((keys.match(/,(ms)/) || keys.match(/,(moz)/) || keys.match(/,(O)/)) || [null, 'webkit'])[1].toLowerCase(); + var pre = (keys.match(/,(ms|moz|O)/) || [null, 'webkit'])[1].toLowerCase(); return { dom: pre == 'ms' ? 'MS' : pre, lowercase: pre,