[Javascript] Impossible to dynamically add style sheets in IE?

Troy III Ajnej trojani2000 at hotmail.com
Wed Sep 29 16:38:49 CDT 2004


Not sure if IE can accept more than one global <STYLE></STYLE>,
you can allways change the source css file that is the style of the document 
dynamically, as many times as you like, but surelly the page will not be 
able to update the style that fast.
All the other style src's are appended to the global one and the content 
will grow progressively, and as it will allways cascade to the next 
definition style of the same object, - and this is where it will get a very 
good chance to crash because the browser haven't reached the end of a style 
yet and it has been appended again, so after the change event the browser 
will again proccess the style from the beggining before it gets a chance to 
display it.
I think..., style sheets don't get overwritten in IE, instead they grow, 
there was no need for that because of the casscading nature, the last 
variant of defined attributes of a object gets exclusively rendered as if 
others don't exist. While dinamicaly changing the contents of a style tag, 
it will grow, it will get overwriten only if the page is reloaded
I think...
>From: "Hakan M (Backbase)" <hakan at backbase.com>
>Reply-To: "[JavaScript List]" <javascript at LaTech.edu>
>To: "[JavaScript List]" <javascript at LaTech.edu>
>Subject: [Javascript] Impossible to dynamically add style sheets in IE?
>Date: Tue, 28 Sep 2004 23:43:02 +0200
>
>Included with this file is a test case that (from my testing) crashes 
>Internet Explorer, all versions since 5.0. It's about dynamically adding 
>stylesheets to a page, something that Internet Explorer only seems to be 
>able to do about 30 times.
>
>A quick explanation:
>
>When looking at the page, you will see four headers, all of them have 
>onclick-events running a function. The topmost header is adding the style 
>tag by throwing the string '<style 
>type="text/css">h1{background-color:green;}</style>' to an elements 
>innerHTML-property. The second header does this 40 times in a loop.
>
>The two lower header do nothing, but commented out are an attempt to use a 
>DOM-method of setting the contents of a style-tag, together with the error 
>it produces in IE. Note however that you can still crash IE without setting 
>the contents of the style tag, it's simply a matter of creating them.
>
>Both methods work in Mozilla and Opera.
>
>If anybody feels the need to take this serious, and happen to come up with 
>a solution, I would be very thankful to hear of it.
>
>Regards,
>H
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript

_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20040929/ef19398a/attachment.html>


More information about the Javascript mailing list