From c4ba286a3d72f42ebf96f38a867dc2cfbbc0652d Mon Sep 17 00:00:00 2001
From: romainmenke
Date: Sun, 3 Jul 2022 18:53:29 +0200
Subject: [PATCH 1/2] postcss-focus-within : browser compat
---
plugins/postcss-focus-within/src/browser.js | 8 ++++++--
plugins/postcss-focus-within/test/_browser.html | 1 +
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/plugins/postcss-focus-within/src/browser.js b/plugins/postcss-focus-within/src/browser.js
index 6a225a7bd..17de536dc 100644
--- a/plugins/postcss-focus-within/src/browser.js
+++ b/plugins/postcss-focus-within/src/browser.js
@@ -1,4 +1,4 @@
-/* global document */
+/* global document,window */
import isValidReplacement from './is-valid-replacement.mjs';
function generateHandler(replaceWith) {
let selector;
@@ -65,7 +65,11 @@ export default function focusWithin(opts) {
const handleFocusChange = generateHandler(options.replaceWith);
const initialize = function initializeEventListeners() {
- document.documentElement.classList.add('js-focus-within');
+ if (document.documentElement.className.indexOf('js-focus-within') > -1) {
+ return;
+ }
+
+ document.documentElement.className = document.documentElement.className + ' js-focus-within';
document.addEventListener('focus', handleFocusChange, true);
document.addEventListener('blur', handleFocusChange, true);
};
diff --git a/plugins/postcss-focus-within/test/_browser.html b/plugins/postcss-focus-within/test/_browser.html
index c18455734..0332a325f 100644
--- a/plugins/postcss-focus-within/test/_browser.html
+++ b/plugins/postcss-focus-within/test/_browser.html
@@ -7,6 +7,7 @@
+
From f0027d7a60332698ae27990ef2c2d8eab1bdb509 Mon Sep 17 00:00:00 2001
From: romainmenke
Date: Sun, 3 Jul 2022 19:04:06 +0200
Subject: [PATCH 2/2] lint
---
plugins/postcss-focus-within/src/browser.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/postcss-focus-within/src/browser.js b/plugins/postcss-focus-within/src/browser.js
index 17de536dc..72234467f 100644
--- a/plugins/postcss-focus-within/src/browser.js
+++ b/plugins/postcss-focus-within/src/browser.js
@@ -1,4 +1,4 @@
-/* global document,window */
+/* global document */
import isValidReplacement from './is-valid-replacement.mjs';
function generateHandler(replaceWith) {
let selector;