<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/what-s-in-a-tag-name-javascript-apparently-glm8aqban" -->

---
title: What's in a tag name? JavaScript, apparently | daily.dev
description: An exploration of obscure HTML tag name parsing behavior reveals several novel XSS vectors. By abusing the fact that tag names can contain unusual characters...
canonical: https://daily.dev/posts/what-s-in-a-tag-name-javascript-apparently-glm8aqban
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: What's in a tag name? JavaScript, apparently | daily.dev
og:description: An exploration of obscure HTML tag name parsing behavior reveals several novel XSS vectors. By abusing the fact that tag names can contain unusual characters...
og:url: https://daily.dev/posts/what-s-in-a-tag-name-javascript-apparently-glm8aqban
og:image: https://api.daily.dev/og/posts/glm8AQBAN.png
og:image:alt: What's in a tag name? JavaScript, apparently
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# What's in a tag name? JavaScript, apparently

**[Lobsters](https://daily.dev/sources/lobsters)** · 3 min read · 1 upvotes · 0 comments

## Summary

An exploration of obscure HTML tag name parsing behavior reveals several novel XSS vectors. By abusing the fact that tag names can contain unusual characters and that the localName property returns a lowercased version of a tag name, it's possible to construct payloads using onfocus event chaining, tabindex/contenteditable focus tricks, and DOM properties like attributes, part, classList, and setHTMLUnsafe. These techniques can bypass WAF signatures and blocklists by hiding JavaScript inside seemingly harmless tag names and attribute values, working across all major browsers.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://portswigger.net/research/whats-in-a-tag-name-javascript-apparently>

## Questions this post answers

### How can the localName DOM property be abused to create an XSS payload that bypasses a WAF?

An attacker can place uppercase JavaScript inside a malformed tag name, since browsers store the tag name in uppercase but expose a lowercased version through the localName property. By chaining a focusable element (via tabindex or contenteditable) with an onfocus handler that reads localName and constructs a new function, the lowercase tag name gets executed as JavaScript, evading blocklists that look for lowercase alert or eval keywords.

_Security teams hardening WAF rules against XSS can follow daily.dev for research on evasion techniques like this._

### Do line separator and paragraph separator Unicode characters get sanitized inside HTML tag names the way whitespace does?

No, line separator (U+2028) and paragraph separator (U+2029) characters pass through tag name transformations untouched, unlike regular whitespace, forward slashes, and newlines which do get transformed. Because JavaScript treats these characters like newlines, they can be embedded inside a malformed tag name to construct unusual-looking XSS vectors that still execute as valid code.

_Developers writing input sanitizers can track edge cases like this via daily.dev to avoid Unicode-based bypasses._

## Community take

How the wider developer community reacted, aggregated from 2 discussions and 10 comments across lobsters, hackernews (as of 2026-09-14).

**TL;DR:** Commenters are intrigued by the cleverness of the technique but debate its practical exploitability, generally agreeing it's more useful for bypassing WAFs/blocklists than as a direct real-world XSS vector, while some fault the writeup for relying on experimentation instead of citing the HTML/DOM specs.

**Sentiment:** 20% positive · 55% mixed · 25% skeptical

**The case for**

- Several found the research neat and appreciated seeing the author's exploration process that led to a minimal, contrived XSS vector.
- Multiple agreed the technique is realistically useful for bypassing WAFs and obscure pattern/blocklist filters.
- One noted that even 'unlikely' tricks can become dangerous once chained with other weaknesses.

**The pushback**

- Some questioned the practical usefulness, doubting a site would ever create elements from untrusted tag names with the needed attributes.
- One critic felt the author should have referenced the HTML/DOM specs directly rather than relying on ad hoc experimentation and fuzzing, since parsing behavior is exhaustively defined and consistent across implementations.
- A commenter initially noted the post didn't specify which browsers were affected before realizing it was addressed in the article.

**By community**

- lobsters (mixed): Discussion mixes appreciation for the cleverness with skepticism about real-world exploitability and criticism that the spec wasn't consulted directly.
- hackernews (mixed): No comment content was provided, so no discernible take could be formed.

**Hottest debate:** Whether this is a genuinely exploitable XSS technique or mostly a fun experimental curiosity with niche WAF-bypass value.

**Open questions**

- Could this technique realistically be chained with other vulnerabilities to form a full exploit in practice?

**Highlights**

> No, I think this is mostly fun and experimental.  Even if you could get someone to create that element, it’s unlikely you could get the required attributes in.  Obscure filters and bad block listing seems like the more realistic scenario.
> — [freddyb on lobsters · 3 points, 1 comments](https://lobste.rs/s/lbsvk7/what_s_tag_name_javascript_apparently#c_vzzkbh)

> I was genuinely disappointed to see “wondering what characters are allowed in a tag” followed by *experimentation* and even *fuzzing* rather than reference to the spec—I would have expected anyone from PortSwigger to know that HTML has a dependable spec, and that *especially* around parsing, all implementations match it exactly (barring new features, like how they just resurrected processing instructions). I know I reach to the HTML Standard quite frequently over subtle details; it’s typically faster and more reliable than experimenting. The [tag open state](https://html.spec.whatwg.org/multipage/parsing.html#tag-open-state) shows that the tag name has to start with ASCII alpha, and then the [tag name state](https://html.spec.whatwg.org/multipage/parsing.html#tag-name-state) shows that *anything* goes other than ␉, ␊, ␌, ␠, /, > and ␀, with ASCII uppercase immediately lowercased. So `<alert(1)>` is considered legal syntax, no parse error or such (though a validator will probably still complain that there’s no such element). Related fun stuff: at unspecified times and browsers in history (but long ago, and not consistent across browsers), `<br/>` would create an element with local name `br/` (which was why `<br />` became the XHTML/HTML-polyglot way of writing a line break, found in many CMSes; whereas XML would customarily skip the space), and `<br />` would create an element with local name `br` and one attribute named `/` with value empty string (and I honestly think they should have left it that way rather than ignoring a trailing slash—now we’ve somehow ended up with a whole lot of developers that think the `/` *does* something or is in any way worthwhile).
> — [chrismorgan on lobsters · 1 points](https://lobste.rs/s/lbsvk7/what_s_tag_name_javascript_apparently#c_en5tsv)

> It's always weird and unlikely... until someone chains it with another weird thing for a full exploit ;)
> — [viraptor on lobsters · 3 points](https://lobste.rs/s/lbsvk7/what_s_tag_name_javascript_apparently#c_aa5hvb)

> Fascinating how the end result looks so simple and clearly minimal. I like how Gareth describes how he started, which avenues he explored and how he arrived at this contrived but tiny XSS vector. Just neat.
> — [freddyb on lobsters · 1 points](https://lobste.rs/s/lbsvk7/what_s_tag_name_javascript_apparently#c_lj8psf)

**Source threads**

- [lobsters](https://lobste.rs/s/lbsvk7/what_s_tag_name_javascript_apparently) · 10 points · 10 comments
- [hackernews](https://news.ycombinator.com/item?id=49448520) · 3 points · 0 comments

## Similar posts on daily.dev

- [Finding XSS Through HTML Injection — Without Fuzzing Tools](https://daily.dev/posts/finding-xss-through-html-injection-without-fuzzing-tools-c7q1ohdej) · InfoSec Write-ups · 0 upvotes · 0 comments
- [Lost, forgotten, and unfamiliar HTML](https://daily.dev/posts/lost-forgotten-and-unfamiliar-html-gzqwgcxgb) · thoughbot · 75 upvotes · 3 comments

---

Tags: [#security](https://daily.dev/tags/security), [#javascript](https://daily.dev/tags/javascript), [#dom](https://daily.dev/tags/dom)

[View this post on daily.dev](https://daily.dev/posts/what-s-in-a-tag-name-javascript-apparently-glm8aqban)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"What's in a tag name? JavaScript, apparently","url":"https://daily.dev/posts/what-s-in-a-tag-name-javascript-apparently-glm8aqban","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/what-s-in-a-tag-name-javascript-apparently-glm8aqban"},"datePublished":"2026-08-26T18:37:45.159Z","dateModified":"2026-09-14T07:43:31.949Z","description":"An exploration of obscure HTML tag name parsing behavior reveals several novel XSS vectors. By abusing the fact that tag names can contain unusual characters...","image":"https://media.daily.dev/image/upload/s--OHB84bZF--/f_auto/v1722860399/public/Placeholder%2010","thumbnailUrl":"https://media.daily.dev/image/upload/s--OHB84bZF--/f_auto/v1722860399/public/Placeholder%2010","isAccessibleForFree":true,"articleSection":"Lobsters","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Lobsters","logo":"https://media.daily.dev/image/upload/s--tl8v_Fku--/f_auto,t_logo/v1698841318/logos/lobste.jpg","url":"https://daily.dev/sources/lobsters"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/what-s-in-a-tag-name-javascript-apparently-glm8aqban","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"security,javascript,dom","timeRequired":"PT3M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Lobsters","item":"https://daily.dev/sources/lobsters"},{"@type":"ListItem","position":3,"name":"What's in a tag name? JavaScript, apparently"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/what-s-in-a-tag-name-javascript-apparently-glm8aqban#faq","mainEntity":[{"@type":"Question","name":"How can the localName DOM property be abused to create an XSS payload that bypasses a WAF?","acceptedAnswer":{"@type":"Answer","text":"An attacker can place uppercase JavaScript inside a malformed tag name, since browsers store the tag name in uppercase but expose a lowercased version through the localName property. By chaining a focusable element (via tabindex or contenteditable) with an onfocus handler that reads localName and constructs a new function, the lowercase tag name gets executed as JavaScript, evading blocklists that look for lowercase alert or eval keywords. Security teams hardening WAF rules against XSS can follow daily.dev for research on evasion techniques like this."}},{"@type":"Question","name":"Do line separator and paragraph separator Unicode characters get sanitized inside HTML tag names the way whitespace does?","acceptedAnswer":{"@type":"Answer","text":"No, line separator (U+2028) and paragraph separator (U+2029) characters pass through tag name transformations untouched, unlike regular whitespace, forward slashes, and newlines which do get transformed. Because JavaScript treats these characters like newlines, they can be embedded inside a malformed tag name to construct unusual-looking XSS vectors that still execute as valid code. Developers writing input sanitizers can track edge cases like this via daily.dev to avoid Unicode-based bypasses."}}]}
```

