fb55/domutils

findAll element not showing class

NorseGaud opened this issue · 2 comments

On https://developer.apple.com/documentation/macos-release-notes you'll see a div with <div data-v-21735da6="" data-v-21125d33="" id="app" class="core-app">

If I do the following, I don't see attribs with class:

const macosReleaseNotes = await axios.get("https://developer.apple.com/documentation/macos-release-notes")
    .then(response => {
      if (response.status === 200) return parseDocument(response.data)
    })
    .catch(err => {
      throw new Error(err)
    })

const elementWithId = domutils.findAll(el => el.name === 'div', macosReleaseNotes.children, true)
console.log(elementWithId[1].attribs);

The response is { id: 'app' }.

How do I find the class?

I can't even do this:

<div data-v-8029502c="" class="title-container"><!----><span data-v-1ab7c05f="" data-v-8029502c="" id="label--196255993" hidden="hidden"> 1 of 46 symbols inside &lt;root&gt; </span><h3 data-v-1ab7c05f="" data-v-8029502c="" id="-196255993" tabindex="0" aria-describedby="label--196255993 usage--196255993" class="leaf-link"><p data-v-fc9a395c="" data-v-1ab7c05f="" class="highlight" data-v-8029502c="">macOS 14</p></h3><!----></div>
const macosReleaseNotes = await axios.get("https://developer.apple.com/documentation/macos-release-notes")
    .then(response => {
      if (response.status === 200) return parseDocument(response.data)
    })
    .catch(err => {
      throw new Error(err)
    })

const titleContainers = domutils.findAll(el => el.attribs && el.attribs.class === 'title-container', macosReleaseNotes.children, true)

console.log(titleContainers)

Class is always empty...

Nevermind, looks as if the response.data is ...<div id="app"></div></body></html>.