473,408 Members | 2,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

bye-bye holly hack...

VK
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.css">
<![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("200px");
}

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.asp>

Nov 15 '06 #1
7 5084
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.)
Nov 15 '06 #2
In article
<11**********************@i42g2000cwa.googlegroups .com>,
"VK" <sc**********@yahoo.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
Nov 16 '06 #3
"VK" <sc**********@yahoo.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(document.documentElement.parentNode.n odeName);

(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
Nov 16 '06 #4
VK
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?

Nov 16 '06 #5
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.)
Nov 16 '06 #6
Eric B. Bednarz wrote:
"VK" <sc**********@yahoo.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(document.documentElement.parentNode.n odeName);

(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
Nov 16 '06 #7
Michael Winter <m.******@blueyonder.co.ukwrites:
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
Nov 16 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Haines Brown | last post by:
I thought I had understood this issue and implemented a work around, but now when I check on IE5, it is not working: ... #IE-hack { margin-left: auto; margin-right: auto; width: 20em;...
3
by: cr88192 | last post by:
for various reasons, I added an imo ugly hack to my xml parser. basically, I wanted the ability to have binary payload within the xml parse trees. this was partly because I came up with a binary...
11
by: Chris Beall | last post by:
Here's the problem: http://pages.prodigy.net/chris_beall/Demo/theproblem.html The page contains inline text, then some additional pairs of text which are floated right and left. (This is a...
2
by: Ing. Rajesh Kumar | last post by:
Hi everybody I have about 50 code behind *.vb files from which i have created a single *.dll file. This single *.dll file and all the *.aspx files i will put on a clients computer. So i just...
5
by: Nmx | last post by:
Hi everyone, I'm writing a patch to a search engine (aspseek http://www.aspseek.org/) compile under gcc 3.4.4 on FC3. At some point, I found this piece of code: -- // Dirty hack to avoid...
0
by: Xah Lee | last post by:
In this article, i explain how the use of bit masks is a hack in many imperative languages. Often, a function will need to take many True/False parameters. For example, suppose i have a function...
12
by: Ivo | last post by:
I am programming forum. Tech is ASP.NET, C# and SQL Server 2005. I want to see is my site safe, have I made some security problems. Can you try to hack my site untill 10-september-2007.:...
7
by: badc0de4 | last post by:
Is this a stupid hack or a clever hack? Is it a "hack" at all? ==================== #include <stdio.h> /* !!HACK!! */ /* no parenthesis on the #define'd expression */ #define...
0
by: freehackers | last post by:
FreeHackers Group : Only 6 Steps to get cracked your target password 1- Fill in the E-Mail Cracking order form , to the best of your knowledge contact us to freehackers.007gmail.com with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.