Access content between 2 a start tag and an end tag
Open
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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