1. Tools
1.1. yui compressor
1.1.1. Obfuscates and compressed
1.1.1.1. short names
1.1.1.2. css compression
2. Browser compatibility
2.1. Events
2.1.1. http://www.quirksmode.org/dom/events/index.html
2.2. Autohead
2.2.1. Automatical creating 'head' element even if it doesn't exist
2.2.2. Disabled in android, iPhome, Opera 8
2.2.2.1. That's why adding script to head from code may fail here
2.3. When you modify body from script which isn't a part of it - you get 'Operation aborted' in IE
2.4. Correct insertion of script
2.4.1. var first = document.getElementsByTagName('script')[0]; first.parentNode.insertBefore(js, first);
2.5. IE
2.5.1. GET caching in IE
2.5.1.1. Usage of hashes in links
2.5.1.2. set expire flag
2.5.2. Operation aborted
2.5.2.1. Change parent while it hasn't been constructed yet
2.5.3. Doesn't have capturing
2.5.4. Doesn't have w3c event registration mechanism (addEventListener)
3. Objects
3.1. Window
3.1.1. Methods
3.1.1.1. onload
3.1.1.2. onresize
3.1.1.3. onkeyup
3.1.1.4. onerror
3.1.2. Global scope (browser-based JS)
3.1.3. Implemented as JS object
3.1.4. Fields
3.1.4.1. parent
3.1.4.2. screen
3.1.4.3. window
3.1.4.3.1. current window
3.2. Document
3.2.1. Reference to HTML DOM els
3.2.2. Not JS
3.2.3. Fields
3.2.3.1. cookie
3.2.3.1.1. Usage: window.document.cookie
3.2.3.2. activeElement
3.2.3.2.1. focused element
3.2.3.3. anchors
3.2.3.4. body
3.2.3.5. defaultCharset
3.2.3.6. documentElement
3.2.3.6.1. link to itself
3.2.3.7. location
3.2.3.7.1. changing forces refresh
3.2.3.8. URL
3.2.3.8.1. read-only
3.2.3.9. parentWindow
3.2.3.10. referrer
3.2.3.11. scripts
3.2.3.12. width
3.2.4. One instance for web page
3.2.5. Methods
3.2.5.1. ready
3.2.5.1.1. DeferredBinding analog
3.3. Hierarchy
3.3.1. Navigator
3.3.1.1. MimeType
3.3.1.2. Window
3.3.1.2.1. Frame
3.3.1.2.2. History
3.3.1.2.3. Location
3.3.1.2.4. Document
3.3.1.3. Plugin
3.4. Functions
3.4.1. Function closure
3.4.1.1. Acts as anonymous class in java
4. Debug
4.1. Chrome should be started with debug option
5. Patterns
5.1. See JavaScript MVC
6. Language notes
6.1. No {} scope like in other langs
6.2. OOP
6.2.1. Instead of class/instance - Object
6.2.2. Instead of super: __proto__
6.3. Functions have an attribute called prototype
6.3.1. Immutable
6.4. All variables are function-local. Even in loops!
6.5. Also has gc
6.6. Functions are classes
7. SFDC Admin
7.1. SFDC Developer
8. Inside
8.1. Browser events
8.1.1. Types
8.1.1.1. DOM events
8.1.1.1.1. onclick
8.1.1.1.2. mouseover
8.1.1.2. Window events
8.1.1.2.1. resize
8.1.1.3. Other events
8.1.1.3.1. load(handler)
8.1.1.3.2. readystatechange
8.1.2. Working with
8.1.2.1. addEventListener
8.1.2.2. removeEventListener
8.1.2.3. detachEvent
8.1.2.4. Use event as a parameter in fuction
8.1.3. Event bubbling
8.1.3.1. Parents handle child events
8.1.3.2. Slows down gwt code and huge widget hierarchies
8.1.4. Methods
8.1.4.1. stopPropagation
8.1.4.1.1. to protect from handle bubbling
8.1.4.2. preventDefault
8.1.4.2.1. prevent default action handling (example: anchor click not redirects to URI)
8.1.5. DOM standart
8.1.5.1. First - capture event
8.1.5.2. Then - bubble
8.1.5.3. ! not all the browsers use this standart
8.1.6. Prevent unnecessary bubbling
8.1.6.1. if (event.target == this) {}
8.1.6.2. event.stopPropagation()
8.1.7. Removal
8.1.7.1. unbind('name')
8.1.7.1.1. Example: unbind('click')
8.1.8. Rebind
8.1.8.1. bind('name', handlerFunction)
8.1.9. Simulating user actions
8.1.9.1. trigger(eventName)
8.1.9.1.1. Example: trigger('click')
8.1.10. Hierarchy
8.1.10.1. 4 Model registration models
8.1.10.1.1. inline
8.1.10.1.2. traditional
8.1.10.1.3. w3c
8.1.10.1.4. Microsoft
8.1.10.2. Event access
8.1.10.2.1. function(event)
8.1.10.2.2. Cross-browser
8.1.10.3. 2 Event order models
8.1.10.3.1. Event capturing
8.1.10.3.2. Even bubbling
8.2. Execution context
8.2.1. call() and apply() methods
8.2.1.1. Example: someFunction().call(objectB)
8.2.1.1.1. 'this' will now link to objectB instance
8.3. Event loop
8.3.1. Thread by browser checking event states
8.3.2. Executed using event queue
9. Other notes
9.1. window.onload may be called when DOM hasn't been constructed
9.1.1. Use document.ready
9.2. To prevent from default event handling use return false;
9.2.1. Cases like a href="bla" and $(a).click(function() {bla2})
10. jQuery
11. JavaScriptMVC
11.1. MVC mechanism
11.1.1. jQueryMX
11.1.1.1. $.Model
11.1.1.1.1. encapsulates app model
11.1.1.2. $.View
11.1.1.3. $.Controller
11.2. Dependency management
11.2.1. StealJS
11.2.1.1. Loads several modules, prevents from reloading
11.2.1.2. Single load point
11.2.1.3. Usage
11.2.1.3.1. steal('widgets/tabs.js', './style.css', function(){ $('#tabs ).tabs(); });
11.3. Functional, unit testing
11.3.1. FuncUnit
11.3.1.1. Asserts
11.3.1.1.1. test("counter", function() { ok(Conctacts.first().name, "there is a name property"); equal(Contacts.counter(), 5, "there are 5 contacts"); });
11.3.1.2. Methods
11.3.1.2.1. setup
11.3.1.2.2. test
11.3.1.2.3. teardown
12. SFDC Admin
12.1. Google v8
12.1.1. Used in Chrome
12.2. Main features
12.2.1. Memory allocation
12.2.2. Compile
12.2.3. GC
13. AJAX
13.1. Pure implementation
13.1.1. XMLHttpRequest
13.1.1.1. Methods
13.1.1.1.1. abort()
13.1.1.1.2. getAllResponseHeaders()
13.1.1.1.3. getResponseHeader(headerName)
13.1.1.1.4. open(method, URL, async, userName, password)
13.1.1.1.5. send(content)
13.1.1.1.6. setRequestHeader(type, value)
13.1.1.2. Fields
13.1.1.2.1. readystate
13.1.1.2.2. responseText
13.1.1.2.3. responseXML
13.1.1.2.4. status
13.2. Frameworks
13.2.1. GWT
13.2.2. Dojo
13.2.3. jQuery
14. Trailhead Superbadges
14.1. Native
14.1.1. History object
14.1.1.1. Fields
14.1.1.1.1. current
14.1.1.1.2. next
14.1.1.1.3. prev
14.1.1.1.4. length
14.1.1.2. Methods
14.1.1.2.1. forward()
14.1.1.2.2. back()
14.1.1.2.3. go(link)
14.1.2. Managing
14.1.2.1. In jQuery its used using iframe and timert
15. DOM
15.1. See native support
16. Server side
16.1. Node.js
16.1.1. Socket.io library
16.1.2. Event-driven
16.1.3. Non-blocking
16.1.4. Being used
16.1.4.1. eBay
16.1.4.2. Microsoft
16.1.5. May be used
16.1.5.1. Creating web servers
16.1.5.1.1. HTTP servers are very easy
16.1.6. Execution
16.1.6.1. node program.js
16.1.7. Objects
16.1.7.1. global
16.1.7.1.1. process
16.1.7.1.2. console
16.1.8. STDIO
16.1.8.1. using console object
16.1.9. Other features
16.1.9.1. Buffers
16.1.9.2. DNS work
16.1.9.3. HTTP utils
16.1.9.4. FS
16.1.9.5. SSL
16.1.9.6. ...