473,385 Members | 1,736 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,385 software developers and data experts.

IE6 picks "wrong" selector?

I've put up a testcase at http://forefront-tech.net/pub/badsel.html
that has me baffled.

The basic idea is that a small piece of Javascript adds a class name
"huvr" to an element on mouseover, and then removes it on mouseout. CSS
for the "huvr" class sets various display effects. Pretty basic DHTML
technique.

This all seems to work fine in Gecko (and I'm assuming in other
standards-based engines). It breaks in strange ways in IE6.

Take a look at the example above. The correct effect for a hover is to
turn the text color of the hovered element green, and to also set
various background colors for various other extant classnames.

In IE6, I get the result of the browser choosing the last-specified CSS
rule -- even though the other class is not on the hovered element.
Removing that rule, IE then picks the last remaining rule, etc.

WTF? Am I missing something?

Thanks,

Rick

Nov 2 '05 #1
2 1386
<ri**********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I've put up a testcase at http://forefront-tech.net/pub/badsel.html
that has me baffled.

The basic idea is that a small piece of Javascript adds a class name
"huvr" to an element on mouseover, and then removes it on mouseout. CSS
for the "huvr" class sets various display effects. Pretty basic DHTML
technique.

This all seems to work fine in Gecko (and I'm assuming in other
standards-based engines). It breaks in strange ways in IE6.

Take a look at the example above. The correct effect for a hover is to
turn the text color of the hovered element green, and to also set
various background colors for various other extant classnames.

In IE6, I get the result of the browser choosing the last-specified CSS
rule -- even though the other class is not on the hovered element.
Removing that rule, IE then picks the last remaining rule, etc.

WTF? Am I missing something?


All I get is the element that the cursor is over turns red, with white text,
under all circumstances in IE 6. I haven't looked with anything else.

Given what you're trying to do, why not just define each element with an <a>
tag, and then define an a:hover psuedo-class?
Nov 5 '05 #2
What I mean by "removing that rule" is to actually edit the example to
remove the last style rule. IE then picks whatever rule now falls last.

AFAICT, the reason this happens is because IE6 support for multiple
class selectors is (surprise, surprise) broken, and it simply ignores
any class selectors except the last selector, in other words, for IE:

TD.thisclass.thatclass == TD.thatclass

I don't want to use <a> tags, because that invokes *another* IE bug in
which the hover effect happens only on mouseover the text itself, not
the entire element. Er, until the element is clicked, at which point it
seems to work OK.

There are, as usual, ugly workarounds. But most of these seem only to
work with elements that have two possible classes. Working with three
possible classes, as I do, runs into apparently new bizzare and
terrible territory.

No wonder I have gray hair.
Rick

Nov 8 '05 #3

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

Similar topics

0
by: yurps | last post by:
Hello, I installed both, 1st mysql 4.1.7 but heard there was a change with password hashing so now got 4.0.9 Basically when I choose a page with php_info() I can load it fine, but when I call a...
2
by: Asfand Yar Qazi | last post by:
Hi, xmllint --valid gives error output on some code (included below:) file "Shotgun_Robot.dtd" (don't ask) <!ELEMENT Image (#PCDATA) > <!-- #PCDATA == image path --> <!-- x/y values...
18
by: day | last post by:
I know I've seen this issue described before, but I can't find it, or the solution now that I need it. I have some css-specified floating divs that contain images or text. The text divs have a...
6
by: wukexin | last post by:
Help me, good men. I find mang books that introduce bit "mang header files",they talk too bit,in fact it is my too fool, I don't learn it, I have do a test program, but I have no correct doing...
2
by: ~~~ .NET Ed ~~~ | last post by:
It is not the first time I see this happen. I am using VS.NET 2003 with .NET Framework 1.1. In this particular situation I have a custom user control in a windows form. There is a member variable...
42
by: Holger | last post by:
Hi guys Tried searching for a solution to this, but the error message is so generic, that I could not get any meaningfull results. Anyways - errormessage:...
15
by: David White | last post by:
The size of a struct can be affected by compiler packing. Suppose you need it to be a specific value for some reason (e.g., in firmware). How can you get the compiler to generate an error for the...
1
by: Java Guy | last post by:
I'm trying to view a web page. IE tells me there are (Java?) errors on the page. Here they are: Line: 15 Char: 7 Error: Wrong number of arguments or invalid propert assignment Code: 0 URL:...
2
by: sukatoa | last post by:
I've invoke that .COM file using the code below, Runtime.getRuntime().exec("cmd /C start FINAL6.COM"); The program's behavior is wrong when i use this implementation.... When just double...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.