I meant that I have no control over whether the page I'm deploying into will have a doctype or not, so I have to sniff for that to find out if I'm in a doctype'd page. My stuff is simply included into pages via a javascript include tag, I have to work in the environment I'm told. Even if it were...
Oops, posted too soon. That test is wrong. It needs to test specifically for IE as Firefox can also go into quirksmode. Here's the updated line:
if(IE && document.compatMode=="BackCompat")
~dd
Results of my test on IE7/XP and IE7/Vista:
In quirks mode IE7 accepts the _width and _height as before. That's a good thing.
The bad thing is that when IE 5/6/7 is in strict CSS compliance mode it STILL accepts the _ values. So you can't just write them assuming that they'll only have an...
Interesting idea, I like your thinking :)
I wonder about the doctype effect. Whether IE would still conform to it's buggy behavior or whether it would realize it has to not tolerate that _height because it's in strict compliance mode. Some tests are in order :)
~dd
Thanks Dan, I'd already looked into that. Unfortunately IE (even version 6) still is only compatible with Javascript 1.2. Unless someone comes up with something better it looks like keeping it hidden inside eval statements that are not executed by IE4/NS4 is the safest way.
~dd
OK thanks.
btw, I found a property that IE uses to signal it's alternate behavior:
document.compatMode 'CSS1Compat' or 'BackCompat'
I won't be using this though as I now see that using padding or margin is not an acceptable way of positioning objects within the content portion of the...
Do you know if it's possible via javascript to determine whether IE is using this "correct" doctype? I'll need to do something roughly like this:
if(IE&¬-correct-doctype)
manipulate padding
else if(gecko || (IE&&correct-doctype))
manipulate padding and compensate in width&height
Thanks Vragabond. Interesting. It's kind of odd though that the width/height is reported still as 600x400 on gecko browsers although it clearly isn't.
As for IE5/5.5/6 I need to be compatible with all of them.
Adding a doctype isn't an option, I'm adding these DIV's into other peoples pages...
When I said I want to "USE" try/catch in IE4/NS4 I meant I simply want to have it present in the javascript files. I wouldn't be trying to USE it. Sniffing would cause those browsers to avoid the try/catch code.
Although IE4/NS4 don't support try/catch functionality, they do have those names as reserved keywords. Clearly they were planning to support it.
If you have a block of JS with try/catch anywhere within it, even if the code isn't executed by IE4/NS4 due to logic/sniffing, it still causes a...
Hi,
I have a DIV layer and in the style properties I set this:
"position:absolute;width:600px;height:400px;padding:100px 0px 0px 200px;"
That means everything inside the DIV should be 100pixels down from the top and 200pixels in from the left.
In IE the width/height of the DIV is 600/400 as...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.