Skip to content
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

classList polyfill missing? #287

Closed
kroko opened this issue Mar 9, 2017 · 1 comment
Closed

classList polyfill missing? #287

kroko opened this issue Mar 9, 2017 · 1 comment

Comments

@kroko
Copy link

kroko commented Mar 9, 2017

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!

@zloirock
Copy link
Owner

zloirock commented Apr 4, 2017

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

@zloirock zloirock closed this as completed Apr 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants