elements, all ads.
Developer wants to quickly and temporarily remove them.
Options:
Options
Discussion
No comments yet. Be the first to comment.
Be respectful. No spam.
Correct Answer:
C
Explanation
The browser console allows for the execution of JavaScript code on the current page. A script can quickly select all elements with the class ad-library-item using document.querySelectorAll('.ad-library-item') and then iterate through them to remove each one from the DOM. This is the most efficient and direct method for temporarily removing a large number of elements based on a class.
Why Incorrect
A. Preventing the load event is a blunt tool that would affect the entire page functionality, not just the ads.
B. The DOM inspector does not have a feature to prevent events from firing; this is typically done via the console or sources panel.
D. Using the DOM inspector to manually find and delete over 50 individual elements would be extremely slow and inefficient.
References
1. Mozilla Developer Network (MDN). Document.querySelectorAll(). "The Document method querySelectorAll() returns a static (not live) NodeList representing a list of the document's elements that match the specified group of selectors."
2. Salesforce Lightning Web Components Dev Guide. "Debug in the Browser". This guide details the use of the browser console for inspecting and manipulating the DOM during development.