Lack of end tag messes up form styling - a known bug?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jukka K. Korpela

    Lack of end tag messes up form styling - a known bug?

    My basic style sheet has a distinctive background and border for forms,
    to make the structure clearer and to make it visually evident what
    belongs to a form.

    However, as people complained that some forms were odd-looking, I
    noticed that indeed, fairly often the background is not applied and
    there is empty space inside a form I didn't ask for. This was rather
    puzzling until I realized that the observed cases seem to result from
    one single "error" in my markup.

    The "error" is lack of the "optional" </ptag right before a form. That
    is,
    <p>paragraph text
    <form ...>
    causes the trouble. For a simple illustration, check

    on IE 7. (When </pis omitted, the background set for the form is not
    there, except for a thin stripe at the top.)

    For years, browsers have been reported to behave wrongly when "optional"
    end tags for elements are omitted. But this form-related problem appears
    even on IE 7, and I don't remember having seen notes about this
    particular type of bug elsewhere. What did I miss?

    My conclusion is that "optional" end tags should not be omitted. There
    is little hope of having browsers fixed, I'm afraid. What we _can_ do is
    to stop using "handy" SGML features like tag omissibility.

    --
    Jukka K. Korpela ("Yucca")


  • David Stone

    #2
    Re: Lack of end tag messes up form styling - a known bug?

    In article <5gmLj.324043$e T7.60746@reader 1.news.saunalah ti.fi>,
    "Jukka K. Korpela" <jkorpela@cs.tu t.fiwrote:
    My basic style sheet has a distinctive background and border for forms,
    to make the structure clearer and to make it visually evident what
    belongs to a form.
    >
    However, as people complained that some forms were odd-looking, I
    noticed that indeed, fairly often the background is not applied and
    there is empty space inside a form I didn't ask for. This was rather
    puzzling until I realized that the observed cases seem to result from
    one single "error" in my markup.
    >
    The "error" is lack of the "optional" </ptag right before a form. That
    is,
    <p>paragraph text
    <form ...>
    causes the trouble. For a simple illustration, check

    on IE 7. (When </pis omitted, the background set for the form is not
    there, except for a thin stripe at the top.)
    >
    For years, browsers have been reported to behave wrongly when "optional"
    end tags for elements are omitted. But this form-related problem appears
    even on IE 7, and I don't remember having seen notes about this
    particular type of bug elsewhere. What did I miss?
    >
    My conclusion is that "optional" end tags should not be omitted. There
    is little hope of having browsers fixed, I'm afraid. What we _can_ do is
    to stop using "handy" SGML features like tag omissibility.
    I've run into this a couple of times, and usually it has to do with
    the way a specific user agent infers where the missing end tag
    should be, based on the content of the html file. (In my case,
    however, it had nothing to do with forms.)

    I've noticed on a couple of occasions that the W3C validator picks
    up on these things, and will explicitly state what it has decided
    to do when encountering a missing optional end tag; this choice is
    rarely what I meant! But then, I am not as familiar with the full
    scope of the html spec as the authors of the validator software...

    The upshot is that, for purely practical reasons, I always include
    "optional" end tags

    Comment

    • Harlan Messinger

      #3
      Re: Lack of end tag messes up form styling - a known bug?

      David Stone wrote:
      I've run into this a couple of times, and usually it has to do with
      the way a specific user agent infers where the missing end tag
      should be, based on the content of the html file. (In my case,
      however, it had nothing to do with forms.)
      It should be easy to check what the UA has inferred by using some
      Javascript to report on the DOM tree. Does the tree differ depending on
      whether or not the end tag is there?

      Comment

      • Jonathan N. Little

        #4
        Re: Lack of end tag messes up form styling - a known bug?

        Jukka K. Korpela wrote:
        My basic style sheet has a distinctive background and border for forms,
        to make the structure clearer and to make it visually evident what
        belongs to a form.
        >
        However, as people complained that some forms were odd-looking, I
        noticed that indeed, fairly often the background is not applied and
        there is empty space inside a form I didn't ask for. This was rather
        puzzling until I realized that the observed cases seem to result from
        one single "error" in my markup.
        >
        The "error" is lack of the "optional" </ptag right before a form. That
        is,
        <p>paragraph text
        <form ...>
        causes the trouble. For a simple illustration, check

        on IE 7. (When </pis omitted, the background set for the form is not
        there, except for a thin stripe at the top.)
        >
        Strangely it does display correctly in IE 4-6 And folks wonder why I am
        cynical about future IE8's compliance.

        --
        Take care,

        Jonathan
        -------------------
        LITTLE WORKS STUDIO

        Comment

        • Darin McGrew

          #5
          Re: Lack of end tag messes up form styling - a known bug?

          "Jukka K. Korpela" <jkorpela@cs.tu t.fiwrote:
          My conclusion is that "optional" end tags should not be omitted. There
          is little hope of having browsers fixed, I'm afraid. What we _can_ do is
          to stop using "handy" SGML features like tag omissibility.
          David Stone <no.email@domai n.invalidwrote:
          The upshot is that, for purely practical reasons, I always include
          "optional" end tags
          Same here. For a while now, I've been using spam/ospam to add optional
          closing tags (and optional quotes around attribute values). It helps
          browsers (and browser-like OS components) handle CSS more consistently.
          --
          Darin McGrew, mcgrew@stanford alumni.org, http://www.rahul.net/mcgrew/
          Web Design Group, darin@htmlhelp. com, http://www.HTMLHelp.com/

          "Advice is what you ask for when you know the answer but wish you didn't."

          Comment

          • David Stone

            #6
            Re: Lack of end tag messes up form styling - a known bug?

            In article <666ervF2il78eU 2@mid.individua l.net>,
            Harlan Messinger <hmessinger.rem ovethis@comcast .netwrote:
            David Stone wrote:
            I've run into this a couple of times, and usually it has to do with
            the way a specific user agent infers where the missing end tag
            should be, based on the content of the html file. (In my case,
            however, it had nothing to do with forms.)
            >
            It should be easy to check what the UA has inferred by using some
            Javascript to report on the DOM tree. Does the tree differ depending on
            whether or not the end tag is there?
            I don't know, I don't do Javascript. Might be interesting to
            see what FireBug does with things like that. As I said in the
            original post, however, I just explicitly include all "optional"
            end tags anyway, so the point is moot.

            Comment

            • VK

              #7
              Re: Lack of end tag messes up form styling - a known bug?

              On Apr 10, 2:48 pm, "Jukka K. Korpela" <jkorp...@cs.tu t.fiwrote:
              The "error" is lack of the "optional" </ptag right before a form.
              The P element is being changed from the original paragraph separator
              to a block element back in HTML 3.2 or even earlier if I recall
              properly. The last time I saw P used as a paragraph separator on the
              Web is about 1997-98, so your sample is the first in over ten years.
              What actuality do you actually imply by your case?

              Comment

              • Joost Diepenmaat

                #8
                Re: Lack of end tag messes up form styling - a known bug?

                VK <schools_ring@y ahoo.comwrites:
                On Apr 10, 2:48 pm, "Jukka K. Korpela" <jkorp...@cs.tu t.fiwrote:
                >The "error" is lack of the "optional" </ptag right before a form.
                >
                The P element is being changed from the original paragraph separator
                to a block element back in HTML 3.2 or even earlier if I recall
                properly. The last time I saw P used as a paragraph separator on the
                Web is about 1997-98, so your sample is the first in over ten years.
                What actuality do you actually imply by your case?
                Not so fast. From the HTML 4.01 specs,



                9.3.1 Paragraphs: the P element

                <!ELEMENT P - O (%inline;)* -- paragraph -->
                <!ATTLIST P
                %attrs; -- %coreattrs, %i18n, %events --
                >
                Start tag: required, End tag: optional

                Note the last word. Now, since FORM is a block-level element, it should
                AFAICT close a P tag, since a P tag cannot contain another block-level
                element. Please also note that because of all kinds of inconsistencies ,
                I agree (if that's your point) that it's far more worth-while to just
                close all damn tags appropriately, even if that's "optional" and focus
                on what issues are left.

                --
                Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/

                Comment

                • VK

                  #9
                  Re: Lack of end tag messes up form styling - a known bug?

                  On Apr 11, 1:23 am, Joost Diepenmaat <jo...@zeekat.n lwrote:
                  VK <schools_r...@y ahoo.comwrites:
                  On Apr 10, 2:48 pm, "Jukka K. Korpela" <jkorp...@cs.tu t.fiwrote:
                  The "error" is lack of the "optional" </ptag right before a form.
                  >
                  The P element is being changed from the original paragraph separator
                  to a block element back in HTML 3.2 or even earlier if I recall
                  properly. The last time I saw P used as a paragraph separator on the
                  Web is about 1997-98, so your sample is the first in over ten years.
                  What actuality do you actually imply by your case?
                  >
                  Not so fast. From the HTML 4.01 specs,http://www.w3.org/TR/html4/struct/text.html#edef-P
                  >
                  9.3.1 Paragraphs: the P element
                  >
                  <!ELEMENT P - O (%inline;)* -- paragraph -->
                  <!ATTLIST P
                  %attrs; -- %coreattrs, %i18n, %events --
                  >
                  >
                  Start tag: required, End tag: optional
                  I did not mean that it is wrong. I am well aware of "P issue" and
                  explained it several times at ciwah - where this issue is better
                  suited IMO - see for instance


                  I am just saying that no one ever widely used it even at the time when
                  P was officially a paragraph break and not a container - except some
                  really amateurish pages. So making an issue out of it now is kind of
                  checking XMP or ISINDEX tag support amidst modern browsers.

                  IMHO

                  Comment

                  • VK

                    #10
                    Re: Lack of end tag messes up form styling - a known bug?

                    On Apr 11, 2:07 am, VK <schools_r...@y ahoo.comwrote:
                    I am just saying that no one ever widely used it even at the time when
                    P was officially a paragraph break and not a container - except some
                    really amateurish pages.
                    "no one ever widely used it" refers to the "permission " to omit the
                    closing tag, not to P element itself, of course.

                    Comment

                    • Bergamot

                      #11
                      Re: Lack of end tag messes up form styling - a known bug?

                      VK wrote:
                      >
                      The P element is being changed from the original paragraph separator
                      to a block element back in HTML 3.2 or even earlier if I recall
                      properly.
                      Huh? What is this "paragraph separator" you speak of? If it is in fact
                      <p>, that is and always has been a block element.



                      Go to section 5.5
                      The last time I saw P used as a paragraph separator on the
                      Web is about 1997-98,
                      If you aren't using <pto mark up paragraphs, what pray tell *are* you
                      using?

                      --
                      Berg

                      Comment

                      • VK

                        #12
                        Re: Lack of end tag messes up form styling - a known bug?

                        On Apr 11, 2:19 am, Bergamot <berga...@visi. comwrote:
                        Huh? What is this "paragraph separator" you speak of? If it is in fact
                        <p>, that is and always has been a block element.
                        No offense, but you were too young that time to remember I guess.
                        Initially there were paragraph break P (with adding space between
                        lines) and BR (w/o adding space). And numerous manual suggestions to
                        still "use </Pdespite it is meaningless now because the meaning of
                        this element should change and hopefully will change soon".

                        Please read the linked post at


                        - it is boring to answer such FAQ over and over again.


                        Comment

                        • Joost Diepenmaat

                          #13
                          Re: Lack of end tag messes up form styling - a known bug?

                          VK <schools_ring@y ahoo.comwrites:
                          On Apr 11, 2:07 am, VK <schools_r...@y ahoo.comwrote:
                          >I am just saying that no one ever widely used it even at the time when
                          >P was officially a paragraph break and not a container - except some
                          >really amateurish pages.
                          >
                          "no one ever widely used it" refers to the "permission " to omit the
                          closing tag, not to P element itself, of course.
                          I don't think that's true, but that depends on your definition of
                          "amateurish ". Not having to close some tags makes it easier to write
                          HTML by hand, and besides, it's not a '"permission "', it's *explicitely
                          allowed*. That's not to say that this kind of implicit closing can't
                          lead to all kinds of problems, but AFAICT that's mostly an
                          implementation issue...

                          --
                          Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/

                          Comment

                          • Jukka K. Korpela

                            #14
                            Re: Lack of end tag messes up form styling - a known bug?

                            Scripsit Joost Diepenmaat:
                            VK <schools_ring@y ahoo.comwrites:
                            >
                            >On Apr 11, 2:07 am, VK <schools_r...@y ahoo.comwrote:
                            >>I am just saying that no one ever widely used it even at the time
                            >>when P was officially a paragraph break and not a container -
                            >>except some really amateurish pages.
                            >>
                            >"no one ever widely used it" refers to the "permission " to omit the
                            >closing tag, not to P element itself, of course.
                            >
                            I don't think that's true, but that depends on your definition of
                            "amateurish ".
                            I'm afraid you just have to learn to ignore "VK" as many people
                            presumably do. "VK" is apparently not even an amateur in HTML matters
                            but this does not prevent her, him, or it from posting opinions and
                            advice on them.

                            (P was _never_ officially a paragraph break. The first HTML
                            specification was HTML 2.0, and it clearly defines P as an element
                            indicating a paragraph. I don't think "VK" even ever read an HTML
                            specification.)

                            --
                            Jukka K. Korpela ("Yucca")


                            Comment

                            • Ben Bacarisse

                              #15
                              Re: Lack of end tag messes up form styling - a known bug?

                              Bergamot <bergamot@visi. comwrites:
                              VK wrote:
                              >>
                              >The P element is being changed from the original paragraph separator
                              >to a block element back in HTML 3.2 or even earlier if I recall
                              >properly.
                              >
                              Huh? What is this "paragraph separator" you speak of? If it is in fact
                              <p>, that is and always has been a block element.
                              Tim Berners-Lee original HTML 1.0 DTD declared P elements to be empty.
                              Thus, for a very short time, </Pwas not valid syntax. The draft
                              (never even made it to RFC) calls it a "paragraph separator".

                              --
                              Ben.

                              Comment

                              Working...