Skip to content
This repository has been archived by the owner on Mar 28, 2019. It is now read-only.

A message that could be improved with automatically closed tags #66

Open
pamelafox opened this issue Nov 30, 2014 · 6 comments
Open

A message that could be improved with automatically closed tags #66

pamelafox opened this issue Nov 30, 2014 · 6 comments

Comments

@pamelafox
Copy link

The following HTML:

<!DOCTYPE HTML>
<html>
    <head>
        <title>Ahora es Cuba</title>
        <meta charset="utf-8">
    </head>
    <body>
       <p><h1><a href="#bla">AHORA ES CUBA</a></h1>
        </p>
    </body>
</html>

results in "The closing </p> tag here doesn't pair with the opening <body> tag here. This is likely due to a missing </body> tag."

It took me a while to realize the problem is that they've put an <h1> inside a <p>, and that must auto-close the <p>. Do you think it's possible to do a more helpful message there?
(It took me a while to figure it out myself)

@Pomax
Copy link
Contributor

Pomax commented Nov 30, 2014

specwise, you can't even put an <h1> inside a <p>. Rather than autoclose, that should definitely be an error (no block content in paragraphs: only flow content allowed). However, it would be nice if elements knew which content was allowed inside of them so that the error reporter was more appropriate. That'll like be a fairly big change though, as it requires adding a parsing mode while walking the source code. Probably worth doing, but likely not until mid-December (There's an all-staff workweek next week, with quite a few people taking a few extra days off afterward)

@pamelafox
Copy link
Author

This isn't a scientific data point, but of all the problem reports I've triaged from students today, this issue is the most prevalent, to help you with prioritizing. Always happens with <p> and heading elements.
(Thanks for being receptive to this feedback, by the way.)

@Pomax
Copy link
Contributor

Pomax commented Dec 1, 2014

we can certainly stub it as <p> with <h1> and then iterate on it! (also, if you want to use html strings in github, you'll need to surround them with backticks, or github will just leave them as active html and they disappear, at best, or do funky stuff, at worst =D)

@pamelafox
Copy link
Author

@Pomax
Copy link
Contributor

Pomax commented Dec 11, 2014

yep, looks like it. I'm going to grab some coffee and tackle this "which element allows which mode"

@sedge
Copy link

sedge commented May 5, 2015

@pamelafox Is this still a problem?

@Pomax Pomax mentioned this issue Sep 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants