Javascript: Is it safe to refer to the <html> DOM-node? -


working in environment css-selectors available retrieving elements want obtain element in dom covers whole browser-window. using developer tools found out <body> has margin in case makes unsuitable requirements.

i further discovered <html> element covers whole area of browser-window. safe use dom-node when document properties? i.e. getting width/height example?

does chance <html> correspond referred document in javascript?

edit: side note on setup:

i'm working interns wrapped wd version , want coordinate mouse movements relative document. aiming using method selectbycssselector coodinate mouse movements respect selected element. working <html> node here seems work out far. never touched <html> node before , never saw else do, why wanted assured not bad using node.

the document object dom html object so, yes, correspond <html> tag, not in way think. not <body> or <span> tag. tells browser following code or information html. how <?php tells server there php code , <script type="text/javascript"> tells browser there javascript code. more information on that, check out this page.

if don't want width , height of body, can use window.innerwidth , window.innerheight. should height , width of entire window (excluding scrollbars or toolboxes).

you can use documentelement width , height of entire document.

var height = document.documentelement.clientheight; var width = document.documentelement.clientwidth; 

this may final answer looking for, can find width , height of entire document using document in jquery.

var width = $(document).width(); var height = $(document).height(); 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -