This has been discussed many times before .. if i recall correctly its somehting to do with Quirksmode
HTH Alex ----- Original Message ----- From: "kimbaudi" <[email protected]> To: "Prototype & script.aculo.us" <[email protected]> Sent: Monday, June 08, 2009 5:58 PM Subject: [Proto-Scripty] Why does document.viewport.getDimensions() not work without a DOCTYPE? > > Hi, I have taken a look at the Prototype API and it says that > document.viewport.getDimensions() should return the size of the > viewport. I have created a simple page with a <div> with width of > 100px and height of 100px. I am hoping to alert the height of the > browser window, but I get the height of the div. I didn't understand > why the height of the div got alerted instead of the browser window. > It appears that I needed to add a DOCTYPE in order for > document.viewport.getDimensions() to work properly. Can anybody > explain why the DOCTYPE is required for Prototype to return the > correct viewport height? I have pasted the code that incorrectly > returns the height of the div instead of the viewport on pastie: > http://pastie.org/504692. > > Just add a doctype and you get the correct result: > Replace <html> > with > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> > <html xmlns="http://www.w3.org/1999/xhtml"> > > > I hope to use Prototype with Ext JS in the future, but it seems that > Prototype recommends/requires the use of DOCTYPES while Ext JS > recommends against using DOCTYPES in order to avoid bugs in IE. > > - Paul K > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---
