by Anonymous » 12 Feb 2025, 01:08
Ich muss in der Lage sein, Maßnahmen zu ergreifen, wenn ein Safari -Benutzer die neue Funktion "Ablenkende Elemente ausblenden" verwendet hat, um einen Modal zu entfernen, der die Benutzerinteraktion erfordert. ist zumindest teilweise mit DOM -Manipulation gemacht, ich habe einen Mutationsbeobachter eingerichtet, um auf Änderungen zu hören. < /p>
Code: Select all
console.log("observing")
new bootstrap.Modal($('#fred')).show();
const observer = new MutationObserver((mutations, myInstance) => {
mutations.forEach((mutation, myInstance) => {
console.log(mutation.type, mutation.target.id, mutation.attributeName);
console.log(mutation.target.classList, mutation.target.style)
// myInstance.disconnect()
})
})
observer.observe(document.getElementById('parent-panel'), {
attributes: true,
childList: true,
subtree: true
});
< /code>
Das Problem, das ich habe, ist nicht zu wissen, wie Safari die Funktion implementiert. Und auch die Erinnerung an das, was versteckt wurde.
irgendwelche Ideen/Zeiger? Und bitte sagen Sie mir, was in der Dev Tools -Konsole auftaucht: -< /p>
div.relative {
position: relative;
width: 400px;
height: 200px;
border: 3px solid #73AD21;
}
div.absolute {
position: absolute;
top: 80px;
right: 0;
width: 200px;
height: 100px;
border: 3px solid #73AD21;
}
document.addEventListener("DOMContentLoaded", () => {
console.log("observing")
const observer = new MutationObserver((mutations, myInstance) => {
mutations.forEach((mutation) => {
console.log(mutation.type, mutation.target.id, mutation.attributeName);
console.log(mutation.target.classList, mutation.target.style)
// myInstance.disconnect()
})
})
observer.observe(document.body, {
attributes: true,
childList: true,
subtree: true
})
// document.getElementById("abs").remove()
})
position: absolute;
An element with position: absolute; is positioned relative to the nearest positioned ancestor (instead of positioned relative to the viewport, like fixed):
This div element has position: relative;
This div element has position: absolute;
Ich muss in der Lage sein, Maßnahmen zu ergreifen, wenn ein Safari -Benutzer die neue Funktion "Ablenkende Elemente ausblenden" verwendet hat, um einen Modal zu entfernen, der die Benutzerinteraktion erfordert. ist zumindest teilweise mit DOM -Manipulation gemacht, ich habe einen Mutationsbeobachter eingerichtet, um auf Änderungen zu hören. < /p>
[code] console.log("observing")
new bootstrap.Modal($('#fred')).show();
const observer = new MutationObserver((mutations, myInstance) => {
mutations.forEach((mutation, myInstance) => {
console.log(mutation.type, mutation.target.id, mutation.attributeName);
console.log(mutation.target.classList, mutation.target.style)
// myInstance.disconnect()
})
})
observer.observe(document.getElementById('parent-panel'), {
attributes: true,
childList: true,
subtree: true
});
< /code>
Das Problem, das ich habe, ist nicht zu wissen, wie Safari die Funktion implementiert. Und auch die Erinnerung an das, was versteckt wurde.
irgendwelche Ideen/Zeiger? Und bitte sagen Sie mir, was in der Dev Tools -Konsole auftaucht: -< /p>
div.relative {
position: relative;
width: 400px;
height: 200px;
border: 3px solid #73AD21;
}
div.absolute {
position: absolute;
top: 80px;
right: 0;
width: 200px;
height: 100px;
border: 3px solid #73AD21;
}
document.addEventListener("DOMContentLoaded", () => {
console.log("observing")
const observer = new MutationObserver((mutations, myInstance) => {
mutations.forEach((mutation) => {
console.log(mutation.type, mutation.target.id, mutation.attributeName);
console.log(mutation.target.classList, mutation.target.style)
// myInstance.disconnect()
})
})
observer.observe(document.body, {
attributes: true,
childList: true,
subtree: true
})
// document.getElementById("abs").remove()
})
position: absolute;
An element with position: absolute; is positioned relative to the nearest positioned ancestor (instead of positioned relative to the viewport, like fixed):
This div element has position: relative;
This div element has position: absolute;
[/code]