document.evaluate - Cross browser?
问题 I have been looking for a CSS selector function other than Sizzle and I have come across this function. function SparkEn(xpath,root) { xpath = xpath .replace(/((^|\|)\s*)([^/|\s]+)/g,'$2.//$3') .replace(/\.([\w-]+)(?!([^\]]*]))/g, '[@class="$1" or @class$=" $1" or @class^="$1 " or @class~=" $1 "]') .replace(/#([\w-]+)/g, '[@id="$1"]') .replace(/\/\[/g,'/*['); str = '(@\\w+|"[^"]*"|\'[^\']*\')'; xpath = xpath .replace(new RegExp(str+'\\s*~=\\s*'+str,'g'), 'contains($1,$2)') .replace(new RegExp