Site Navigation

Showing posts sorted by date for query style tag. Sort by relevance Show all posts
Showing posts sorted by date for query style tag. Sort by relevance Show all posts

Tuesday, January 5, 2010

bug 396 - more style tag limits in IE

Issue: #396
Affects: IE6, IE7, IE8

Microsoft Support KB: 262161

You may already be aware that Internet Explorer has some limitations with the amount of CSS it can handle (bug 327) so that you can only load a CSS file up to ~288kb in size and the total number of CSS selectors/style rules can't exceed 4096 but there's more!

IE will also only allow you to have a maximum of 30 style tags on a page! So if you have a site that injects a lot of style tags on the fly for components/widgets you may want to think twice about this approach.

Run this code in IE and note that IE caps out at 30 and doesn't create the addition 70 stylesheet tags.


Example:
(note: this is IE specific code)

<html>
<head>
<script type="text/javascript">
function createStyleSheets(){
for(i=0;i<100;i++){
document.createStyleSheet();
var msg = 'Total Style Sheets = [<b>' + i + '</b>] of 100.';
document.getElementById('ssCount').innerHTML = msg;
}
}
</script>
</head>
<body onload="createStyleSheets();">
<div id="ssCount"></div>
</body>
</html>



How many style tags do you have on your page? Add this bookmarklet to your browser and find out. (note if you run it in IE and it says 30, you may well have hit the limit!)

# style tags


Known Workarounds: None.



Related Issues: (bug 327).


Bug/Site Feedback |
Submit a bug

Wednesday, August 12, 2009

bug 179 - .innerHTML love outside the body is hit and miss

Issue: #179
Affects: IE6, IE7, IE8, Safari 4, Chrome 2

As most developers know, setting the .innerHTML of an element is one of the fastest ways to dynamically set the content of an element. However there are a few issues when setting the .innerHTML on some elements in some browsers.

For example trying to set the .innerHTML on a [Table, THead, TFoot, TBody, TR] in IE it will fail as will trying to set it on a Select, Pre, or even a (Div with overflow:auto).

Thinking outside the <body> tag, there's a few more tags that you might want to set the .innerHTML on.

The <html>, <head>, <title> tags. Now we can argue that the title tag doesn't accept HTML, but well, we'll let the results speak for themselves.

<html>.innerHTML:
Firefox: Works
Internet Explorer: Fails
Safari: Works
Chrome: Works
Opera: Works

<head>.innerHTML:
Firefox: Works
Internet Explorer: Fails
Safari: Fails
Chrome: Fails
Opera: Works (Partially) resets the title but doesn't update styles or scripts

<title>.innerHTML:
Firefox: Works
Internet Explorer: Fails
Safari: Fails
Chrome: Fails
Opera: Works



Known Workarounds: Use DOM methods to update the content of various tags, and document.title to reset the title value. Just keep in mind that there are other bugs with setting the contents of the script tag, and style tag in IE.


Related Issues: None.


Bug/Site Feedback |
Submit a bug

Sunday, February 8, 2009

Fixed bugs in IE8

Fixed bugs in IE8:

We've started to aggressively mark those bugs that are fixed in IE8 as such. The final version of IE8 has yet to be released but there is a presumption that a bug that is fixed in IE8 RC1 will remain fixed for the IE8 RTM release.

However there is a significant catch. When Microsoft fixed most of these bugs, they only fixed them in the "IE8 Standards Mode" which is the new mode that IE renders content in its "best possible, most standards way that it can".

This means that in order to see any of these fixes work, you MUST generate your pages with a valid doctype and the page MUST be somewhere on the Internet, not the Intranet (A point most developers argued against but Microsoft stood firm).

That all said, bugs marked with the "Fixed" tag are bugs that from preliminary testing appear to be working fine in IE8 in IE8 Standards Mode.

With deep regret (ours) there are also bugs that Microsoft has indicated will not be fixed in IE8 RTM, and those have been marked with the "Broken By Design" tag.

IE8 RTM is on the horizon now and the IE Team has indicated that there will not be any more public IE releases before the final (we hope that means there will be another private release, but we aren't getting our hopes up).


If/When time permits, we'll publish a complete list right here so that there is a quick list to check against. Thanks for all the input and bug submissions (for any browser of course) and feedback.

[List will go here]
Fixed:
(bug 101) - buttons render stretched and distorted in IE (WinXP)

(bug 152) - getElementById returns incorrect objects in IE and Opera

(bug 154) - getElementById is NOT case sensitive in IE

(bug 163) - no valign in table cells in IE8

(bug 165) - dynamic pre population fails in IE

(bug 184) - The catch to Try Catch Finally in IE

(bug 190) - fieldsets are broken in IE8

(bug 215) - no hasAttributes() support in IE6, IE7

(bug 217) - getAttribute doesn't always work in IE

(bug 229) - not everything is absolute in IE

(bug 268) - hasAttributes not supported in IE

(bug 293) - can't disable options in IE

(bug 299) - setAttribute "checked" does not work in IE

(bug 329) - Element.setAttribute('style', '...') fails in IE8 Beta 1

(bug 333) - microsoft drops all support for opacity in IE8!

(bug 341) - the button element submits the wrong value in IE

(bug 347) - IE8 Beta 1 - text highlighting background issue

(bug 371) - named anchor links are broken in IE8

(bug 471) - font-weight:600 stretches text in IE



Broken By Design:
Status: Microsoft has confirmed that these bugs will NOT be fixed in IE8 RTM
(bug 109) - JavaScript prompt() in IE - How did this not get fixed in IE7?!

(bug 126) - no W3C DOM Level 2 Event Listeners

(bug 132) - slow checking checkboxes required in IE

(bug 210) - No .innerHTML support on Table, THead, TBody, TFoot, Tr's in IE

(bug 237) - type is a readonly attribute in IE

(bug 256) - DOM nodeType constants are not in IE and Opera

(bug 274) - DOM Methods on Select Lists don't work in IE

(bug 342) - Connecting... in IE7 / IE8 takes F-O-R-E-V-E-R

(bug 411) - getElementsByName doesn't work in IE

(bug 421) - IE fails to pass the HTTP Referer on many navigations






Bug/Site Feedback |
Submit a bug

Thursday, January 15, 2009

bug 143 - createTextNode() doesn't work on the style tag in IE

Issue: #143
Affects: IE6, IE7, IE8

Using the DOM to generate elements is ideal, but when you want to generate a style tag, you can't use the DOM methods to populate it in IE.

Example:

<script type="text/javascript">
var styleTag = document.createElement('style');
styleTag.appendChild( document.createTextNode('.foo {color:#ff0000;}') );
var bodyTag = document.getElementsByTagName('body')[0];
bodyTag.appendChild( styleTag );
</script>


In all browsers except IE, this will append a style element to the page, with the style definition for the "foo" class as the content.


Known Workarounds: One. For IE, we have to divert from the spec., and use the styleTag.styleSheet.cssText property instead.

Example Workaround Code:

<script type="text/javascript">
var styleTag = document.createElement('style');
styleTag.styleSheet.cssText = '.foo {color:#ff0000;}';
var bodyTag = document.getElementsByTagName('body')[0];
bodyTag.appendChild( styleTag );
</script>



Related Issues: (bug 142).

Friday, November 28, 2008

bug 471 - font-weight:600 stretches text in IE

Issue: #471
Affects: IE6, IE7, IE8 Beta 1, IE8 Beta 2, Chrome 5,6,7
Fixed In: IE8 PR 1

Update: This apparently affects Google Chrome now (v5,6,7)


When styling text on your site there are several options for bolding. You can use the classic <b> tag, the <strong> tag, or any tag with styling set for the font-weight.

Example:

<style type="text/css">
.example1{
font-weight:bold;
}
.example2{
font-weight:700;
}
.example3{
font-weight:??;
/*normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit*/
}
</style>


Every option works as intended with the exception of 600 in IE. IE will render any text with a font-weight:600 about 10% wider than normal text (regardless if ClearType is turned on or off).


The Quick Brown Fox Jumps Over The Lazy Dog. Please Don't Hurt The Web - Use Web Standards. (@500)



The Quick Brown Fox Jumps Over The Lazy Dog. Please Don't Hurt The Web - Use Web Standards. (@600)



The Quick Brown Fox Jumps Over The Lazy Dog. Please Don't Hurt The Web - Use Web Standards. (@700)


Note: Updated the style to a fixed-width font to better illustrate.



Known Workarounds: None.


Related Issues: None.


Bug/Site Feedback |
Submit a bug

Friday, April 18, 2008

Bug or Feature? - Round Two

Round Two - Safari changes your styles did you know?

Other rounds: [One|Two|Three|Four|Five]

We're back again with another round of "Bug or Feature?" (see round one) highlighting a particular behavior in one or more browsers, that, well, could be a Bug, or it could be a Feature... we'll open up the comments for your vote and opinion.

Alright, what's todays "Bug or Feature"?

Synopsis:
In Safari, usability of textarea elements has been greatly improved by allowing the user to decide how wide and how tall it should be, by making a grippy that the user can drag to stretch. Its a great feature, that many other browsers are looking into (Ask ASA, it's on his top 10 for Mozilla Firefox).

What is interesting, is that as a developer, if you ask for the .innerHTML of an element that wraps a textarea in JavaScript, it will report back exactly what you supplied... *except* if the user changed the dimensions of the textarea, the style attribute is now filled with margins, paddings, width and height values that you didn't specify.

If I have the following HTML, I would expect it to return the same content:

Example HTML snippet:

<div>
<textarea name="a_textarea" cols="40" rows="4">
Hello World
</textarea>
</div>


Expected [div].innerHTML returned:

<textarea name="a_textarea" cols="40" rows="4">
Hello World
</textarea>


Question:

If the user stretches the textarea in Safari (or later in other browsers), and you asked for the .innerHTML and got something different than the HTML fragment above...

Try it yourself.


(ignore the br tag in the alert (blogger auto-inserts this)

Is this a Bug? Or a Feature?

Vote "Bug" or "Feature", and add your thoughts.