IE7 Bug, dynamically loaded css files including @import fails to load imports

Consider the following scenario:

- html page: 
  - head
      <link type="text/css" rel="stylesheet" media="all" href="css/red.css" id="cssLink"/>
  - script
      function changeRed() {		
		var cssFile = document.getElementById('cssLink');
		if( cssFile ) {
			cssFile.href = 'css/red.css';	
		}
      }

      function changeBlue() {		
		var cssFile = document.getElementById('cssLink');
		if( cssFile ) {
			cssFile.href = 'css/blue.css';	
		}
      }
  - body
  	<div id="testZone">
	<div id="red">
		<h1>This should be red</h1>
 		<p>"Cogito ergo sum"</p>		
 	</div>	
 	<div id="blue">
		<h1>This should be blue</h1>
 		<p>"Cogito ergo sum"</p>		
 	</div>
	</div>

And the following css files:

- red.css


@import url(redminor.css);
div#testZone {
	background-color:white;
	margin: 20px;
	border:3px solid red;
	padding:20px;	
}

- redminor.css


div#red { display:block;}
#red h1 { color:red; }
#red p { color: red;}

div#blue { display: none;}

- blue.css


@import url(blueminor.css);
div#testZone {
	background-color:white;
	margin: 20px;
	border:3px solid blue;
	padding:20px;	
}

- blueminor.css


div#blue { display:block;}
#blue h1 { color:blue; }
#blue p { color: blue;}

div#red { display: none;}

At page load the red css is applied by default, which works as expected in all browsers.

When the changeRed() or changeBlue() functions are invoked, the behavior is the expected one in: IE6, FF 1.5-20, Opera 9, but in IE7 only the blue.css or red.css rules get’s applied the ones from the imported css files (blueminor.css or redminor.css) are ignored.

The import works since at page load IE7 applies correctly the rules defined in the imported styles.

Also as a workaround, if I dynamically remove the cssLink element from the DOM, and then I re-create it works correctly in all browsers including IE7.

So if you do this instead things will work as supposed:

function replaceRed() {		
	var cssFile = document.getElementById('cssLink');
	var par = cssFile.parentNode;
	par.removeChild(cssFile);
	cssFile = document.createElement('LINK');
	cssFile.type = 'text/css';
	cssFile.id = 'cssLink';
	cssFile.media = 'all';
	cssFile.rel = 'stylesheet';
	cssFile.href = 'css/red.css';
	par.appendChild(cssFile);
}

function replaceBlue() {		
	var cssFile = document.getElementById('cssLink');
	var par = cssFile.parentNode;
	par.removeChild(cssFile);
	cssFile = document.createElement('LINK');
	cssFile.type = 'text/css';
	cssFile.id = 'cssLink';
	cssFile.media = 'all';
	cssFile.rel = 'stylesheet';
	cssFile.href = 'css/blue.css';
	par.appendChild(cssFile);
}	

Download the test case: http://remus.pereni.org/fisiere/div/iebug/iebug.zip

View the test case: http://remus.pereni.org/fisiere/div/iebug/

May 19th, 2007

At tree months

Well what can I say time just flies. We finally got his Romanian birth certificate so we could finally baptize him and since the wheatear is starting to be nice we also started going out on daily basis.

Still lucky as he is a wonderful child sleeps during the night, cries only with a reason, healthy, but definitely things got more interactive and nosy. But you can judge that for yourself, true when I made the movie he was both sleepy and hungry so you can see an angry Sasha.

April 18th, 2006

At two months

Lili & Sasha

There are already two months since Sasha was born, I still find it pretty amazing, I still re-live Lili being pregnant in her last month with all the difficulty of the situation, the trips to the hospital, the day of birth with all it’s emotions. It is just unbelievable that thing that used to signal us it’s presence from Lily tummy now it is a real person, next to me.

We waited around 5 years till we decided to have a child, we did right, but somehow we look at him every day and ask ourselves the same questions, how could we stay so long without having a child. We are qualified as a bit anti-social, as we don’t really like to go out, and we weren’t really attached to babies, but somehow the feelings related to Sasha where right there from the first moment we saw him.

PICT0950f

He is a wonderful child, healthy and happy, which makes us extraordinarily happy parents. I’m not saying that we don’t have our moments, Sasha has, as almost every newborn, gases, colic’s, and some seborrheic dermatitis, but still he almost never cries without a reason. It’s a bit of a puzzle from time to time to find out exactly what is bothering him, but once found he is a quiet and smiling child.

PICT0930ff

We had some troubles at the beginning, Lili had one breast injured which made us worry that he might not be getting enough milk. Things where made worst by the first visit of our pediatrician who said after consulting Lili that she definitely doesn’t have enough milk so we should start giving him supplement. For sure every person you meet it expert in newborn raising so we where assured by everybody that once the baby starts bottle feeding he will quit breastfeeding. Well it didn’t happen. Till the breast healed, from time to time we needed to bottle feed him, but that definitely didn’t make him refuse the next breast feed. So in our case, that proved to be a myth. He grew constantly both in weight as in length, as a matter of fact, event that we feed him whenever he needed it, he was constantly spot on the growth charts.

Sasha David

I don’t know, it feels so easy, with all the little problems, at the beginning we even worried that it is too easy; we even managed to get enough sleep. Hopefully things will stay like this. Somewhere at the beginning of April he will be baptized, and after that given that the wheatear will be better we could start taking him outside, to fresh air (as fresh as you can get in a city).

Sasha David

I’m sure having most of our friends with newborns also helped. We learned not to panic, and we learn how to use the internet. Every time we had trouble, we found our answers on the net, and happily all the answers where reassuring.  That’s how we learned that he has seborrheic dermatitis, confirmed be our doctor, that cortisone based treatments are used, which worked, but only for a short time, that you are not supposed to use it for really long time. Happily a non-cortisone based cream helped, also having him bath in real Camilla tea and not with the Camilla extract did magic. From time to time it reappears in a very mild form, but it is nothing to be concerned about as it is barely visible and usually disappears after the next Camilla tea bath. Oh and he loves water. In the last two month he never, and I mean, never ever cried during a bath.

March 17th, 2006

Home at last!

Finally, home!

Yesterday I went to Fehergyarmat to bring Lili and little Sasha home. The big event should have happen last Friday but by the time we’ve got there Lili had fewer and the doctors decided not to let her (and the baby home) until causes are investigated and Lili is fully recovered.

Finally, home!

By the time we’ve got back home her fever was gone so that was a little bit relieving, the next morning the blood test results where ready and it turned out that the same bacteria which Sasha had Lili has it too. Probably because she has an immune system unlike the little baby (which seems to relay on the mother’s milk for that) reacted a bit late to it. So the doctors considered another five days in hospital with antibiotics and after that another blood test and if everything is all right she will be released home.

Finally, home!

In a way this was good, first of all because it seems that the bacteria was from the hospital and not from Lili, therefore reducing the risk of complications created by an in-uterus infection, second of all because they seemed to know what they are talking about (that bacteria was not new to them) a quick diagnostic and treatment available, I would not want to imagine what would have happen if we would have made it home, and Lili developed the fever here with all the incompetent doctors from this city. And last, the next morning, the baby was moved from the intensive care unit to her room and stayed there till we came back home, this was welcomed as it gave her a little bit of time to get used to the baby and to it’s habits and handling issues.

Finally, home!

Yesterday another blood test was done, everything came up good so they where released home. The trip back was fine, while outside was very cold the road was good and in around 45 minutes we where in the worm and safety of our home. I’m am after the first 24 hours with him and he is an angel I just can not find another word to best describe it, he eats, sleeps, dreams and once in a while cries and he does all that pretty much like a clockwork, very few and little exceptions. While he woke us up tree times last night he was even better behaved than during the day time, hope that will not change.

Finally, home!

We often found ourselves with Lili watching him sleep for hours still not believing that we have a child that is so beautiful that we are so lucky that we went in Hungary two and came home three and that will stay like that for many, many years.

During the last 13 days, maybe for the first time in my life I was and felt disconnected from everything except those two magic human beings from my life. No news feeds, no programming no Java, C#, Progress and patterns or computers crossed my mind for any fraction of a second. It’s time to slowly focus back on my work at least part time :) and a new life routine to slowly take its shape.

January 26th, 2006

I have a son!

My name is Sasha David and I'm 1 hour old

Yesterday (14 Ian 2006) at 16:15 (Romanian time, 15:15 Hungarian time) Pereni Sasha David was born with 3,700 Kg and 58 cm.

It all started at 5:00 AM as we headed to the hospital to do the standards checkups just like we did one and two days before, as the estimated date (13 Ian 2006) got close and passed by we where asked to come daily. Lili felt well as a matter of fact she felt that definitely nothing unusual is happening so probably we’ll be back home son.

Once there we did the NST test, the doctor considered that the movements where not enough so asked for a CST test, we weren’t scared we’ve been there once as Sasha is really moody and not very active in the morning.

Waiting at the CST test

So Lili was taken into the delivery room and given a very small dose of oxytocin to stimulate a couple of contractions while the contractions and child hart rate where monitored, we where waiting outside.

After two hours, aldo the heart rate was ok and there were some movements the doctors where not completely satisfied with how the child responds to the contractions and considering that we where a bit over the estimated date decided not to risk and induce the labor.

Do I look like I’m ready to assist?

At that point Lili was given a full dose of oxytocin (to stimulate contractions and dilatation) and prepared by the nurses to deliver while I have been asked to change into sterile clothes and join Lili.

We are not going home today?

We staid alone in the delivery room smiling at each other not believing that it finally happens and waiting for the contractions to appear. They did not so the doctor decided to use Prostaglandins gel and also do an ultrasound investigation. Surprise, in the last two weeks the baby turned over so now he was head up instead of head down as he should have been an as he was at the previous ultrasound investigation, this was possible mainly because Lili had a little bit more amniotic fluid so the baby had the possibility to move more easily.

Now I’m having contractions.

Aldo breech babies can be delivered normally it is more risky so the doctor decided to use cesarean delivery. For some reason she had to be a little bit dilatated so we where left alone again for another two hours so the gel could do his magic. And it did, Lili was soon having contractions. Around 15:30 the anesthetist came and explained the procedure and the nurses started preparing Lili for the intervention. At 16:00 I was asked to wait outside but still in the delivery zone in the sterile clothes so I could see the baby as soon as possible while Lili was taken into the operating room. At around 16:17 I was called by a nurse, the baby was out and crying in front of me.

My name is Sasha David and I'm 2 minutes old

At that point I could change back in my regular clothes and could wait outside of the delivery zone to Lili. At 17:00 the doctor came congratulated me and said that everything is perfect the intervention went smooth and both the baby and Lili was fine and she would come out soon. At 17:00 she was carried to the intensive care unit, still under epidural anesthetic she smiled and was happy. A couple of minutes later I was called to visit her.

After staying a little bit with Lili the nurse called me to show the baby, I tried recording it on my camera you can see it here but definitely not the camera was on my mind as you will see it from the recording, then went back to Lili. She will have to stay in the intensive care unit for 24 hours and if everything is fine today she will be transferred to a regular room and the baby will stay with her.

Because there was a caesarian delivery she will have to stay in hospital for 7 days instead of 5 so if everything is OK next Saturday we are all home.

I will go visit her daily while taking pictures and movies, if you are interested you can check my Flickr photos and YouTube for videos and updates.

January 15th, 2006

Passion, technology makers and technology users.

Just read Kathy Sierra excellent post about how memory and memorable works when I stumbled upon the next paragraph:

"Remember--your users don't have to be passionate about your product in order to be passionate users. Sometimes--often--users are passionate about what they do with your product. And it's that thing they do where you can help them kick ass. Users who "kick ass" are those who get good enough to reach a state of "optimal experience" doing whatever it is you're helping them do (through your product, service, support, learning, whatever)"

Now that was a very hard to learn lesson, as a tech guy I'm passionate about technologies and too often, at the beginnings, I tried to make the clients see the beauty of the technology behind a product or a solution. The only trouble is that, we live in a complex world and making them see something that takes months, maybe years of study and even more years of experiences is near mission impossible. It still makes a difference as if you really care about those things you can not really hide your passion, and passion, usually creates a kind of trust.

I think I learned my lesson but still, sometimes, not showing or talking about the beauties of a solution or technology leaves me frustrated. The truth is that not the technology matters but what we can do with it.

December 20th, 2005

Dell UltraSharp 2005FPW

My new display, Dell UltraSharp 2005FPWhat can I say, it is just as wide as I thought it would be but the height is a bit disappointing, but that is really my fault, never bothered to actually check that. Anyway it is super OK, the main point, which is to have a bigger resolution than my laptop display (1400x1050), is fullfiled (having 1680x1050), the ergonomics are great so are the colors, and absolutely no flaw (no dead or bad pixels)...

Continue Reading December 18th, 2005

Java on Rails or Java on Sails?

Unless you where living under a rock, you have heard about Ruby on Rails, its basically a full web stack for writing real-word applications with joy and less code, how they put it, and most definitely the application that made Ruby a star.The basic idea was to use OO, and the cool new technologies work for you, in a transparent manner, hiding the complexity in convention over configuration, a very simple idea that makes a lot of sense.

Since that idea works quite well, powerful technology combined with simplicity its always a winner receipt, the Python guys did their version of Python on Rails, Turbo Gears. Even if it makes sense, despite the 45 Java based Web related frameworks, today I noticed that we have our own version, first release milestone, of Java on Rails, called Sails. It comes well equipped, with a Blog, a Community and Eclipse plugins.

I like the idea a lot, so its there on the list of things to investigate, right near Shale, and Seam. I think we are developing our own version of Kmania (from KDE) but it starts with S (Struts, Shale, Seam, Sails), hm.

December 2nd, 2005

Free and Open Source Software for Windows

There are times when my work requires Windows, and now I’m kind’ of OK with this, with time I got less and less religious about operating systems, maybe because OS-X is out of my reach and because the multitude of Open Source and Free packages available for Windows are more every day letting me use, pretty much, the same packages both under Linux as under Windows.

So last weekend when I had to reinstall an aged Windows (20 minutes for a shut down among many other little or hugely annoying things)  I decided to make a list of the software I use and cherish, for the next time, because all of us know, there will be one ?

Some of the packages are not pure FLOSS just free as it costs no money, but still I think they are worth including them.


Office
  • OpenOffice – I don’t think there is anything to comment here, except maybe that I like it a lot more MS Office, I just find it more intuitive and clean, not to mention about actually owning your documents or many other great features not available in MS Office
  • PDF Creator – this is a nifty program that let’s you print any document (not made in OpenOffice where this feature is included) or web page or email as a PDF document.
  • NVU – a little HTML editor derived from the old Mozilla Composer for the moments I have to edit clean little HTML documents
  • FreeMind – a Java program to edit mind maps for un-tackling complicated issues
Internet
  • Mozilla Firefox – tabs, security, standard compliance makes that my favorite browser
  • Mozilla Thunderbird – I have the nasty habit of carrying all my mails since I had a mail account, and somehow among being secure, having a great spam killer it is the only one that can handle with easy my 20.000+ mails, that’s when I’m not under Linux where I prefer KMail
  • Free Download Manager – when torrents are not available, resuming is important or I just want to limit the download speed
  • Azureus – bit torrent client
  • Putty – hey, Unix is kind of hard to get out of your system, so is SSH
  • SSH Sentinel – VPN
  • WinSCP – file transfers based on SSH, SFTP or SCP
  • W.bloggar – hey I have a blog don’t I
  • FileZilla –when I don’t feel like winscp-ing
  • Konfabulator – when I have processor cycles and memory to kill, but It looks soo good
  • TightVNC – when a command line it’s just not enough
  • GAIM – all do I prefer Yahoo Messenger, when I have to be on-line on multiple accounts nothing beats this
Multimedia / Design
  • Inkscape – excellent vectorial drawing program, I don’t know what is more appealing the fact that it’s good or that it has SVG as it’s default format
  • GIMP – no commentaries here, it’s a classic
  • DIA  - for diagrams
  • Audacity – when I have to record conversations and then make them MP3 or OGG’s
  • VLC Media Player – for those little movies I keep getting from friends in my emails 
  • PixelRuller – when pixels can not be trusted and have to be measured
  • Magnifier – especially when doing graphics and design it’s good to check tings at pixel level
  • ColorMania – I have a bad memory with color hexa or rgb strings so It’s handy to just have it at hands
Development
  • GVIM – well, old habits die hard, it edits anything more quickly
  • XEmacs – I am an Eclipse convert but still I pay my respects to the ex-one
  • Eclipse – well, the only one which was able to make me quit Emacs
  • XAMMP – IIS is good, but nothing beats Apache, PHP, mod_jk, Tomcat, … and after a couple of battles to manually install all of this, I found XAMMP which did all this in 10 minutes, excellent
  • MySQL, MySQL Administrator, MySQL Query Browser, MySQLCC (I still don’t like the query browser) – because everybody uses a data base and this one is the quickest to work with
  • Postgresql – when MySQL is not good enough
  • WinCVS – when Eclipse is not appropriated
  • Active State Active Python – just because I’m under Windows doesn’t mean that I can’t do it
  • Ruby – I still  hope that one day I will learn it
  • Cooktop – excellent for XML transformations
  • Tidy – all kind HTML,XML of conversions and validations 
  • Gygwin – Windows just isn’t enough, beside that I have a hard time convincing my fingers to write dir instead of ls, or I’m just too lazy to do a Explorer search when I have find and fgrep, did I mentioned gcc, make?
Utilities
  • WinDirStat – in time your free space on your drives tend to disappear, it’s just a handy tool to actually visualize the content of your drive
  • 7Zip – archive manager, it knows all what matters, gzip, bzip, zip, and many more
  • Free Launch Bar – I hate the start menu, it’s just too slow
  • HD Tune – I’d lost a couple of hard drives in my life so checking the temperature and the SMART status it makes a lot of sense to me
  • Notepad2 – because notepad it is just plain stupid
  • VirtualWin – after you spend so much time under Linux, one desktop won’t really fit you any more. 
  • Free Comander – I’m not a big fan of such tools, I’m still the command line guy, but sometime it comes handy

I’m sure there are a couple more I forgot about, but I think the most important ones are above.

December 2nd, 2005

Tomorrow, a new chapter.

Today was my last work day at noLimits, while packing I could not stop thinking about the sadness I felt, even do I did the right thing. But I guess I can not feel in any other way, I put my best into the company and I’m extremely proud of the infrastructure, technologies, methodologies and people I have influenced as I am with the products we imagined, implemented and delivered, it would be hard to forget all those sleepless nights, thought milestones, challenging requirements, exhausting brainstorming sessions and exalting team moments when everything „just” works as beautifully as we imagined.

But life goes on, and I’m looking forward to start working again with the company which helped me become what I am, hopefully my knowledge, attitude and experience will help both Nethrom the company as it’s clients.

November 22nd, 2005

Previous Posts


So, who is Remus?

Remus Pereni is a 32 years old free thinker, IT addict, who lives, works, and wonders about the meaning of life, relations, human nature, IT, technologies, clients, value and business from Satu Mare, Romania. More

Calendar

September 2008
M T W T F S S
« May    
1234567
891011121314
15161718192021
22232425262728
2930  

Categories

Feeds

Links

Most Recent Posts

Picroll

www.flickr.com
This is a Flickr badge showing public photos from premus. Make your own badge here.

Latest Furl Bookmarks

 

GeoURL
My FOAF file
XHTML CSS 508