Which of the following statement is false with respect to DOM?
2022
Which of the following statement is false with respect to DOM?
- A.
DOM is a way to represent the webpage in a structured hierarchical way DOM
- B.
With DOM we can easily access and manipulate tags, IDs, classes or elements of HTML DOM
- C.
Using DOM, the CSS gets access to the HTML and the JavaScript of the web page DOM
- D.
Window object is always at the top of the DOM hierarchy DOM
Attempted by 125 students.
Show answer & explanation
Correct answer: C
Answer: The statement "Using DOM, the CSS gets access to the HTML and the JavaScript of the web page" is false. Key points: The DOM (Document Object Model) is an interface that represents the HTML document as a tree of nodes. It is primarily a programming API used by scripts (especially JavaScript) to read and modify the document structure, content, and styles.
CSS is a styling language whose rules apply styles to HTML elements. CSS does not execute code and does not 'access' or run JavaScript via the DOM.
JavaScript can access and modify HTML and CSS via the DOM (and can manipulate styles or classes). In other words, JavaScript uses the DOM to control structure and styling, but CSS does not use the DOM to access JavaScript.
Therefore the statement is false because it incorrectly claims that CSS uses the DOM to access both HTML and JavaScript.
A video solution is available for this question — log in and enroll to watch it.