The <br> case should work because it's a void element, so we detect that automatically. You're right that <p/> would be allowed though. I need to double-check whether that's legitimate in the HTML spec (I think it might be legal in XML).

Sent from tiny phone

On Aug 1, 2013, at 8:12 AM, "Kevin Dangoor" <notifications@github.com<mailto:notifications@github.com>> wrote:


In src/language/HTMLTokenizer.js:

> @@ -162,16 +155,17 @@ define(function (require, exports, module) {
>                  }
>              } else if (this._state === IN_TAG_NAME) {
>                  if (c === "/") {
> -                    this._emitToken("onopentagname");
> -                    this._cbs.onselfclosingtag();
> +                    this._emitToken("opentagname");
> +                    // Bit of a hack: assume that this will be followed by the ">".
> +                    this._emitSpecialToken("selfclosingtag", this._index + 2);


One thing I noticed is that selfclosingtag is emitted for <br/> but not for <br>. There's an _isEmptyTag function in HTMLInstrumentation that lists things like br and link, but it doesn't appear that that function is called anywhere. I'm certain there's a bug here... the question is whether we fix it here or on the parsing side in HTMLInstrumentation.

I'd say that my preference would be to drop the "selfclosingtag" special token and make use of _isEmptyTag in HTMLInstrumentation, because the parsing side is what has the knowledge about what is legitimate to do. <p/> would emit "selfclosingtag" when that's really not legit.

—
Reply to this email directly or view it on GitHub<https://github.com/adobe/brackets/pull/4619/files#r5531791>.