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();
This selector matches any tag that is:
<body>print-modal and<script> tag.It then clones all these elements with .clone(), although nothing is done with the clone()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 ID print_modal, as well as any <script> tags.
Reference:
:not() selectorIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With