Advertisement
Guest User

Untitled

a guest
Feb 28th, 2020
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1.  
  2. <script>
  3. var myFunction = function(a){ // Supply a valid selector (e.g '*' for wildcard)
  4. [].forEach.call( // Treat Nodelist as an Array (fewer bytes than Array.prototype.forEach.call(...);)
  5. // Gets the prototype of Array & uses call to execute the function on the NodeList.
  6. document.querySelectorAll(a), // Query DOM for elements matching the supplied selector
  7. // (For 110 bytes, use $$() as Chrome, Safari & FF expose it in DevTools)
  8. function(b){
  9. b.style.outline = "1px solid #" + // Set the selector outline
  10. (~~(Math.random()*(1<<24))) // Pick a valid random CSS hex color
  11. .toString(16)}) // Convert to a base 16 number. BOOM.
  12. }
  13. myFunction('*');
  14. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement