Questions tagged [getcomputedstyle]
98 questions
0
votes
0 answers
How to determine whether an element is displayed inline or as a block in JavaScript?
The problem: Given a HTML element and potentially some children, can you (and how can you) determine whether it is or will display it's children in a left/right flow (inline) or top-bottom flow (block)?
This problem comes up, e.g., when you want to…

beorn
- 11
- 3
0
votes
1 answer
Removing inline CSS affects styles defined in stylesheet
I'm facing a strange behavior.
I have a script that applies inline CSS to elements from its stylesheet with computedStyle method.
This is a way to copy rich text instead of plain text.
But after the copy, I need to delete the style=""…

Ann MB
- 146
- 1
- 13
0
votes
1 answer
JavaScript Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'
I'm trying to make a little square disappear when clicked but only if it's the wrong choice.
The problem is that I want it to fade away slowly and I have some issue selecting the square.
for (var i = 0; i < difficulty; i++) {
…

Pepe
- 355
- 1
- 4
- 11
0
votes
1 answer
getComputedStyle for the element when its parent is focused
I have a parent which sets a style for the children when it is focused. Which works perfectly when I compile my react project.
I am using react emotion, but it does not matter, because in the end I have usual css.
const parentStyle = css`
…

AlexZvl
- 2,092
- 4
- 18
- 32
0
votes
1 answer
getComputedStyle and getBoundingClientRect
I have HTML text and SVG documents containing text, included as external object. I want to keep the size of the HTML text and the text inside the SVG document identically.

Horst Marutz
- 11
- 3
0
votes
1 answer
getComputedStyle returns unexpected CSS values
I'm trying to access a CSS rule's value using getComputedStyle. The following is the value I'm trying to access:
background: linear-gradient(to right, red , yellow);
But when I test this I instead receive the following value:
rgba(0, 0, 0, 0)…

raffayatiq
- 159
- 9
0
votes
0 answers
How to get and update a list of all elements that have mouse event listeners && a pointer cursor?
elements that have a pointer cursor are either by default clickable elements like links and buttons, or elements that have their css property cursor set to pointer.
some optimizations are needed so not to naively and excessively call…

Wis
- 484
- 7
- 22
0
votes
0 answers
Why my JWplayer not working in Firefox?
I am using a jwplayer in my website. but I am getting this error. Anyone can please tell me that why I get this error.
Error loading player:
window.getComputedStyle(...) is null.
I find some solution but I cannot understand what to do.
and I use…

stackoverhelp
- 61
- 2
- 3
- 15
0
votes
2 answers
Using getComputedStyle with border-box should return height sans border and padding
EDIT 3/Final: Th Computed Style problem/question is explained below but, for the benefit of others coming later, my real problem is solved with Flex Boxes and Vx measurements in conjunction with border-box. IMHO "display: flex;" is the answer to…

McMurphy
- 1,235
- 1
- 15
- 39
0
votes
1 answer
PhantomJS - Getting an element computed style
I'm trying to get the text color and the background color of all p elements on a page:
elements = document.querySelectorAll("p");
console.log("elements " +…

Artemio Ramirez
- 1,116
- 1
- 10
- 23
0
votes
1 answer
Better way to get the border width in javascript?
I use this :
var playGard =document.getElementsByClassName("playGard")[0];
var borderW= getComputedStyle(playGard,null).getPropertyValue('border-left-width').substr(0,2);
I get the value "10".
There is a better shorter way in javascript?
(Get the…

Moran
- 435
- 2
- 6
- 20
0
votes
0 answers
HTML DOM reflow and repaint CSS declared properties function
I was writing a function so that I can create a nicer CSS function instead of having a repaint and reflow every time I set a slew of css (I know use classes this is just a test case) and so I figured the best thing to do first is to get the declared…

EasyBB
- 6,176
- 9
- 47
- 77
0
votes
2 answers
How to update an Object properly?
I've got an object generator. It works properly.
'use strict';
function Div(isim) {
this.loc = document.getElementById(isim);
var style = window.getComputedStyle(this.loc);
this.width = style.getPropertyValue('width');
this.height =…

DifferentPseudonym
- 1,004
- 1
- 12
- 28
0
votes
0 answers
Traversing DOM Elements For GetComputedStyle.getPropertyValue Always Returns Null (Chrome Ext.)
I'm developing a javascript function (used by a chrome extension) that would grab the largest text displayed (from font-size property) on a specific web-page.
It gets the content of the page specified through an ajax call and data that is returned…

Ali Baig
- 3,819
- 4
- 34
- 47
0
votes
1 answer
Trying to Understand How jQuery calculates computed properties for IE8 using currentStyle
I'm trying to understand how jQuery arrives at pixel values for IE8 when dealing with non-pixel based property values, such as margin-top: 2em, or even something like height: auto. For IE9+, getComputedStyle() can obviously provide this easily, but…

Joe
- 1,117
- 1
- 8
- 13