473,799 Members | 3,093 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1398
<ri**********@g mail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.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.th atclass == 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
1851
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 php page with mysql connections I get an Window NT prompt, which I type either mysql or window username/password combinations and always get "Wrong username/password" Any idea what it might be...all permission on the directory are open for...
2
2381
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 default to 0, w/h values default to image w/h--> <!ATTLIST Image
18
5727
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 background color and text color that differ from the rest of the page, and I'd like them to be positioned from the right edge of the rightmost image div, to the right edge of the browser window. In other words, if the browser window is 800 pixels...
6
4356
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 result in any way. Who can help me, I thank you very very much. list.cpp(main program) //-------------------------------------------------------------------------- - #pragma hdrstop #pragma argsused
2
2034
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 declared with the fully qualified class name (some.namespace.mycontrolclass). Then in the InitializeComponent() it is instantiated and there is a block of code lines that set the various properties of the control class, then further down the usual...
42
3466
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: ---------------------------------------------------- TypeError: addFile() takes exactly 1 argument (2 given) ----------------------------------------------------
15
2036
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 wrong size rather than assert it at run-time? Here is one way, but I don't know if it's guaranteed to work on any compiler: 1/(sizeof(struct my_struct) == correct_size); For me, the above produces a compile-time divide-by-zero error for the wrong...
1
8033
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: http://(address.of.my.webcam):port/LiveView.html and
2
1412
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 clicked, the program's flow is correct... is this a bug?
0
9685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9538
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10473
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10249
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10219
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10025
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9068
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6804
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3755
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.