Issue 57: DOCTYPE Strict iframe bug/fix
Status:  Fixed
Owner:
Closed:  Nov 2008
Project Member Reported by william....@gmail.com, Aug 5, 2008
The documentation clearly states W3C valid HTML (Transitionnal) but here 
is something for those who have to use doctype strict

Windows XP 
jquery-1.2.6.pack.js
jquery.nyroModal-1.2.8.js

What steps will reproduce the problem?
1. Occurs in FF and Safari, not IE 
2. change doc type
comment out/remove this one
<!--<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 
Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd">-->

use this one
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 
Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

3. click on a nyromodal link that opens an iframe with content that stays 
inside the box

What is the expected output? What do you see instead?

running broke.html will show the issue in FF [<script 
type="text/javascript" src="js/nyro.graybox.anim.js"></script> containing 
the fix is commented out]
running nyromodal.html will show the issue fixed in FF

no scroll bars BUT a vertical scroll bar appears

Please use labels and text to provide additional information.

fix located in file nyro.graybox.anim.js [line 8]
can also see in jquery.nyroModal-1.2.8.js [line 372] where else it could 
be put
fixed in the customer settings.showContent{
....
//if in doctype strict, and not IE, needs to be height 99%
if(settings.type&&settings.type=='iframe'){
	$('iframe',elts.content).eq(0)
		.css({
			width: '100%',
			height: '99%'
		});
	}
...
}
 
doctype_strict.zip
95.2 KB   Download
Oct 16, 2008
#1 rob.cas...@gmail.com
i'm starting to use nyromodal in a xhtml-strict drupal theme, and finally came to the
same conclusion before i saw your post/fix

much appreciated...an extra scrollbar wouldn't have kept me from using nyromodal, but
nice to get rid of it anyway :)
Oct 29, 2008
Project Member #2 nyro...@gmail.com
Does anybody has a tip to detect if the current page is using a strict doctype?
Oct 29, 2008
Project Member #3 william....@gmail.com
see my attached file

an IE 6 fix that I found is the use of a property called document.compatMode but that
is not universal

//from http://www.evolt.org/article/document_body_doctype_switching_and_more/17/30655/
if (window.innerWidth!=window.undefined) return window.innerWidth;
if (document.compatMode=='CSS1Compat') return document.documentElement.clientWidth;
if (document.body) return document.body.clientWidth;
return window.undefined;

another site that talks about it
http://www.webmasterworld.com/html/3342808.htm
test.html
701 bytes   Download
Oct 29, 2008
Project Member #4 william....@gmail.com
http://www.webmasterworld.com/forum91/2634.htm
gave me the code for the attached file

<script type="text/javascript">
strict=false
var d=document.doctype
strict=(document.compatMode=="CSS1Compat")
strict=(d&&d.systemId?(d.systemId.indexOf("strict")>-1?true:(d.publicId.indexOf("transitional")>-1?true:false)):(d&&d.publicId.indexOf("transitional")==-1?true:strict))
strict=(d&&d.name.indexOf(".dtd")>-1)?true:strict
alert("strict= "+strict)
</script> 
Oct 31, 2008
Project Member #5 nyro...@gmail.com
Both of them aren't working properly
In Opera 9, I get false in all cases.
In IE 7, I get true in all cases.

Oct 31, 2008
Project Member #6 william....@gmail.com
i have seen the html attachment work in safari 3.1.2 and ie6 seems to to be always strict  = true.

use the syntax to completly eval the doctype youself and determine proper values

var d=document.doctype
	alert("d: " + d);
	//d can be null if not specified
	if( d ){
		alert(d.name+"\n"+d.publicId+"\n"+d.systemId); 
	} 

\/this could be the down fall
strict=(document.compatMode=="CSS1Compat")

might be be screwing it up.  i did not provide a complete fix just from my point of view for a very good 
starting point for you.  i think the code i provided is a good starting point to determining things like doc type 
BUt it might be doctype AND browser dependant.

to evaluate the header doctype if you do not trust the browser interpretation. do an evaluation yourself, it 
seems it might be browser type + strict evaluation you need to use 99% plus who knows what other weird css 
or other type bugs you will run into.   I see what you are saying my safari says one thing no matter what but 
my ie says something else. if anything do your own interpretation of the compatibility using the part i added 
up above.  it does not have to be perfect.  but if it can detect some issues like we found above, the better.  it 
does not have to work for everyone as long as we keep backwards compatibility ok nryromodal will improve.  
just make sure if it cannot make the call, it degrades back to how it worked originally.  but if it can tell 
correctly how to render it does we will be in better shape.


Nov 5, 2008
Project Member #7 william....@gmail.com
http://www.evolt.org/article/document_body_doctype_switching_and_more/17/30655/
There would be no need for different modes of web page rendering if we were all 
willing to learn, apply, comply with standards. It is known that Opera only knows of 
1 rendering mode and Opera does not bother at all whether a document has or has not 
a doctype declaration. Opera always try to render the page in strict compliant mode. 
And this is what all browsers should aim at achieving.

this explains why you always get strict mode from opera
Nov 29, 2008
Project Member #8 nyro...@gmail.com
The version 1.3.1 is now released and include a doctype check with some HTML change
when needed.
Any comment will be appreciated!
Status: Fixed