-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When creating style tag, include type="text/css" #747
base: master
Are you sure you want to change the base?
Conversation
Can you provide more information about how you encountered this problem? We test dgrid with IE regularly and have never encountered this - and it would have come up awfully quick given that addCssRule is used throughout dgrid. I'm wondering if your document is perhaps missing a doctype and thus is running in quirks mode? |
According to the F12 dev tools, the browser mode is IE9 and the document mode is IE9 standards. Is IE9 included in your tests (with X-UA-Compatible set appropriately)? The exception is "Invalid argument" when trying to access the extraSheet's sheet property. Looking a little more into the style tag, it looks like type may be required? Or at least the content model changes depending on its value according to the HTML5 reference. It seems appropriate to include type="text/css" at any rate. |
Yes, we test frequently with IE8-10 and also test IE6-7 and haven't seen this issue on any of the test pages in dgrid's test folder, and they would all run into it given that You mention X-UA-Compatible, but really the "appropriate" way to set that is to not set it at all. Including a doctype and omitting X-UA-Compatible should use the standard rendering engine of the version of IE you are using. The |
We've stumbled across another IE9 bug so I thought of a new way to try to recreate this and I was successful. Apparently IE9 can only have 31 stylesheets, period. During development, we don't compress/reduce the number of stylesheets so we were actually right at this magic number. When the misc module attempts to add a We will probably be switching over to compress during development for the bulk of the CSS so we'll be under this number. It still may be worth fixing so you at least don't have to deal with a strange exception. References: |
Here's the reproduction. Remove one of the <!DOCTYPE html>
<html>
<head>
<title>addCssRule test</title>
<style type="text/css">/* 1 */</style>
<style type="text/css">/* 2 */</style>
<style type="text/css">/* 3 */</style>
<style type="text/css">/* 4 */</style>
<style type="text/css">/* 5 */</style>
<style type="text/css">/* 6 */</style>
<style type="text/css">/* 7 */</style>
<style type="text/css">/* 8 */</style>
<style type="text/css">/* 9 */</style>
<style type="text/css">/* 10 */</style>
<style type="text/css">/* 11 */</style>
<style type="text/css">/* 12 */</style>
<style type="text/css">/* 13 */</style>
<style type="text/css">/* 14 */</style>
<style type="text/css">/* 15 */</style>
<style type="text/css">/* 16 */</style>
<style type="text/css">/* 17 */</style>
<style type="text/css">/* 18 */</style>
<style type="text/css">/* 19 */</style>
<style type="text/css">/* 20 */</style>
<style type="text/css">/* 21 */</style>
<style type="text/css">/* 22 */</style>
<style type="text/css">/* 23 */</style>
<style type="text/css">/* 24 */</style>
<style type="text/css">/* 25 */</style>
<style type="text/css">/* 26 */</style>
<style type="text/css">/* 27 */</style>
<style type="text/css">/* 28 */</style>
<style type="text/css">/* 29 */</style>
<style type="text/css">/* 30 */</style>
<style type="text/css">/* 31 */</style>
</head>
<body>
<script src="dojo-release-1.9.1-src/dojo/dojo.js"></script>
<script>
require(["dgrid/util/misc"],
function(misc) {
misc.addCssRule("body", "background-color: red");
});
</script>
</body>
</html> |
Ah, so this is what you were running up against... yes, this is quite a well-known and despised limitation of IE. If dgrid were to do something about this it would basically have to fall back to appending style rules to some random other stylesheet in the page, which I'm not sure how I feel about, but maybe it's a fair compromise for IE... (It'd be just about the only compromise, really.) |
When trying to create the
<style>
tag in IE9, an exception is thrown.extraSheet.sheet
throws the exception.It looks like you need to supply
type="text/css"
when creating the tag.