If I use the following javascript function with CSS selector value of "#game .screen.active" as argument
var activeScreen = document.querySelectorAll("#game .screen.active")[0];
The above statement will assign to the activeScreen variable the document element with
id="game" and class="screen" which is currently an active screen.
I have the following question :
1. Is that true, that there will be only one active screen at any point in time?
2. If you provide more than one CSS selectors as argument to the querySelectorAll() function,
do we have to seperate them using comma(',') like the below statement?
var activeScreen = document.querySelectorAll("#game, .screen.active")[0];
What is the difference between the above two statements, one with the comma and one without
the comma?
The Structure of my index.html
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>HTML5 Game</title>
<link rel="stylesheet" href="styles/main.css" />
<script src="scripts/gameEngine.js"></script>
</head>
<body>
<div id="game">
<div class="screen" id="splash-screen">
<h1 class="logo">Ninja <br/>Warrior</h1>
<span class="continue">Click to continue</span>
</div>
<div class="screen" id="main-menu"></div>
<div class="screen" id="game-screen"></div>
<div class="screen" id="high-scores"></div>
</div>
</body>
</html>