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

Bug and a solution to "Mouse events basics" section and "Selectable list" task #123

Closed
Annis-Monadjem opened this issue Aug 4, 2017 · 2 comments

Comments

@Annis-Monadjem
Copy link
Contributor

Annis-Monadjem commented Aug 4, 2017

Hello Ilaya and thank you very much for you fantastic work on
javascript.info and your positive impact on my learning javascript
and web development. Truly, your site is the very best from what I have seen
till now. My hope is that you will continue with this wonderful project into
the future.
Below I'm suggesting a correction to the task. In Mouse events basics section
and Selectable list task your solution has a bug. The bug: using Ctrl first
select few lines; next release Ctrl and select/unselect one line. Now you
should see what is happening: the lines are not unselected the same way as you
are clicking.
May I suggest this solution, which to my best knowledge is working very well (the head and body are same/unchanged):

  <script>
    ul.onmousedown = function(event)
    {
      return false;
    }
    ul.onclick = function(event)
    {
      if (event.ctrlKey)
      {
        event.target.classList.toggle('selected');
      }
      else
      {
        for (let li of ul.querySelectorAll('li'))
        {
          li.classList.remove('selected');
        }
        event.target.classList.add('selected');
      }
    }
  </script>

PS: I've posted this comment on Disqus site gives me terrible problems e.g. my comments don't show up on javascript.info. Also I cannot follow over people comments on Disqus. I've checked my settings with Disqus, but it's simply not working well. Hence, I'm double posting it this time. Other than that: thank you Ilaya for
javascript.info

PSS: Just to let you know that I've placed earlier 9 comments in Disqus (on javascript.info) but not even one has appeared on Disqus.

@iliakan
Copy link
Member

iliakan commented Aug 4, 2017

Hi, strange, I'll look into it.

@iliakan
Copy link
Member

iliakan commented Aug 5, 2017

Thanks, fixed!

@iliakan iliakan closed this as completed Aug 5, 2017
iliakan added a commit that referenced this issue Aug 5, 2017
athena0304 pushed a commit to athena0304/javascript-tutorial-en that referenced this issue Aug 21, 2018
…prototypes/ (javascript-tutorial#123)

* Update article.md

* Update task.md

* Update task.md

* Update article.md

* Update article.md

* Update task.md

* Update task.md

* Update article.md
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