Get Started. It's Free
or sign up with your email address
Rocket clouds
JavaScript by Mind Map: JavaScript

1. AJAX

1.1. Pure implementation

1.1.1. XMLHttpRequest

1.1.1.1. Methods

1.1.1.1.1. abort()

1.1.1.1.2. getAllResponseHeaders()

1.1.1.1.3. getResponseHeader(headerName)

1.1.1.1.4. open(method, URL, async, userName, password)

1.1.1.1.5. send(content)

1.1.1.1.6. setRequestHeader(type, value)

1.1.1.2. Fields

1.1.1.2.1. readystate

1.1.1.2.2. responseText

1.1.1.2.3. responseXML

1.1.1.2.4. status

1.2. Frameworks

1.2.1. GWT

1.2.2. Dojo

1.2.3. jQuery

2. History handling

2.1. Native

2.1.1. History object

2.1.1.1. Fields

2.1.1.1.1. current

2.1.1.1.2. next

2.1.1.1.3. prev

2.1.1.1.4. length

2.1.1.2. Methods

2.1.1.2.1. forward()

2.1.1.2.2. back()

2.1.1.2.3. go(link)

2.1.2. Managing

2.1.2.1. In jQuery its used using iframe and timert

3. DOM

3.1. See native support

4. Inside

4.1. Browser events

4.1.1. Types

4.1.1.1. DOM events

4.1.1.1.1. onclick

4.1.1.1.2. mouseover

4.1.1.2. Window events

4.1.1.2.1. resize

4.1.1.3. Other events

4.1.1.3.1. load(handler)

4.1.1.3.2. readystatechange

4.1.2. Working with

4.1.2.1. addEventListener

4.1.2.2. removeEventListener

4.1.2.3. detachEvent

4.1.2.4. Use event as a parameter in fuction

4.1.3. Event bubbling

4.1.3.1. Parents handle child events

4.1.3.2. Slows down gwt code and huge widget hierarchies

4.1.4. Methods

4.1.4.1. stopPropagation

4.1.4.1.1. to protect from handle bubbling

4.1.4.2. preventDefault

4.1.4.2.1. prevent default action handling (example: anchor click not redirects to URI)

4.1.5. DOM standart

4.1.5.1. First - capture event

4.1.5.2. Then - bubble

4.1.5.3. ! not all the browsers use this standart

4.1.6. Prevent unnecessary bubbling

4.1.6.1. if (event.target == this) {}

4.1.6.2. event.stopPropagation()

4.1.7. Removal

4.1.7.1. unbind('name')

4.1.7.1.1. Example: unbind('click')

4.1.8. Rebind

4.1.8.1. bind('name', handlerFunction)

4.1.9. Simulating user actions

4.1.9.1. trigger(eventName)

4.1.9.1.1. Example: trigger('click')

4.1.10. Hierarchy

4.1.10.1. 4 Model registration models

4.1.10.1.1. inline

4.1.10.1.2. traditional

4.1.10.1.3. w3c

4.1.10.1.4. Microsoft

4.1.10.2. Event access

4.1.10.2.1. function(event)

4.1.10.2.2. Cross-browser

4.1.10.3. 2 Event order models

4.1.10.3.1. Event capturing

4.1.10.3.2. Even bubbling

4.2. Execution context

4.2.1. call() and apply() methods

4.2.1.1. Example: someFunction().call(objectB)

4.2.1.1.1. 'this' will now link to objectB instance

4.3. Event loop

4.3.1. Thread by browser checking event states

4.3.2. Executed using event queue

5. Objects

5.1. Window

5.1.1. Methods

5.1.1.1. onload

5.1.1.2. onresize

5.1.1.3. onkeyup

5.1.1.4. onerror

5.1.2. Global scope (browser-based JS)

5.1.3. Implemented as JS object

5.1.4. Fields

5.1.4.1. parent

5.1.4.2. screen

5.1.4.3. window

5.1.4.3.1. current window

5.2. Document

5.2.1. Reference to HTML DOM els

5.2.2. Not JS

5.2.3. Fields

5.2.3.1. cookie

5.2.3.1.1. Usage: window.document.cookie

5.2.3.2. activeElement

5.2.3.2.1. focused element

5.2.3.3. anchors

5.2.3.4. body

5.2.3.5. defaultCharset

5.2.3.6. documentElement

5.2.3.6.1. link to itself

5.2.3.7. location

5.2.3.7.1. changing forces refresh

5.2.3.8. URL

5.2.3.8.1. read-only

5.2.3.9. parentWindow

5.2.3.10. referrer

5.2.3.11. scripts

5.2.3.12. width

5.2.4. One instance for web page

5.2.5. Methods

5.2.5.1. ready

5.2.5.1.1. DeferredBinding analog

5.3. Hierarchy

5.3.1. Navigator

5.3.1.1. MimeType

5.3.1.2. Window

5.3.1.2.1. Frame

5.3.1.2.2. History

5.3.1.2.3. Location

5.3.1.2.4. Document

5.3.1.3. Plugin

5.4. Functions

5.4.1. Function closure

5.4.1.1. Acts as anonymous class in java

6. Server side

6.1. Node.js

6.1.1. Socket.io library

6.1.2. Event-driven

6.1.3. Non-blocking

6.1.4. Being used

6.1.4.1. eBay

6.1.4.2. Microsoft

6.1.5. May be used

6.1.5.1. Creating web servers

6.1.5.1.1. HTTP servers are very easy

6.1.6. Execution

6.1.6.1. node program.js

6.1.7. Objects

6.1.7.1. global

6.1.7.1.1. process

6.1.7.1.2. console

6.1.8. STDIO

6.1.8.1. using console object

6.1.9. Other features

6.1.9.1. Buffers

6.1.9.2. DNS work

6.1.9.3. HTTP utils

6.1.9.4. FS

6.1.9.5. SSL

6.1.9.6. ...

7. Language notes

7.1. No {} scope like in other langs

7.2. OOP

7.2.1. Instead of class/instance - Object

7.2.2. Instead of super: __proto__

7.3. Functions have an attribute called prototype

7.3.1. Immutable

7.4. All variables are function-local. Even in loops!

7.5. Also has gc

7.6. Functions are classes

8. Browser compatibility

8.1. Events

8.1.1. http://www.quirksmode.org/dom/events/index.html

8.2. Autohead

8.2.1. Automatical creating 'head' element even if it doesn't exist

8.2.2. Disabled in android, iPhome, Opera 8

8.2.2.1. That's why adding script to head from code may fail here

8.3. When you modify body from script which isn't a part of it - you get 'Operation aborted' in IE

8.4. Correct insertion of script

8.4.1. var first = document.getElementsByTagName('script')[0]; first.parentNode.insertBefore(js, first);

8.5. IE

8.5.1. GET caching in IE

8.5.1.1. Usage of hashes in links

8.5.1.2. set expire flag

8.5.2. Operation aborted

8.5.2.1. Change parent while it hasn't been constructed yet

8.5.3. Doesn't have capturing

8.5.4. Doesn't have w3c event registration mechanism (addEventListener)

9. Debug

9.1. Chrome should be started with debug option

10. Patterns

10.1. See JavaScript MVC

11. Other notes

11.1. window.onload may be called when DOM hasn't been constructed

11.1.1. Use document.ready

11.2. To prevent from default event handling use return false;

11.2.1. Cases like a href="bla" and $(a).click(function() {bla2})

12. jQuery

13. JavaScriptMVC

13.1. MVC mechanism

13.1.1. jQueryMX

13.1.1.1. $.Model

13.1.1.1.1. encapsulates app model

13.1.1.2. $.View

13.1.1.3. $.Controller

13.2. Dependency management

13.2.1. StealJS

13.2.1.1. Loads several modules, prevents from reloading

13.2.1.2. Single load point

13.2.1.3. Usage

13.2.1.3.1. steal('widgets/tabs.js', './style.css', function(){ $('#tabs ).tabs(); });

13.3. Functional, unit testing

13.3.1. FuncUnit

13.3.1.1. Asserts

13.3.1.1.1. test("counter", function() { ok(Conctacts.first().name, "there is a name property"); equal(Contacts.counter(), 5, "there are 5 contacts"); });

13.3.1.2. Methods

13.3.1.2.1. setup

13.3.1.2.2. test

13.3.1.2.3. teardown

14. Engines

14.1. Google v8

14.1.1. Used in Chrome

14.2. Main features

14.2.1. Memory allocation

14.2.2. Compile

14.2.3. GC

15. Tools

15.1. yui compressor

15.1.1. Obfuscates and compressed

15.1.1.1. short names

15.1.1.2. css compression