How would this code be refactored to use jQuery?

Posted by C.W.Holeman II on Stack Overflow See other posts from Stack Overflow or by C.W.Holeman II
Published on 2010-03-26T04:13:35Z Indexed on 2010/03/26 4:23 UTC
Read the original article Hit count: 435

Filed under:
|

How would this code be refactored to use jQuery?

var lu = function luf(aPrefix){
  switch (aPrefix){
    case 'xhtml':
      return 'http://www.w3.org/1999/xhtml';
    case 'math':
      return 'http://www.w3.org/1998/Math/MathML';
    case 'svg':
      return 'http://www.w3.org/2000/svg';
    case 'emleo':
      return 'http://emle.sf.net/emle020000/emleo';
  }
  return '';
 };
function emleProcessOnLoad(aThis) {
  var result = document.evaluate("//xhtml:span[@class='emleOnLoad']",
    aThis.document, lu, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
  for (var jj=0; jj<result.snapshotLength; jj++){
    var emleOnLoad = result.snapshotItem(jj).textContent;
    eval("var emleThis=result.snapshotItem(jj);" + emleOnLoad);
  }
}

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery