I was going through the jQuery documentation and I was really confused by the all selector ("*") example. Why does the 'h3' tag in this example get the red border? Here is the official documentation.
var elementCount = $( "*" ).css( "border", "3px solid red" ).length;
$( "body" ).prepend( "<h3>" + elementCount + " elements found</h3>" );
h3 {
margin: 0;
}
div, span, p {
width: 80px;
height: 40px;
float: left;
padding: 10px;
margin: 10px;
background-color: #EEEEEE;
}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>all demo</title>
<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
</head>
<body>
<div>DIV</div>
<span>SPAN</span>
<p>P <button>Button</button></p>
</body>
</html>
Since the prepend statement is executed after the first one, I was expecting the h3 tag to have no red border.
I inspected the h3 element using browser tools and it does not show me any red border in its style either.