Since css level 4 is still in drafts, case-sensitivity selector is not compatible with most browsers. You may use filter method like this:
var divs = [].slice.call(document.querySelectorAll('div')).filter(function(el){
return el.className.match(/^foo/i);
});
Update: Need to state that you can now use css4 selector.
document.querySelectorAll('div[class^="foo" i]');
See this link for browser compatibility.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…