Scroll cannot be captured in the IE8-9, and cannot be used as event proxy because it cannot be bubbling. It can be handled by capture under ff.
The focus and blur events can be simulated by focusin and focusout events in IE. However, for general elements that cannot be non-form elements, links, images, and other elements, we need to set tabindex for the focus and blur events, in order to make it have the ability to capture or lose the focus. in some very new standard browsers, domfocusin and domfocusout can be used for simulation, but such events that cannot be called using onxxx may be discarded at any time, so I will not use them for simulation. focus, blur event proxy.
</P> <p> <! Doctype HTML> <br/> <pead> </P> <p> <title> Event System notes situ zhengmei </title> </P> <p> <style> <br/> Div. test {<br/> width: 400px; <br/> Height: 320px; <br/> margin: 0 15px; <br/> background-color: # d6edfc; <br/> overflow: auto; <br/> float: Left; <br/>}< br/> Div. test1 {<br/> Height: 200px; <br/> Background: red; <br/>}</P> <p> </style> </P> <p> <SCRIPT> </P> <p> window. onload = function () {</P> <p> var El = document. getelementbyid ("test"); <br/> el. addeventlistener ("domfocusin", function (e) {<br/> console. log (E. type) <br/>}, false) </P> <p> el. addeventlistener ("domfocusout", function (e) {<br/> console. log (E. type) <br/>}, false); </P> <p> el. addeventlistener ("Focus", function (e) {<br/> console. log (E. type) <br/>}, false) </P> <p> el. addeventlistener ("Blur", function (e) {<br/> console. log (E. type) <br/>}, false ); </P> <p >}</P> <p> </SCRIPT> <br/> </pead> <br/> <body> <br/> <H1> mouseenter and mouseleave </p> <br/> <Div class = "test" id = "test" tabindex = "-1"> <br/> <Div class =" test1 "tabindex ="-1 "> </div> <br/> </div> </P> <p> </body> <br/> </ptml> <br/>
RunCode
Scroll can only be used between two divs or windows. A scroll bar is required. in IE, it cannot be bubble or captured, and the bubble situation in the standard browser is also very messy. It is only important to determine whether a scroll bar exists, so it is not intended to support its event proxy.
// Let IE and W3C support the focus and blur and select proxies "focus_focusin, blur_focusout, select_selectstart ". replace (/\ W +/g, function (types) {types = types. split ("_"); events. special [types [0] = {livetype: Doc. dispatchevent? Types [0]: types [1], livephase :!! Doc. dispatchevent, livesetup: function (node, type, _, phase) {enablefocusin (node); Dom. BIND (node, type, function (e) {e = events. fix (E); Dom. log ("Let IE and W3C support focus and blur and select proxies") E. type = types [0]; events. handle. call (this, e) ;}, phase) ;}});