I need to create a css stylesheet for an existhng html page. Is there any easy way to extract all the classes and ids using a script… I am familiar with python, java, c, javascript and php. Is there any library for those languages? re sems a bit overkill for me. grateful for any help.
cheers!
The easiest way to retrieve the
ids of each of the elements is to simply iterate over the elements that have anid, and retrieve that:One way to cover those browsers that don’t implement
querySelectorAll()is to create a nodeList of every element, then iterate over that (quite probably very large) nodeList, test for theidand, if it exists, push that into the array: