Questions tagged [cssom]

CSSOM defines APIs (including generic parsing and serialization rules) for Media Queries, Selectors, and CSS itself.

The core features of the CSSOM are oriented towards providing basic capabilities to author-defined scripts to permit access to and manipulation of style related state information and processes.

Documentation: http://dev.w3.org/csswg/cssom/

64 questions
1
vote
2 answers

Apply CSS font before JS execution

I'm building the web application which uses canvas surface on top of HTML body. I use canvas to draw border around SPANs. It works nearly perfectly but I still have a problem on the page load. I've used chrome debugger and noticed that font style…
ghi
  • 697
  • 2
  • 9
  • 20
1
vote
0 answers

JS access to stylesheet in XHR Document

If I inspect the current document with javascript using document.styleSheets, I will get a StyleSheetList object back which lists all of the document's current stylesheets. I'd like to do the same for inline stylesheets in a document fetched via…
Gregable
  • 523
  • 4
  • 10
1
vote
1 answer

Getting stylesheet object from ownerNode(style tag)

I have a multiple style tags in my webpage, and i want to manipulate the cssRules in them. How can I get the styleSheet as in document.styleSheets object from a style element. A way could be scanning all the styleSheets in document.styleSheets and…
Moazzam Khan
  • 3,130
  • 2
  • 20
  • 35
0
votes
1 answer

Assign property reference in javascript

I am working on a small javascript script to edit CSS code and I found out there are many ... particularities, if I may say so, with internet explorer in comparison to other browsers. For instance the rules object of the document.stylesheet object…
0
votes
1 answer

At what point in the parsing/rendering process do HTML elements get assigned a box model?

Is it during the construction of the CSSOM (where possibly default padding/border/margin is applied to all nodes)?
Joel Castro
  • 485
  • 6
  • 20
0
votes
0 answers

How to create a render tree form DOM and CSSOM?

Everywhere it is written that the browser parses HTML into DOM and css into CSSOM and combines them to create a render tree. There is official docs for creating DOM and CSSOM but I can't find any resources for combining them into render tree and…
lorem1213
  • 433
  • 4
  • 11
0
votes
1 answer

How to print HTML before DOM tree is parsed?

I have read at https://web.dev/howbrowserswork/#The_main_flow that printing the website is a gradual process, and will not wait before the DOM/CSS/RENDER/LAYOUT tree is parsed completely. It's important to understand that this is a gradual process.…
Adam
  • 25,960
  • 22
  • 158
  • 247
0
votes
2 answers

JS RegEx to return a hyphenated word and then another word/value

I'm having some RegEx trouble, but I am aiming for this snippet of code to read an input such as "background-colour:red;" , validate the syntax, then take "background-colour" and "red" into an array. It currently returns ["background-colour"] , but…
Morri
  • 1
0
votes
2 answers

Style for disabled property in css object model

For some reason, I need to pass CSS objects using CSS object model inside a react component. Here, I need styles for buttons when they are disabled and when not disabled. Like we do with: backgroundColor, borderRadius and such. const controlButton…
0
votes
0 answers

Performance of combining multiple class selectors

I'm a front-end developer and I've been reading about the performance of CSS selectors and I wanted to ask you about a practice I use a lot in my projects to reuse styles "see attachment 1" and I wanted to know: What are the advantages and…
AlexM
  • 1
0
votes
0 answers

Changing css style with document.getElementsByClassName

In CSS I am trying to assign multiple elements ids to a class and change their display property to "none" using a javascript with both document.getElementsByClassName and style.display. In css I used #content.myClass which I found in this…
caston
  • 159
  • 12
0
votes
1 answer

Changing the CSSOM css style properties in javascript

I am trying to use style.cssText to display hidden paragraphs using javascript. Here is my code: html:

Latest Toy Pictures

Greatest Toy…

caston
  • 159
  • 12
0
votes
1 answer

Simple Explanation of CSS/HTML/JS dependencies in browser

I just want to verify if I am understanding this correctly. When the browser receives an HTML page it will begin parsing the HTML into the DOM, and any style tags into the CSSOM. upon encountering any resource requests, fire of those requests to…
Battlefrisk
  • 55
  • 1
  • 6
0
votes
1 answer

How to express a predictably repeating pattern of declarations in CSS?

Is there any elegant (ie. non-verbose) way to express the following CSS styles in a stylesheet? .my-class ul li::after {left: 162px;} .my-class ul ul li::after {left: 180px;} .my-class ul ul ul li::after {left: 198px;} .my-class ul ul ul ul…
Rounin
  • 27,134
  • 9
  • 83
  • 108
0
votes
1 answer

Is there any specification for the value of Element.scrollLeft in RTL elements?

Different browsers render different values for Element.scrollLeft in RTL elements. (More details in this question). And according to the MDN, if the direction of the element is rtl, the scrollLeft should be 0 when the scrollbar is at its rightmost…
KeyBored
  • 601
  • 4
  • 14