bye-bye holly hack...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • VK

    #1

    bye-bye holly hack...

    That happened: Microsoft acknowledged the fact that HTML element is
    the topmost one in any HTML document and that there is nothing atop of
    it (DOCTYPE declarations and prologs are not normally styled by
    stylesheet means :-)

    Not only the fact acknowledged by also the relevant bug fixed in IE7.
    It means that it's time to say bye-bye to the infamous "holly hack":
    sooner is better. Actually Microsoft gave a generous share of time for
    updates (announcing the planned bag fixes since the 2005) : but there
    will be always someone left behind.

    This way if you have in your stylesheet the rule * html (universal
    selector - html) and if it supposes to mean "further rules for that
    stupid IE only" then your stylesheet is rather badly broken for an
    increasing amount of your visitors.

    Which ones of existing workarounds are still needed for all versions of
    IE (including IE7) is a subject of separate tests.

    I'd just like to explain how to use these workarounds in a reliable and
    *working* way.

    1) Conditional comments (IE 5.0 or higher for all platforms)

    1-1) Conditional content-hiding comments
    These comments are using the regular comment syntax, so any UA's except
    IE will simply not see anything inside of them. Respectively W3C
    Validator doesn't care neither.

    1-1-1) No version check. Will be seen and parsed by IE 5.0 or higher.
    Other words by any IE version with conditional comments support.
    <!--[if IE]>
    <link rel="stylesheet " href="ie_fix.cs s">
    <![endif]-->

    1-1-2) Version check using operators lt (lesser than), lte (lesser than
    or equals to), gt (greater than), gte (greater than or equals to)
    <!--[if lt IE 6]>
    Will be seen and parsed by IE 5.0 - IE 5.5
    <![endif]-->

    <!--[if gte IE 7]>
    Will be seen and parsed by IE 7.0 or higher
    <![endif]-->

    1-2) Conditional content-revealing comments.
    These blocks will be seen by all browsers but we can instruct IE do not
    parse them. Unfortunately this syntax makes W3C Validator all upset
    (UA's themselves do not care). This way content-revealing comments
    cannot be advised for W3C-validating pages.
    <![if !IE]>
    Will be seen and parsed only by non-IE browsers
    <![endif]>

    2) Disabled styleshets.
    <link rel="stylesheet " href="not_for_. css" disabled="true" >
    IE will not apply this stylesheet because of disabled attribute. Other
    UA's (AFAIK) do not support neither understand neither planning to
    implement this attribute.

    3) Expression override
    This can be used for small fixes inside the stylesheet itself:
    #MyContainer {
    /* for all: */
    width: 200px;
    /* for IE only: */
    width: expression("200 px");
    }

    P.S. It doesn't elimitate the possibility to find another bug in IE7 to
    use it as a holly hack replacement. (Why?) For researches one can study
    all selectors supported by IE7:
    <http://msdn.microsoft. com/workshop/author/css/reference/css_ref_entry.a sp>

  • Johannes Koch

    #2
    Re: bye-bye holly hack...

    VK schrieb:
    That happened: Microsoft acknowledged the fact that HTML element is
    the topmost one in any HTML document and that there is nothing atop of
    it (DOCTYPE declarations and prologs are not normally styled by
    stylesheet means :-)
    '* html' means 'html elements which have an ancestor element'.

    1. A DOCTYPE declaration is no element.
    2. A DOCTYPE declaration is not an ancestor, but a sibling node of the
    root (html) element (in DOM terms).
    --
    Johannes Koch
    In te domine speravi; non confundar in aeternum.
    (Te Deum, 4th cent.)

    Comment

    • dorayme

      #3
      Re: bye-bye holly hack...

      In article
      <1163599318.705 886.179340@i42g 2000cwa.googleg roups.com>,
      "VK" <schools_ring@y ahoo.comwrote:
      It means that it's time to say bye-bye to the infamous "holly hack":
      sooner is better.
      This "sooner is better" remark seems to me to indicate a
      prejudice. Is it not the case that at least the * html hack is
      simply ignored by most other browsers. So what is so terrible
      about it?

      I reckon some people have too rigid an eye for beauty. A face can
      be the more interesting, even beautiful, for a slight blemish. So
      too can a css sheet or html doc. I have weeped at the sight of
      some of these hacks, my knees have gone all wobbly, the trembling
      always starts at the first sight of the * html and the \ (this
      latter is exquisite indeed)

      --
      dorayme

      Comment

      • Eric B. Bednarz

        #4
        Re: bye-bye holly hack...

        "VK" <schools_ring@y ahoo.comwrites:
        That happened: Microsoft acknowledged the fact that HTML element is
        the topmost one in any HTML document and that there is nothing atop of
        ^^^^^^^
        it
        window.alert(do cument.document Element.parentN ode.nodeName);

        (NB, this is ‘The root of the document tree’ in CSS 2 9.1.2)
        (DOCTYPE declarations and prologs
        A document type declaration is *part* of the prolog (both in SGML and
        XML).
        are not normally styled by
        stylesheet means :-)
        SGML/XML declarations, document type declarations, PIs, comment
        declarations and whitespace preceding the root element are its siblings
        anyway, not its parents.
        This way if you have in your stylesheet the rule * html (universal
        selector - html) and if it supposes to mean "further rules for that
        stupid IE only" then your stylesheet is rather badly broken for an
        increasing amount of your visitors.
        Only for developers who didn’t read the M$ documentation and delivered
        “content that is [not] fixed in nature”.

        <http://msdn.microsoft. com/library/default.asp?url =/library/en-us/dnie60/html/cssenhancements .asp>
        =“The Way It Was”

        * html *

        still works in IE7 in BackCompat mode.


        --
        ||| hexadecimal EBB
        o-o decimal 3771
        --oOo--( )--oOo-- octal 7273
        205 goodbye binary 111010111011

        Comment

        • VK

          #5
          Re: bye-bye holly hack...

          are not normally styled by
          stylesheet means :-)
          >
          SGML/XML declarations, document type declarations, PIs, comment
          declarations and whitespace preceding the root element are its siblings
          anyway, not its parents.
          That sentence in parenthesis was a humoristic (see the smily)
          suggestion of how that erroneus * element atop of html could ever
          appear in IE on the first place. But thanks for everyone commenting on
          the prolog nature: it is useful for everyone else reading this thread.
          * html *
          still works in IE7 in BackCompat mode.
          Unless it was pseudo-XHTML with <xmlstarting the prolog. In IE before
          7 it forced BackCompat on IE even with doctype presented.

          But I'm a bit lost now: was * atop of html a bug or not? If it was then
          what reason would be to keep using broken stylesheets (containing
          illegal ruleset declarations) when there are descent "bug fix
          independent" tools to achieve the same goal?

          Comment

          • Johannes Koch

            #6
            Re: bye-bye holly hack...

            VK schrieb:
            But I'm a bit lost now: was * atop of html a bug or not?
            It's not an error wrt CSS. It's just a selector that selects an element
            not existing in HTML documents.

            --
            Johannes Koch
            In te domine speravi; non confundar in aeternum.
            (Te Deum, 4th cent.)

            Comment

            • Michael Winter

              #7
              Re: bye-bye holly hack...

              Eric B. Bednarz wrote:
              "VK" <schools_ring@y ahoo.comwrites:
              >
              >That happened: Microsoft acknowledged the fact that HTML element is
              >the topmost one in any HTML document and that there is nothing
              ^^^^^^^
              >atop of it
              >
              window.alert(do cument.document Element.parentN ode.nodeName);
              >
              (NB, this is ‘The root of the document tree’ in CSS 2 9.1.2)
              As far as I can see, there is a difference between the DOM and CSS
              Recommendations regarding what constitutes the "root of the document
              tree". The DOM Core Recommendation describes it unequivocally as the
              Document interface:

              The Document interface represents the entire HTML or XML
              document. Conceptually, it is the root [p.99] of the document
              tree, and provides the primary access to the document’s data.

              The DOM defines the document tree in terms of nodes and the root element
              cannot be the root node: it has siblings. However, the CSS
              Recommendation describes the document tree in terms of elements:

              Document tree
              The tree of elements encoded in the source document. Each
              element in this tree has exactly one parent, with the
              exception of the *root* element, which has none.

              (the word "root" has strong emphasis in the document, and is considered
              a definition). Therefore, one can conclude that when the Recommendation
              states:

              The root of the document tree [p. 30] generates a box that serves as
              the initial containing block for subsequent layout.

              in section 9.1.2 Containing blocks, it is referring to the root element.
              In HTML documents, the html element is that root and serves as the
              initial containing block.

              * html

              is nonsense (however useful it might be).

              [snip]

              Mike

              Comment

              • Eric B. Bednarz

                #8
                Re: bye-bye holly hack...

                Michael Winter <m.winter@bluey onder.co.ukwrit es:
                As far as I can see, there is a difference between the DOM and CSS
                Recommendations regarding what constitutes the "root of the document
                tree".
                The whole issue has vanished from the 2.1 draft anyway, not without a
                reason. Just for the fun of it:

                <http://lists.w3.org/Archives/Public/www-style/2001Jul/0038.html>

                IMO that makes perfect sense of seemingly contradicting definitions in
                CSS 2.

                But as there is no official clarification that I am aware of, I should
                probably have written ‘probably’. ;)
                * html
                >
                is nonsense (however useful it might be).
                I did not intend to imply anything else.


                --
                ||| hexadecimal EBB
                o-o decimal 3771
                --oOo--( )--oOo-- octal 7273
                205 goodbye binary 111010111011

                Comment

                Working...