Utmaningar
F09-01: Which object is the "global object" in the browser?
- document
- window
- object
- module
Svar
window
F09-02: DOM is an abbreviation for....
- Dynamic Object Moderation
- Document Over Modulation
- Document Object Model
- Dynamic Over Mode
Svar
Document Object Model
F09-03: How many "Elements" does the snippet contain?
- 2
- 3
- 4
- 5
- 6
- 7
Svar
2 element. P-elementet och A-elementet.
F09-04: How many "Nodes" does the snippet contain?
- 2
- 3
- 4
- 5
- 6
- 7
Svar
6 noder. P-noden, A-noden, textnoden "Foo" samt tre tomma textnoder innehållande whitespaces.
F09-05: How many "attributes" does the snippet contain?
- 2
- 3
- 4
- 5
- 6
- 7
Svar
2 attribut. "class" och "href"
F09-06: Which options do you have to select the li element containing the text node "Second one"?
- document.querySelector('#SecondOne')
- document.querySelectorAll('li')[1]
- document.getElementById('numberlist').firstChild.nextSibling;
- document.getElementById('numberlist').children[1]
Svar
document.querySelectorAll('li')[1] och document.getElementById('numberlist').children[1]
F09-07: How do you create a new ELEMENT_NODE using javascript? (Multiple choice)
- document.createElement()
- document.createTextNode()
- anotherNode.cloneNode()
- node:create "ELEMENT_NODE"
Svar
- document.createElement()
- anotherNode.cloneNode()
F09-08: Given HTML and CSS...Which class/classes is set on the div?
- red, blue, tiger
- blue, number, tiger
- blue, tiger
- red, number
- number, red, blue, number, tiger
Svar
blur number tigerF09-09: Why do we use templates (<template>)?
- Better performance than creating nodes using js
- They help us separate html from js
- It is a better version of flash
- Templates are cached in the browser. JS-code is not.
Svar
The help us seperate html from jsF09-10: Why do we not want styling to be done in our javascript files? (Multiple choice)
- CSS generated from javascript will not be rendered
- Modern browsers won´t accept CSS manipulation in javascript code as it opens up for security issues
- Seperation Of Concern is a design goal that simplifies the maintenance of an application
- Designers would probably like to have CSS separeted from javascript