1. Steve

    21.06.2008 01:17

    This is a great package, nice and compact!

    One spot I had to fix was to replace the "document.write" statement in hightlight.js with DOM method calls. This is because document.write creates a new page if it is invoked after the body completely loads. This is a problem if you are highlighting code that has been dynamically generated by other javascript.

    I changed this:
    ——-
    document.write('<script type="text/javascript" src="' + path + 'languages/' + filename + '.js"></script>');
    ——-

    To this:
    ——-
    var head = document.getElementsByTagName("HEAD")[0];
    var script;

    for ...

    //document.write('<script type="text/javascript" src="' + path + 'languages/' + filename + '.js"></script>');
    script = document.createElement('script');
    script.src = path + 'languages/' + filename + '.js';
    script.type = "text/javascript";
    script.defer = true;
    head.appendChild(script);
    ——-

    Hopefully this change will be of some use to you. I have tested this with IE7.

    Thanks again.
    Steve
  2. Иван Сагалаев

    24.06.2008 15:39

    Thanks, Steve! I'll look into it. I have a feeling that this might not work in some popular browsers.

bbcode