To cope with HTML5, it is more important to search for and match elements. Ff and Safari are the first to implement the matchesselector method, which is equivalent to jquery's is method. This is of great benefit to event proxy!
<! Doctype HTML>
<Br/> <! Doctype HTML> <br/> <pead> <br/> <title> matchesselector by situ zhengmei </title> <br/> <meta charset = "UTF-8"/> <br/> <meta content = "Ie = 8" http-equiv = "X-UA-compatible"/> <br/> <meta name =" keywords "content =" matchesselector by situ zhengmei "/> <br/> <meta name =" Description "content =" matchesselector by situ zhengmei "/> <br/> </pead> <br/> <body> </P> <p> <Div id = "foo"> matchesselector! </Div> <br/> <SCRIPT type = "text/JavaScript"> <br/> // http://dev.w3.org/2006/webapi/selectors-api2/#matchtesting <br/> var El = document. getelementbyid ("foo"); <br/> VaR method = el. matchesselector | el. webkitmatchesselector | el. extends matchesselector </P> <p> If (Method & method. call (El, "Div") {<br/> alert ("This element matches the given selector "); <br/>}</P> <p> </SCRIPT> <br/> </body> <br/> </ptml> <br/>
RunCode