Window. Event ={add:function() { //use conditional expressions to detect whether a standard method exists returnDocument.addeventlistener?function(A, B, c) {/*use the standard method if the standard method exists. Note here that this will write false as "! 1", which is better than writing "false" directly. I think it's supposed to reduce the volume of files by writing a few characters less. Because JS is to be downloaded to the user's computer to perform, so will! 1 automatic conversion to false is not a good thing for the user's computer resource overhead, but if each false saves three characters, if there is a lot of false in a file, you can save a considerable amount of bytes, This is very meaningful for large-scale concurrent access. */A.addeventlistener (b, C,!1) }: function(A, B, c) {a.attachevent ("On" +b, c)} } (), remove:function() { returnDocument.removeeventlistener?function(A, B, c) {A.removeeventlistener (b, C,!1) }: function(A, B, c) {a.detachevent ("On" +b, c)} } (), Stop:function(a) {a&& a.stoppropagation? (A.stoppropagation (), A.preventdefault ()): (window.event.cancelBubble =! 0, Window.event.returnValue =!1) } };
JS Classic Code Learning one: Using ternary operators to handle JavaScript compatibility