I spent too much time on this, so I'll share what I found until now in the hope it helps, but beware that's a dump of technicalities:
This is caused by your DuckDuckGo Privacy extension.
What happens is that they overwrite the document.createElement()
method.
In some cases that they believe are "interesting", they'll change the returned value of this method to a custom <ddg-runtime-checks>
element. One such "interesting" condition according to them is when a script originating from ajax.googleapis.com
calls this method with a "script"
argument. The custom element will then itself act as proxy to the original element that should have been created. This allows them to catch all the modifications that are done on this element (apparently, it's mainly to read the src
attribute of <script>
tags).
Where this becomes problematic is that jQuery does need to create a dummy <script>
element to check the default visibility of the element when we call $elem.toggle()
, which is supposed to toggle the visibility of the elements in the jQuery object. The extension's script will replace the <script>
element with its own proxy element, and will return a wrong "block"
value for the display
computed value, which should have been "none"
. So when jQuery will check if .toggle()
should show the <script>
element, it will think that yes, this element is normally visible, and thus needs to be shown, when actually, it shouldn't.
So, this is not a bug in Stack Overflow's script. You may want to let the authors of this extension know about this issue though, as they may not be aware of it and might want to fix it. If you do so, feel free to link them to this post. I guess they need to better handle the calls to getComputedStyle()
so that their custom element returns the value of the proxified element.
Update: The DuckDuckGo Privacy Extension team have disabled the bug-causing changes on StackExchange websites and are rolling out a fix for the described issue. If you run into this issue, please update your DuckDuckGo Privacy Extension to the latest version where the fix is applied.
:)