How to get the CSS widthheight of a container element.
How to get text width in javascript. Use this method if you need to know the width of a text before writing it on the canvas. I had to keep in mind that I was using the textarea togheter with tinymce wysiwyg editor. Lets show you each of them separately and point the differences.
If you want a fractional value you should use elementgetBoundingClientRect. Gets the total width of the page content var page_width documentbodyoffsetWidth. If you want a fractional value you should use elementgetBoundingClientRect.
So now is solved. The text must be retrieved using javascript object from tinymce script. The tag is not supported in HTML5.
If transforms exist the properties return the elements layout width and height whereas getBoundingClientRect returns the rendering width and height. Get the computed font-size for your text element instead. Creating a new DOM Element and measuring its width.
The text must be retrieved using javascript object from tinymce script. Then added it to the body of the element using the appendChild method. Problem is if the text follows a path then the width isnt the actual width of the text for example if the text follows a circle path then the bbox is the one that encloses the circle and getting the width of that isnt the width of the text prior to it going around the circle.
If you want to get the total Height and Width of the page content in JavaScript you can use this code. Javascript returns no width-2. Gets the total height of the page content var page_height documentbodyoffsetHeight.