-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IE8 support discussion #9
Comments
Prism itself shouldn't throw any errors on IE6. It's the page that does. |
Oh, super! How about making this more clear in the documentation? Something like:
|
Oh good point. I also want to look into the possibility of writing a plugin that adds IE8 support. If that's possible, it would be perfect. |
A plugin that adds IE6–8 support would be perfect++ :) |
Notice that I said IE8 support. Who bothers with IE6-7 anymore? |
I did notice you said IE8 only, hence my previous comment: “a plugin that adds IE6–8 support would be even better”. Sorry for the confusion.
I do for some client projects, and for pretty much all browser-based open-source projects I release. If I release a script that works on IE6 and I want to use a syntax highlighter for its documentation, I wouldn’t use one that only works in modern browsers — I would want the documentation to be highlighted in all browsers the script itself supports. Of course, not all of Prism would have to support IE6+. E.g. instead of calling |
Oh, that's a good idea. Will look into it. |
Hi Mathias, I started work on this, here: http://prismjs.com/plugins/ie8/ |
/cc @jdalton |
I solved it in RegexPal by using This comment is in my circa 1997 RegexPal source code: /* outerHTML is used to work around the fact that IE applies text normalization
when using innerHTML, which can cause problems with whitespace, etc. Note that
even this approach doesn't work with some elements such as <div>. However, it
mostly works with <pre> elements, at least. */ And here's my old code for this: function replaceOuterHtml (el, html) {
replaceHtml(el, "");
if (el.outerHTML) { // If IE
var id = el.id,
className = el.className,
nodeName = el.nodeName;
el.outerHTML = "<" + nodeName + " id=\"" + id + "\" class=\"" + className + "\">" + html + "</" + nodeName + ">";
el = $(id); // Reassign, since we just overwrote the element in the DOM
} else {
el.innerHTML = html;
}
return el;
}; The |
Hi Steven, I'm aware of the Hmmm. Unless |
@LeaVerou I realize we have competing projects, but I think prism looks nice. I have the same problem in https://github.com/ccampbell/rainbow and haven't had the time or energy to find a fix for it. I was able to do some hackery to get it to somewhat work, but I ran into the same issue where some linebreaks were just missing completely. You can look at the discussion here: It's nice that most developers don't use these browsers so therefore the target audience for showing code samples is usually people using modern browsers. |
Thank you @ccampbell! I quite like Rainbow too, kudos! Thanks a lot for the discussion, that will help very much! However, I'm a bit too busy with my new job right now, so anything Prism-related will have to wait a bit. |
Just curious, is there anyone that has managed to make a plugin to support IE8? |
Could you please use a non-minified version, so that the error location is more narrow? |
@danielwertheim there already is one: https://github.com/LeaVerou/prism/tree/gh-pages/plugins/ie8 |
@apfelbox here you have I think the problem is with |
Ok, addEventListener is in fact undefined in IE8, but I will need to take a closer look at the first example. |
The reason the plugin is not listed anywhere in the website is that it’s not finished. It solves some issues with IE8 but not all, so I just gave up at some point as it wasn't worth that much effort for a dying browser. Regarding your bug @lukaszlenart, the new issue is because the pile of shit called IE8 doesn’t even support Furthermore, I’d find it very strange if |
I'm not using the if (document.addEventListener) {
document.addEventListener('hashchange', applyHash);
} |
(must test on other browsers) |
That would just prevent the error, but it would also remove the functionality of changing the hash to highlight certain lines (which you may not want anyway) in IE8. I’d hardly call it a “solution”, more like sweeping under the rug. |
highlighting doesn't work at all in IE8 ;-) I was wrongly assuming that |
I will take a look at it - unfortunately not before I can use my other computer (currently running 10.10 and parallels doesn't work on it anymore (just like everything else doesn't work anymore, yay)). |
Prism is not supposed to work in IE8. That would require too much code for an edge case. That was the whole point of developing a plugin for it. However, IE8 support is definitely not a priority. |
I don't care about supporting IE8 - just don't break anything in IE8 ;-) |
Oh, that’s a different issue. Yes, nothing should break. If it does, we should fix it. |
Right now I've implemented my changes and testing them, when new version of PrismJS will be released I will give it a try :-) |
Lots of errors in IE8, starting with the 'self' reference at the start of prism-core.js |
I understand a decision has been made not to support these browsers. Your blog post mentioned nothing would break in IE8, though — would you be open to updating Prism.js so it doesn’t throw errors in IE6?
(I quickly “tested” this by opening prismjs.com in IE6, so perhaps the issue is not in Prism.js at all — but either way it would be nice to have this mentioned on the home page.)
The text was updated successfully, but these errors were encountered: