Lurker News

Comments (94) 31 threads

Earlier comments
kennyadam#
This is great.
kccqzy3 replies#
> The only other style that is special is "style" itself, which has to include an escape character to avoid being taken literally.

    style::before {content:'
I don't think it's a bug. After all, browsers have very lenient parsers and if there's a syntax error (unterminated quote) in the style it shouldn't affect the rest of the HTML. The same goes for JavaScript: you probably still can't use the string literal '' within an inline script.
pluma#
Think about the failure cases for `` and `` and it's obvious why the spec defines them that way.

If CSS and JS syntax were to decide when the end tags can appear, some malformed CSS or JS would break the end tag and cause the entire rest of the document to vanish as the browser wouldn't recognise it as HTML.

throwaway666661 reply#
And image tags do not have pseudo selectors/elements.
tazard#
With the experience of Chrome, neither do input tags. In fact I believe only 'container' elements are supposed to.
missblit1 reply#
Yep not a bug. Or at least if it's a bug, it's a bug in the HTML spec. But really I think it's pretty reasonable behavior.

Short answer is standard says to parse the contents of

ChrisSD#
> Or at least if it's a bug, it's a bug in the HTML spec.

Then again the HTML5 spec is based on what browsers already did, bugs included. Whether or not it's desirable behaviour or a bug is a moot point now. HTML is the way it is because of its history.

omk1 reply#
Do we need a better prefix for cool stuff like this? Maybe HN Art?
fredley#
Not really. Show HN already gives it a boost, and keeping track of classifications of Show HN stuff is almost certainly more effort than it's worth.
JoshuaRLi2 replies#
Very cool - thanks for sharing, and the shoutout (consider also replacing 38rem/2rem with 70ch/2ch)!
LeonB#
cheers, i've applied that now
e12e1 reply#
I wasn't aware of "ch". Why prefer it to rem? (and isn't ch in family with em, not rem - that is, "advance width" relative to element font size, not root element font size?)

Ed: i guess in this case 1 rem is roughly 2 em (styled element has 50% font size) - and 1 ch is roughly 1 em?

Load more comments