Core-js: classList polyfill missing?

Created on 9 Mar 2017  路  1Comment  路  Source: zloirock/core-js

Hi,

Am I wrong or classList is not included?
_Supported engines_ are also older than IE 10, where classList is not available.
I am not interested to deploy for IE9 :), however lot of times "please use/choose newer browser" screen uses some class switching n stuff, so it would be needed.

Test case (using webpack 2)

_site.js_

'use strict';
import 'babel-polyfill';
import './global.scss';
const myArrowFunction = () => { // hello-world test babel for arrow fcn
  const div = document.querySelector('.app');
  div.innerHTML = '<h1>Hello JS</h1><p>Lorem ipsum.</p>';
  div.classList.add('some-class');  // test for classList polyfill
  console.log('Hello JS!');
};
myArrowFunction();

_.babelrc_

{
  "presets": [
    [
      "env",
        {
        "targets": {
          "browsers": [
            "IE 9"
          ]
        },
        "useBuiltIns": true,
        "modules": false,
        "debug": true
     }
   ]
  ]
}

Debug output does not mention classList. Nor does compiled site.js - only one occurrence of classList, namely the original code div.classList.add('some-class'), thus no polyfill anywhere in the compiled stuff.

If it really lacks, then I would have to manually add it - which would not be _elegant_ when using browserslist to _globally_ control things js polys (via barbel-env and babel-polyfill) and autoprefixer (via postcss).

So am i missing something? If it is not included, is there a specific reason not to (because it is "DOM manipulation" that core-js does not cover)?

Thanks!

Most helpful comment

Sorry, but classlist out of scope core-js - it's only JavaScript core and some related cross-platform features.

>All comments

Sorry, but classlist out of scope core-js - it's only JavaScript core and some related cross-platform features.

Was this page helpful?
0 / 5 - 0 ratings