cloudflare / cloudflare/lol-html
Elements within `<noscript>` cannot be rewritten
- Dominant language
- Rust
- Stars
- 2.1k
- Forks
- 111
- PR merge metrics
- No merged PRs in 30d
Description
It looks like `lol-html` currently parses the `` element as RawText, along with the usual candidates like `` and `<iframe>`. That's the correct behavior when parsing/tokenizing HTML with the [scripting flag enabled](https://www.w3.org/TR/2011/WD-html5-20110113/webappapis.html#concept-n-script).
It begs a question whether `lol-html` should be pretending to have the scripting flag enabled or disabled. I could see arguments either way, and it would at least be a useful option to have. In the current state, it's impossible to rewrite these elements that will be shown for end users not running JavaScript.
I don't know if there would be any real ramifications to turning the scripting flag on — from what I can see it only affects tokenization/parsing of the `<noscript>` element. The main downside would be breaking/confusing the parser if the `<noscript>` contains garbage — but since it should contain HTML in the case where scripting is disabled, valid HTML should be a reasonable expectation here.
_Originally posted by @bglw in https://github.com/cloudflare/lol-html/issues/184#issuecomment-1891050746_
Contributor guide
Research direction
Start by reading the HTML parsing and tokenization behavior described in the issue, then review the linked prior discussion in issue #184. Determine how a scripting-flag option should affect handling and verify that its contents can be rewritten for users without JavaScript; the issue does not name files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html, rust
- Domain
- web-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100