Prism: Can we use Element.classList or not?

Created on 16 Mar 2019  路  5Comments  路  Source: PrismJS/prism

I just want to ask whether we use Element.classList or not. Cross-browser support is not perfect but it should be good enough.

I'm asking because I thought that we don't use .classList but plugins like Line numbers are sending mixed messages, so I'm not sure.

/cc @mAAdhaTTah

plugins

Most helpful comment

True, but I'm not a fan of adding polyfills to core features. If we are to drop old IE compatibility then we don't have to bother too much about this (but we could list this polyfill in an appropriate section of the readme). And if we were to keep old IE compatibility, adding this polyfill would still require a major version bump.

All 5 comments

Well, as long as we don鈥檛 use it on SVG elements and avoid using the replace() method, we should be fine.

We've been trying to stay compatible with IE9 for quite some time I believe (although not _actively_ trying AFAICT), at least for prism-core.
I think we could benefit from upgrading our code to support more recent browsers, but this would require bumping Prism to the next major version.
I haven't had the chance to look at browser usage worldwide for a while, I believe Prism is used by quite a bunch of Chinese projects, so we should be careful about this.

Oh, and now I just saw an issue where we speak about dropping IE11 support. Haha we might not be compatible with IE9 at all, actually. I don't know anymore. A major version with explicit browser support (at least in the readme) would be great.

True, but I'm not a fan of adding polyfills to core features. If we are to drop old IE compatibility then we don't have to bother too much about this (but we could list this polyfill in an appropriate section of the readme). And if we were to keep old IE compatibility, adding this polyfill would still require a major version bump.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

apollolux picture apollolux  路  4Comments

neginbasiri picture neginbasiri  路  8Comments

sheljohn picture sheljohn  路  4Comments

huweihuang picture huweihuang  路  6Comments

RobLoach picture RobLoach  路  9Comments