Questions tagged [getcomputedstyle]

80 questions
0
votes
0 answers

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` …
Alexandr Zavalii
  • 1,763
  • 3
  • 15
  • 29
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.
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
  • 137
  • 5
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…
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…
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,127
  • 1
  • 9
  • 31
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,008
  • 1
  • 10
  • 20
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
  • 415
  • 1
  • 5
  • 16
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
  • 4,644
  • 7
  • 40
  • 69
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 =…
MindlessRanger
  • 961
  • 1
  • 11
  • 26
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,569
  • 4
  • 29
  • 45
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
  • 905
  • 1
  • 7
  • 12
0
votes
1 answer

How to get computed CSS of external URL?

Is it possible to get the computed style of different HTML tags from an external URL? getComputedStyle helps me to get the computed style from my own web page, but I would like to extract CSS values of different elements from other web pages. What…
0
votes
4 answers

How can I distingush between the content property of the ::before element being not specified at all and being specified as an empty string?

How can I check in javascript (with jQuery) if the 'content' property is set on a before or after pseudo element? In chrome, window.getComputedStyle(elem, '::before').getPropertyValue('content') returns an empty string both when 'content' is set to…
chris.va.rao
  • 365
  • 1
  • 8
0
votes
1 answer

How can I do getComputedStyle in IE

I have an div and I don't set any style to it, then I put some content into it, so it height could grows Now I want to get its height in IE8 or IE7, which have not getComputedStyle method If I use currentStyle property, the return value is auto, not…
hh54188
  • 13,085
  • 30
  • 99
  • 174