Challenge Target the same element with multiple jQuery Selectors has an issue.
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36.
Please describe how to reproduce this issue, and include links to screenshots if possible.
My code:
<script>
$(document).ready(function() {
$("button").addClass(animated);
$(".btn").addClass(shake);
$("#target1").addClass(btn-primary);
});
</script>
<!-- Only change code above this line. -->
<div class="container-fluid">
<h3 class="text-primary text-center">jQuery Playground</h3>
<div class="row">
<div class="col-xs-6">
<h4>#left-well</h4>
<div class="well" id="left-well">
<button class="btn btn-default target" id="target1">#target1</button>
<button class="btn btn-default target" id="target2">#target2</button>
<button class="btn btn-default target" id="target3">#target3</button>
</div>
</div>
<div class="col-xs-6">
<h4>#right-well</h4>
<div class="well" id="right-well">
<button class="btn btn-default target" id="target4">#target4</button>
<button class="btn btn-default target" id="target5">#target5</button>
<button class="btn btn-default target" id="target6">#target6</button>
</div>
</div>
</div>
</div>
This is a possible bug that got introduced with the animate effect in #9151
/cc @FreeCodeCamp/issue-moderators
@heldersepu
@raisedadead the only issue we had with this was the instructions scrolling on load. But I merged a patch for that this morning. I can't think of the reason for this?
@heldersepu shall we try and comment out the fade in/out on testsuite?
The challenge still passes with the correct code.
@Bouncey Yes that's right it passes with the right code:
the addClass should be in quotes:
$("button").addClass("animated");
I saw the animation for the instructions test messages twice though, which looked like bit buggy to me.
@raisedadead what do you mean by the animation for the instructions?
I think this issue brings a valid point ...
An invalid JS Code like:
$("button").addClass(anima");
will show: SyntaxError: Invalid or unexpected token
but something like:
$("button").addClass(anima);
does not show any error, and we do get an error on the console
Uncaught ReferenceError: anima is not defined
For some reason, if there is a syntax error, #testsuite fades out and remains hidden.
I think this issue has #9184 in common. The 'fadeOut' had a more visual effect on the test suite
Yes I agree #9184 is related!
Tests do not update on certain conditions and the fadeOut hides them
I have a PR ready to go to remove the fade out/in, but haven't looked into the test updates
I don't think the problem is on the fade out/in...
The fadeOut exposed an old problem: certain conditions the test are not updated
Let's think about it...
From a user perspective if I hit the [Run tests] button I expect to see:
Leaving behind the old tests is not a good experience
<script>$("btn").addClass(e);</script>
Show an error: ReferenceError: e is not defined
https://www.freecodecamp.com/challenges/uncomment-html#?solution=fccss%24(%22btn%22).addClass(e)%3Bfcces
<script>$(document).ready(function() {$("btn").addClass(e);});</script>
Shows no error
https://www.freecodecamp.com/challenges/uncomment-html#?solution=fccss%24(document).ready(function()%20%7B%24(%22btn%22).addClass(e)%3B%7D)%3Bfcces
I think we should focus on why there is no error message on the second case
I used this and it worked -
I added a second another segment for id "#target1"