I was going through a p rewritten jQuery code . I’m not able to understand the following code .
$('body > *:not(#print-modal):not(script)').clone();
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This selector matches any tag that is:
<body>print-modaland<script>tag.It then clones all these elements with
.clone(), although nothing is done with theclone()d object, which is strange.A more in-depth explanation:
body > *means “select all elements that are direct descendants of<body>“, the wildcard*selecting every tag. Next, the two:not()pseudo-classes filter remove the element with the IDprint_modal, as well as any<script>tags.Reference:
:not()selector