Return to Snippet

Revision: 10569
at January 4, 2009 20:43 by optimal

Initial Code
// Is explorer "normalisating" my closing </li> tags?
fixLists = function (html) {
  if (navigator.userAgent.indexOf ("MSIE") != -1) {
    // Convert <li> to </li><li>
    html = html.replace (/<li(\s+[^>]*)?>/gi, "</li><li$1>");
    // Then remove any that double up with the opening tag
    html = html.replace (/(<(ul|ol)(\s+[^>]*)?>)\s*<\/li>/gi, "$1");
  // And relax
  return html;

Initial URL

Initial Description
Developed as part of my DCODR experiments...

Initial Title
Fix "normalized" (broken) lists in IE  (think innerHTML)

Initial Tags

Initial Language