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

Use classList API if available #8636

Closed
wants to merge 1 commit into from

Conversation

dhoko
Copy link

@dhoko dhoko commented Aug 25, 2015

We can use the ClassList API if available on modern browsers cf Compat-table

There is a bug with IE11 (multiples arguments, with add/remove), but it's not problem

@mattab
Copy link
Member

mattab commented Sep 11, 2015

Thanks for the PR @dhoko

@tsteur could you maybe review this one and decide whether to merge?

@mattab mattab added this to the 2.15.1 milestone Sep 11, 2015

// For modern browsers cf http://caniuse.com/#search=classList
if(node.classList) {
return node.classList.contains(klassName);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do all browsers that implement node.classList also return a DOMTokenList that includes the contains() method?

A problem is that our tests will only cover one of both ways. Possibly we should split the method into two methods and test them separately @mattab ? Or we need to find a way to run these tests in an old browser eg IE6 regularly and on newer ones

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, via can I use, we have only two issues for the partial support:

  • toggle second arg
  • svg support

To test, why don't you use browserstack ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're using saucelabs partially for manual testing but we'd need to run them automated on each commit via travis. This would be doable but it'd need to be implemented / configured to run them automatically via saucelabs (or browserstack).

Also a problem is, I think, that some of the tests currently do not work eg on IE6. Not because piwik.js is not compatible with IE6 but I think some tests aren't.

So those are the two problems so far

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think just to be safe we should also check for node.classList && node.classList.contains

@mattab mattab modified the milestones: 3.0.0, 2.15.1 Dec 21, 2015
@mattab
Copy link
Member

mattab commented Dec 21, 2015

Moving to 3.0.0 for now

@tsteur
Copy link
Member

tsteur commented Aug 30, 2016

@dhoko I'd be happy to merge this PR but we would need this PR for the "3.x-dev" branch. The PR points to the "master" brach which is Piwik 2 which is in LTS mode and we merge only critical fixes for master. I'll close this issue for now but be cool if you could recreate the PR for 3.x-dev

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

Successfully merging this pull request may close these issues.

None yet

3 participants