Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8627131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:12:00+00:00 2026-06-12T08:12:00+00:00

I used Mustache to generate some HTML and used insertAdjacentHTML to place it on

  • 0

I used Mustache to generate some HTML and used insertAdjacentHTML to place it on the page. It apparently converted to a DOM structure alright since I can get a handle to it afterwards by using a document.querySelector('.contentarea') call. However, if I try to get a pixel value for width or height, it keeps throwing back 'auto'.

Thinking it might just be a problem with getComputedStyle, I tried using .getBoundingClientRect and .offsetWidth instead. Both returned 0. It works if I delay the call slightly by placing it inside a setTimeout(function(){}, 1), but that’s not practical for my production code since it needs to go inside a synchronous constructor.

This is happening in both Firefox (Aurora), and Chrome.
I remembered reading an article on how Mozilla improved DOM manipulation performance by using lazy frame construction and thought there might be a bug with the frames being a little too lazy, but since it’s happening in Chrome as well, that seems less likely.

Does anyone have any ideas about what’s going on here or how to work around it? I really need the pixel height/width information immediately after inserting the HTML.

PS: Do any browsers do the HTML to DOM parsing/building in a separate thread? I was thinking that might cause this sort of behavior as well.

NEVERMIND: It was my own fault. I just didn’t notice a display: none; style that was set before the code tried to get the measurements.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T08:12:01+00:00Added an answer on June 12, 2026 at 8:12 am

    There are a couple of things that can cause a result of “auto”. You found one of them; display: none. If an element is inline it will also return auto.

    Essentially it must be a block or inline-block element and it must be rendered.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used SWIG for generating some native JNI function interface for Irrlicht C/C++ 3D
I used CouchDB 1.1.1 with self-signed certs fine for some time. Then, I purchased
Used http://www.ilbcfreeware.org/software.html - I only get static from the files that ilbc_test.exe creates. Does
I used bind all GridViews , DetailViews etc. on my page using an ObjectDataSource
Used as a scripting language, does Scala have some sort of include directive, or
Used this http://code.google.com/webtoolkit/doc/latest/DevGuideRequestFactory.html tutorial to understand the basic concepts, but having problems running my
I used to work in a place where a common practice was to use
I used jQuery to set hover callbacks for elements on my page. I'm now
used image as like map , user can zoom in/out this image.geting x and
I used the tabhost tutorial to get started with the Tabhost control. After some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.