1.3.6 - Getting and Setting Attribute Node Values Flashcards
.attributes, .getAttribute, .setAttribute are properties to work with nodes of type element?
YES
It is true that .attributes returns a live collection of all attribute nodes in the specific node?
YES
.attributes returns what?
a live collection of all attributes nodes in the specific node
.attributes returns a live collection of all attribute nodes…
That collection is a Array or a NamedNodeMap?
It´s a collection of NamedNodeMap, so it has´nt Array methods
What does this?
We are returning all the attributes from the first link (a tag) in the document
We are using .nodeName and .nodeValue to console log the attribute name and the attribute value
It is true that .getAttribute(attributeName) returns the value of a specified attribute on the element?
YES
.getAttribute() how many parameters needs?
One
.getAttribute(attributeName)
When using .getAttribute(attributeName) if the given value does not exist, the value returned will be…
either null or ”” (empty string)
How can we check if an attributeName exist prior to calling .getAttribute(attributeName)
We can use .hasAttribute(attName)
.hasAttribute(attName) returns true or false
What does .getAttribute(attName)?
returns the value of a specified attribute on the element. If the attName does not exist, returns null or “” empty string
How can we get the Attributes of an element?
Using
.attributes or .getAttribute(attName)
It is true that .setAttribute(name, value) adds a new attribute or change the value of an existing attribute on the specified element.
YES
How can we add or change an attribute on a specified element?
using
.setAttribute(name, value)
.className what it does?
gets and sets the value of the class attribute of the specified element
var cName = elementNodeReference.className; elementNodeReference.className = cName;
It is true that .classList is a read-only property which returns a live collection of the class attriutes of the element?
YES