Skip to content

Access content between 2 a start tag and an end tag #1443

Open
@lavanyaburlagadda1807

Description

@lavanyaburlagadda1807

I have some HTML code in that between style tag I will write some styles with classes. When added event listener with text it is not selecting the text

To Reproduce

 parser.addListener('tagstart', function (event) {
            if (event.tagName.toLowerCase() === 'style') {
               insideStyleTag = true
            }
         })

         parser.addListener('tagend', function (event) {
            if (event.tagName.toLowerCase() === 'style') {
               insideStyleTag = false
            }
         })

         parser.addListener('text', function (event) {
            if (insideStyleTag) {
               console.log('event', event)
               const cssText = event.raw
               const cssClassRegex = /\.([\w-]+)/g
               let match
               while ((match = cssClassRegex.exec(cssText)) !== null) {
                  classNames.add(match[1])
               }
            }
         })

I am expecting the content to be available at text listener

Metadata

Metadata

Assignees

No one assigned

    Labels

    keep-unstaleThe issue will not be marked as stale by the stale-bot

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions