1.3.08, 1.3.09 Flashcards
window.getComputedStyle( el [,pseudoElement] )
Is it true that it gives the actual values of all the CSS properties of an element?
YES
window.getComputedStyle is the style actually used in displaying the element, after “stylings” from multiple souces have been applied?
YES
When using window.getComputedStyle
Style sources of the actual values that this method returns, can include:
Internal style sheets
External Style sheets
Inherited styles and browser default styles
???
YES
What window.getComputedStyle(element [,pseudoElement])
do?
It gets the actual values of all the CSS properties of an element, after applying the active stylesheets and resolving any basic computation
When using window.getComputedStyle(element [,pseudoElement]) the styles from where it get the actual values, after applying any basic computation, could be sources from ??
Style sources can include:
internal style sheets
external style sheets
inherited styles and browser default styles
Picture a function dumpComputedStyles that takes two parameters, the element and a property(optional)
If no property is passed as an argument to the function dumpComputedStyles, the function will display all their properties values
Para que nos conviene usar .style.
para setear un style o para obtener un style?
Según la forma en la que usemos .style, pero en gral podemos decir que es mejor usarlo para setear propiedades
Porque es que
la propiedad style no es útil para obtener un style determinado?
Y que es mejor usar?
Porque representa únicamente la declaración CSS que se encuentra en el elemento en forma de “inline” mediante el atributo “style”
Por lo tanto, no va a representar las declaraciones de reglas CSS que procedan desde otros lugares como en
, archivos externos.
Es mejor usar window.getComputedStyle()
Si hacemos esto con la propiedad style, va a reemplazar o añadir a la inline style?
element.style.cssText = ‘color: black’;
Reemplazar
Si hacemos esto con la propiedad style, va a reemplazar o añadir a la inline style?
element.style.color = ‘black’;
Añadir
Si hacemos esto con la propiedad style, va a reemplazar o añadir a la inline style?
element.style = ‘color: black’;
Reemplazar
La propiedad .style. cuando la usamos para setear, agrega en forma inline?
SI
It´s true that we can use document.createTextNode( ‘value’ )
To create text nodes
Yes
How can we create text nodes?
using document.createTextNode( ‘value’ )
For creating new elements, we can use
document.createElement( ‘div’ )
YES
What method can we use to create new elements
document.createElement( ‘div’ )
With el.appendChild( childNode ) we can add a node to the end of the list of children of a specified parent node?
YES
What can we use to add a node to the end of the list of children of a specified parent node?
element.appendChild( childNode )
What will happend when using
element.appendChild ( childNode )
if the given child (childNode) is a reference to an existing node in the document?
appendChild() moves it from its current position to the new position (there is no requirement to remove the node from its parent node before appending it to some other node)
When dealing with
element.appendChild( childNode )
a node can be in 2 positions of the document simultaneously?
No, that´s why if the childNode exist in the document, it will remove it from the old position and appended to the new position
Document Fragment:
is a container for holding nodes?
YES
What happend when we append a document fragment to another node?
It disappears and just the children nodes you have added are present
(the ones that previously added to the document fragment)
What is a document fragment?
A container for holding nodes