//create method getElementsByClassName for document if(!document.getElementsByClassName){ document.getElementsByClassName = function(className, element){ var children = (element || document).getElementsByTagName('*'); var elements = new Array(); for
在代码前面加如下代码: if (!document.getElementsByClassName) { document.getElementsByClassName = function (className, element) { var children = (element || document).getElementsByTagName('*'); var elements = new Array(); for (var i = 0; i < children.length; i++
var querySelector = function(selector) { //TODO 先简单兼容,后续继续扩展: var element = null; if(document.querySelector) { element = document.querySelector(selector); } else { var selectors = selector.split(' '); var context = document; for(var i = 0, len = sele