htmlhint / htmlhint/HTMLHint

Access content between 2 a start tag and an end tag

Open
#1,443 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

keep-unstale
Dominant language
JavaScript
Stars
3.3k
Forks
474
Avg merge
1d 11h
Merged PRs (30d)
12

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the supplied JavaScript reproduction and tracing the parser's tagstart, text, and tagend listeners around a style element. Done means the style content is available through the text listener while it is between the start and end tags.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.