Fix RTL observer not working
This commit is contained in:
parent
78ca5bbc0b
commit
ff29e93b4f
1 changed files with 3 additions and 2 deletions
|
@ -4,12 +4,13 @@ let IS_RTL = false;
|
||||||
const observer = new MutationObserver((mutations) => {
|
const observer = new MutationObserver((mutations) => {
|
||||||
mutations.forEach((mutation) => {
|
mutations.forEach((mutation) => {
|
||||||
if (mutation.type === 'attributes') {
|
if (mutation.type === 'attributes') {
|
||||||
const { value } = mutation.target;
|
const { dir } = mutation.target;
|
||||||
if (value === 'rtl') {
|
if (dir === 'rtl') {
|
||||||
IS_RTL = true;
|
IS_RTL = true;
|
||||||
} else {
|
} else {
|
||||||
IS_RTL = false;
|
IS_RTL = false;
|
||||||
}
|
}
|
||||||
|
console.log({ IS_RTL });
|
||||||
// Fire custom event 'dirchange' on document
|
// Fire custom event 'dirchange' on document
|
||||||
// document.dispatchEvent(new Event('dirchange'));
|
// document.dispatchEvent(new Event('dirchange'));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue