• (disco) in reply to urkerab
    urkerab:
    (I'm not even sure it's possible with infinite CPU and memory, because of Godel's Incompleteness Theorem.)

    Bullshit. HTML pages are not formal systems. They're turing-complete machines with a well-defined output for every case.

  • (disco) in reply to anonymous234
    anonymous234:
    They're turing-complete machines with a well-defined output for every case.

    for syntactically valid pages at least. fortunately it's proven that the validator will always halt so if you refuse to render on invalid input you will always halt.

    that is of course discarding javascript.... ;-)

  • (disco) in reply to anonymous234
    anonymous234:
    HTML pages are not formal systems. They're turing-complete machines
    Only if used with CSS3; pure HTML is not Turing-complete.
  • (disco) in reply to RaceProUK
    RaceProUK:
    'Give Up' is not an acceptable outcome either; there is only one, and that's 'fix the fucking bug so the page renders properly'.

    No, I'd say 'Give Up' is acceptable in some cases. Think infinite recursion; you'd rather have the browser give up and produce something rather than hang trying to render something it can't ever finish.

  • (disco) in reply to NedFodder

    If you're triggering infinite recursion rendering HTML you have bigger problems than infinite recursion.

  • (disco) in reply to RaceProUK

    Still, there's some number between 158 and infinity where it's better for the browser to give up than to appear to hang.

  • (disco) in reply to NedFodder

    How about one kilo/kibitag?

  • (disco) in reply to aliceif

    Today's hardware should be able to handle a megatag or two, no problem...

  • (disco) in reply to RaceProUK
    RaceProUK:
    'Give Up' is not an acceptable outcome either; there is only one, and that's 'fix the fucking bug so the page renders properly'.
    anonymous234:
    HTML pages are not formal systems. They're turing-complete machines with a well-defined output for every case.

    Actually, HTML is described by a formal standard that specifies how well-formed documents will be constructed. The proper term isn't "give up" for this combination, it's that "rendering behavior for a malformed document is undefined". That is, it is left to the browser builder to decide how the HTML rendering proceeds for a malformed document.

    But HTML itself--sans CSS3 and scripts--is not Turing complete. So if rendering does not complete, for any given pure-HTML document, I would interpret that as a browser bug.

    RaceProUK:
    Only if used with CSS3; pure HTML is not Turing-complete.

    According to a Stack Overflow article, this combination is Turing complete. This presents two big problems for the browser implementer:

    1. The document CSS algorithm is not written by the browser builder, but by the document creator, so the document creator can "provide" bugs that are outside the control of the browser implementation.
    2. Algorithms running on Turing machines, by definition, are subject to the halting problem. Therefore HTML+CSS3 is subject to the halting problem.

    So there's no way the browser implementer can guarantee an HTML+CSS3 document will complete rendering unless they just whack it at some point. This would be a deliberate "give up," to protect the browser.

    And then if we add JavaScript to the equation...which can rewrite CSS3 on the fly...as well as add its own problems...whoa...!

    Edit: After I wrote all that, I discovered I should have read the footnotes on the Stack Overflow article. (The one that starts "93 BRILLIANT".) CSS3 does one iteration for each click of the mouse, so it is not Turing complete. Finks. So that just leaves JavaScript to, "Make the browser's day."

  • (disco) in reply to CoyneTheDup

    But it shouldn't give up after rendering 158 nested tags with no CSS.

  • (disco) in reply to RaceProUK

    how about giving up at 159 nested tags, then?

  • (disco) in reply to RaceProUK
    RaceProUK:
    But it shouldn't give up after rendering 158 nested tags with no CSS.

    Tags take memory (child-parent structure). AFAIK, the HTML standard does not specify how many nested tags have to be handled, so I'd expect the browser to legitimately control its own limit. 25 tags is probably reeediculous, but 150? The document creator needs to find something to do in this life besides nest tags.

  • (disco) in reply to CoyneTheDup

    So it's OK for Firefox to throw the towel in when other browsers handle it fine?

  • (disco) in reply to CoyneTheDup

    The HTML reference should be amended to specify that 64 nested tags ought to be enough for anyone...

  • (disco) in reply to RaceProUK
    RaceProUK:
    So it's OK for Firefox to throw the towel in when other browsers handle it fine?

    You're the one actually using Firefox: why would I care what your browser fails to render?

  • (disco) in reply to RaceProUK
    RaceProUK:
    So it's OK for Firefox to throw the towel in when other browsers handle it fine?

    So it's OK for chairs to be rated for 250 pounds when some executive chairs are rated for 500? So it's OK for some cars to max out at 110, when some cars can go 280?

  • (disco) in reply to CoyneTheDup

    Executives are really heavy.

  • (disco) in reply to CoyneTheDup

    Sorry, I thought I was on a site where we expose stupid software for what it really is, when clearly we are all so accepting of things that are so obviously wrong and stupid.

  • (disco) in reply to RaceProUK

    You're really on a site where everyone's trolling. The software discussion is to give us something to troll about. :trolleybus:

  • (disco) in reply to RaceProUK
    RaceProUK:
    things that are so obviously wrong and stupid.

    This sounds like something somebody else would say, but I can't quite place it...

  • (disco) in reply to RaceProUK
    RaceProUK:
    So it's OK for Firefox to throw the towel in when other browsers handle it fine?

    What it should do is display "The developer is an idiot and all other browsers are enablers." And then just display the raw code.

  • (disco) in reply to RaceProUK
    RaceProUK:
    Sorry, I thought I was on a site where we expose stupid software for what it really is, when clearly we are all so accepting of things that are so obviously wrong and stupid.

    The point I'm making is that I don't really think it's wrong to give up at 158 tags, to defend your system from a failure.

    Take a document having 10,000 nested tags. Which is more correct: The browser that gives up after 200 tags, or the browser that fails outright with an OS exception due to out of memory?

    Given the choice, I think it is reasonable in the absence of guidance from the standard, to impose some limit. So Firefox chose 158 and two other browsers handle 250...meh.

    Looking at it from the document perspective, I can't see any rational reason for the document creator to use 150 nested tags. For what exactly? Even if you apply attributes one at a time, there's font and color and background-color and line-height and ...what is that, maybe 30 tags? WTF kind of document legitimately needs 150 tags nested?

    So the document creator is just being an idiot, or maybe an butthole, and wasting his life making tags--or maybe he's using an HTML generator that has the design quality of a tinker toy castle.

    150 is well beyond what I would expect any reasonablly designed document to need, so again...meh!

  • (disco) in reply to RaceProUK
    RaceProUK:
    So it's OK for Firefox to throw the towel in when other browsers handle it fine?

    What if the document has 800,000,000,000,301 nested tags?

  • (disco) in reply to tar
    tar:
    What if the document has 800,000,000,000,301 nested tags?

    Well, in that case, PhloxBrowser turns into a black hole on your desktop. :smile:

  • (disco)

    Clearly I'm the only one who thinks rendering a valid HTML file in full isn't crazy.

  • (disco) in reply to RaceProUK
    RaceProUK:
    Clearly I'm the only one who thinks rendering a valid HTML file in full isn't crazy.

    So you should build a proper browser. The guy who created the document in the article needs your browser!

  • (disco) in reply to CoyneTheDup
    CoyneTheDup:
    So you should build a proper browser. The guy who created the document in the article needs your browser!
    \*thinks* …nah, I'll just switch to Chrome instead :smile:

    In truth, I've been considering switching for some time now…

  • (disco) in reply to RaceProUK

    Out of interest, what's the most deeply nested html document you've had cause to look at in the recent past?

  • (disco) in reply to tar

    Absolutely no clue; the most recent docs I've looked at have been partial Razor views.

  • (disco) in reply to tar
    tar:
    Out of interest, what's the most deeply nested html document you've had cause to look at in the recent past?

    http://www.bilfinger.com/fileadmin/corporate_webseite/Magazin/2-13_Miteinander/lightbox/bil_13-2_magazin-lightbox_22_1.jpg

  • (disco) in reply to RaceProUK
    RaceProUK:
    Clearly I'm the only one who thinks rendering a valid HTML file in full isn't crazy.

    That's not true :smile:

    There probably should be a limit, but at the same time, the browser definitely shouldn't just "give up" - there should be some kind of indication - and the limit should be extraordinarily high to accommodate for people doing stupid things exactly like that.

  • (disco) in reply to sloosecannon

    :headdesk: Trust that my point is made best by someone else… :smirk:

  • (disco) in reply to sloosecannon
    sloosecannon:
    the limit should be extraordinarily high to accommodate for people doing stupid things exactly like that.

    Like, say, 157?

  • (disco) in reply to tar
    tar:
    Like, say, 157?

    No, like the highest the browser can feasibly handle without projectile vomiting all over the everything

  • (disco) in reply to sloosecannon

    I don't know, the highest I can count with my fingers is 10, and 157 is over an order of magnitude larger than that...

  • (disco) in reply to tar

    Correct

  • (disco) in reply to RaceProUK
    RaceProUK:
    *thinks*…nah, I'll just switch to Chrome instead

    In truth, I've been considering switching for some time now…

    /me bounces and claps for joy

  • (disco) in reply to RaceProUK

    Welcome to the Chrome side. Have a :cookie:. @Yamikuronue should be able to provide some :cupcake:s too

  • (disco) in reply to sloosecannon

    I haven't switched yet… :stuck_out_tongue:

  • (disco) in reply to RaceProUK

    Preemptive welcome then.

  • (disco) in reply to accalia
    accalia:
    fortunately it's proven that the validator will always halt so if you refuse to render on invalid input you will always halt **fail to render half the web**.
    FTFY.
  • (disco) in reply to sloosecannon
    sloosecannon:
    No, like the highest the browser can feasibly handle without projectile vomiting all over the everything

    Set it lower than that. Really. If it can't be done in 30 nested tags, should it be done at all? (Also, running close to the limit is a great way to go over the limit by accident.)

  • (disco) in reply to Scarlet_Manuka

    i never said it would be good at its job. :-P

  • (disco) in reply to aliceif
    aliceif:
    How about one kilo/kibitag?

    Quit kibilotzing.

  • (disco) in reply to dkf
    dkf:
    If it can't be done in 30 nested tags, should it be done at all?

    The quote in your post goes up to 17 in Discourse. So... well.

  • (disco) in reply to Maciejasjmj
    Maciejasjmj:
    The quote in your post goes up to 17 in Discourse. So... well.

    So my point still stands. :smiley:

  • (disco) in reply to RaceProUK

    Opening this does not work fine in IE ... test2.html (254.0 KB)

  • (disco) in reply to sloosecannon
    sloosecannon:
    No, like the highest the browser can feasibly handle without projectile vomiting all over the everything
    Which was the whole reason Firefox introduced that limit in the first place.

    Now, one way they could have implemented that limit would have been a UA CSS rule * * * /* etc. */ * * * { display: none !important; }. Since now it's just rendering HTML and CSS, does that make it any less of a UA?

  • (disco) in reply to anonymous234
    anonymous234:
    HTML pages are {snip} turing-complete machines with a well-defined output for every case.
    Imagine an iframe which covers the viewport with no margins or borders and whose contents is the document itself.

Leave a comment on “A Deeply Nested Mystery”

Log In or post as a guest

Replying to comment #:

« Return to Article