Tuesday, October 24, 2006

IE7 still refuses to listen to dynamically changed attributes

As I've covered previously, IE6 simply would not listen to changes made to an elements attributes. If you asked the element for its className immediately after assigning it a new one, it would proudly tell you that it assigned it. But it would fucking refuse to actually apply any kind of rendering change to the element.

IE7, just released, still doesn't get it. Guys, when I give you a new className or any other attribute a new value, I fucking mean it.

So until this works, any dynamically changing attributes need have the element's parentNode's innerHTML set to itself. Yes, set to itself... Just because IE knows changes get made doesn't mean that it listens. You have to sprinkle your code with:

// Seriously, IE. I really fucking meant that: change the goddamn class.
changed_element.parentNode.innerHTML = changed_element.parentNode.innerHTML ;

Labels: ,

9 Comments:

Anonymous Anonymous said...

Surfed across your post, as a beginning Ajax and JavaScript guy, trying to figure out why stuff is working in FF and not IE. Gotta love an element that needs that kind of assurance. Does that technically make it a form of AI..?

3:51 PM  
Blogger The Hater said...

Not until it has an awareness of its own astonishingly fucking bad implementations, no.

Artificial Unintelligence, maybe.

1:43 PM  
Blogger Unknown said...

I don't understand why this works, but thank you, I was dynamically adding onclick events to elements and couldn't figure out why it would not work!

9:42 PM  
Anonymous Anonymous said...

Post about the script that crashes ie please-

Change the "[ and ]" to "< and >" because blogger wouldn't let me post the script tag.

[script]for(x in document.write){document.write(x);}[/script]

4:18 PM  
Blogger The Hater said...

"Post about the script that crashes ie please-"

Not until two things happen:

1. I figure out a way to reproduce it that doesn't include proprietary code.
2. I inform the IE team and let them bash their heads against it for a reasonable amount of time.

They have enough DOS shit floating around out their without my adding to it.

1:56 PM  
Blogger Jack said...

For a guy that ends up swearing in every post, perhaps you should stop focusing your attention on IE, and use Firefox instead. It might help your anger problem.

3:05 PM  
Blogger The Hater said...

"For a guy that ends up swearing in every post, perhaps you should stop focusing your attention on IE, and use Firefox instead. It might help your anger problem."

Unfortunately, for those making their living in the wonderful world of web development, if you completely ignore IE you get fucking fired.

Trust me, I don't use IE because I don't know any better. I use it because shit only works if I open IE and debug the fucker for days on end.

2:13 PM  
Anonymous Anonymous said...

Speaking of the script that crashes IE, you can do it with a 45-byte .htm(l) file by using the nonexistent f(x) instead of document.write(x) and leaving out unnecessary spaces and punctuation.

<script>for(x in document.write)f(x)</script>

Or if you enter it into the address bar, it can be even shorter (39 bytes):

javascript:for(x in document.write)f(x)

3:33 PM  
Blogger The Hater said...

rangi:

Why, yes it does! IE6 goes down in a mass of fucking flames, though they seem to have fixed that issue in IE7.

4:16 PM  

Post a Comment

<< Home