/docs/MyDocs

To get this branch, use:
bzr branch http://darksoft.org/webbzr/docs/MyDocs

« back to all changes in this revision

Viewing changes to Web/html/dom.txt

  • Committer: Suren A. Chilingaryan
  • Date: 2009-04-09 03:21:08 UTC
  • Revision ID: csa@dside.dyndns.org-20090409032108-w4edamdh4adrgdu3
import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Applicable
 
2
----------
 
3
 Internet Explorer      - OK
 
4
 Mozilla                - OK
 
5
 Opera                  - Nope
 
6
 Netscape4              - Nope
 
7
 
 
8
***********
 
9
* classes *
 
10
***********
 
11
 window
 
12
 ------ 
 
13
  closed        - indicates closed window or not
 
14
  document      - document object, window contains
 
15
  length        - number of subframes
 
16
  frames        - array of subframes
 
17
  history       - reference to history object
 
18
  location      - current location URL
 
19
  name          - name of the window
 
20
  _content      - reference to the content element in the current window.
 
21
  status        - status message
 
22
  title         - title of window
 
23
  navigator     - reference on navigator object
 
24
  screen        - reference on screen object
 
25
 
 
26
  innerHeight   - window height
 
27
  innerWidth    - window width
 
28
  outerHeight   - Height of the outside of the browser window (scrolling)
 
29
  outerWidth    - Width
 
30
  pageXOffset   - pixels that has been hidden by scrolling to the right
 
31
  pageYOffset   - to the down
 
32
  scrollbars    - reference to scrollbars object
 
33
  scrollX       - number of pixels document has been scrolled horizontaly
 
34
  scrollY       - verticaly
 
35
  screenX       - x mouse
 
36
  screenY       - y mouse
 
37
 
 
38
  parent        - reference to the parent window
 
39
  opener        - reference to window which opened this
 
40
  top           - reference to topmost window
 
41
  window        - window
 
42
  self          - this
 
43
 
 
44
  Components    - array of the components installed in the browser
 
45
  menubar,personalbar,statusbar - references on corespondent objects
 
46
  controllers   - XUL controller objects for the current chrome window (???)
 
47
  crypto        - crypto object (???)
 
48
  defaultStatus - default status message (???)
 
49
  directories   - Reference to directories toolbar in the current chrome (???)
 
50
  pkcs11        - (???)
 
51
 
 
52
  navigator
 
53
  ---------     
 
54
   appCodeName  - codename of the current browser (Mozilla,Mozilla)
 
55
   appName      - official name of browser (Microsoft Internet Explorer,Netscape)
 
56
   appVersion   - browser version (4.0 (compatible; MSIE 6.0; Windows NT 4.0),
 
57
                5.0 (X11; en-US))
 
58
   cookieEnabled- 1/0
 
59
   mimeTypes    - reference on object containin list of mime types supported
 
60
   oscpu        - (-,Linux i586)
 
61
   platform     - platform description (Win32, Linux i586)
 
62
   product      - product name (-,Gecko)
 
63
   productSub   - product version number (-,5.0)
 
64
   userAgent    - user agent (Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 4.0),
 
65
                Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.8) Gecko/20020204)
 
66
   vendor       - vendor name (-,"",Netscape6)
 
67
   vendorSub    - vendor version (-,"",6.1)
 
68
   language     - locale (-,en-US)
 
69
 
 
70
  screen
 
71
  ------
 
72
   height,width         - screen width & height
 
73
   pixelDepth           - color depth
 
74
   availHeight,availWidth- amount of vert./horiz. space available for window
 
75
   availLeft,availTop   - first available pixel available from the left/top
 
76
                        side of the Screen
 
77
   top,left             - Y/X coordinate of window
 
78
 
 
79
  bars(Location, Menu, ...)
 
80
  ----          
 
81
   visible      - visible or not
 
82
                        
 
83
 
 
84
 documet (element successor)
 
85
 -------
 
86
  anchors, applets, embeds, forms, links, images
 
87
  URL, location, lastModified, characterSet
 
88
  fgColor, bgColor, linkColor, alinkColor,vlinkColor
 
89
  body          - body node
 
90
  documentElement- returns element that is a direct child of document, which in
 
91
                most cases is the HTML element
 
92
  contentWindow - window containing this document
 
93
  doctype       - DTD of the current document
 
94
  referer       - URI of the page that linked to this one
 
95
  cookie        - colon separated list of cookies
 
96
  height,width  - height/width of current document
 
97
  implementation- DOM implementation associated with the current document
 
98
 
 
99
 element
 
100
 -------
 
101
  ownerDocument - document which ownes current element
 
102
  attributes    - array of all attributes
 
103
  childNodes    - array of all child nodes
 
104
  length                - number of child nodes
 
105
  firstChild    - First child of element
 
106
  lastChild     - Last child of element
 
107
  nextSibling   - Returns next sibling in parents child list
 
108
  prevSibling   - Returns previous sibling in parents child list
 
109
  offsetParent  - reference to parent element
 
110
  nodeName      - returns name of the node
 
111
  nodeType      - returns type of the node
 
112
  nodeValue     - returns value of current node 
 
113
  innerHTML     - all markup inside element
 
114
  tagName       - returns name of the element (???)
 
115
  dir           - directionality of element
 
116
  lang          - language of attribute values & text
 
117
  className     - class of element (???)
 
118
  id            - id of element
 
119
  namespaceURI  - Namespace of node, NULL - unspecified
 
120
  prefix        - returns namespace prefix or NULL (???)
 
121
  localName     - local part of qualified name of node (???)
 
122
  title         - title of the document
 
123
  style         - block of style rules
 
124
  tabIndex      - position of element in tabbig order
 
125
                        
 
126
  offsetHeight, offsetWidth     - Height/Width of element
 
127
  offsetLeft, offsetTop         - Number of pixels element offsets {to the left/
 
128
                                from the top} within parent element
 
129
 
 
130
 nodelist       - array of elements (access name[i] or name.item(i))
 
131
 attribute      - attribute node
 
132
 NamedNodeMap   - associative array of elements or attributes
 
133
 
 
134
 event
 
135
 -----
 
136
  currentTarget - Reference to the currently registered target for the event
 
137
  relatedTarget - Secondary target for event
 
138
  target        - Reference to target to which event was originaly dispatched
 
139
  view          - Indentifies the "AbstractView" (???) from which event was 
 
140
                generated. (In example 'window' specified(without qoutes))
 
141
  type          - Event type
 
142
  detail        - returns detail about event, depend on type of event
 
143
  eventPhase    - indicate which phase of the event flow is currently being 
 
144
                evaluated (0-CAPTURING_PHASE, 1-AT_TARGET, 2-BUBBLING_PHASE)
 
145
  timeStamp     Time that the event was created
 
146
  altKey,ctrlKey,metaKey,shiftKey       - if alt,ctrl,meta,shift key pressed
 
147
  isChar,charCode,keyCode               - if keypress event / ASCII / SCAN
 
148
  clientY, clientX                      - position of Event
 
149
  layerY, layerX                        - (???)
 
150
  pageY, pageX                          - (???)
 
151
  screenY, screenX                      - position of Event on the screen
 
152
  bubles        - Event bubbles up through DOM or not
 
153
  cancelBuble   - Bubbling is canceled or not
 
154
  cancelable    - Cancelable
 
155
        
 
156
 
 
157
 Style
 
158
 -----
 
159
  type          - Specifies style mime ("text/css")
 
160
  disabled      - Indicates current style-sheet was applied or not
 
161
  href          - location of style-sheet
 
162
  media         - Intended destination medium for ss information
 
163
  ownerNode     - node associated with ss
 
164
  ownerRule     - if comes from @import rules, will contain CSSImportRule
 
165
  parentStyleSheet - Returns ss that is including this one, if any
 
166
  title         - Advisory title ss
 
167
 
 
168
 cssRule
 
169
 -------
 
170
  cssText       - actual text of the style rule
 
171
  parentStyleSheet - returns the ss object in which current rule defined
 
172
  selectorText  - textual representation of the selector for the rule set
 
173
  style         - declaration block for the current style
 
174
 
 
175
 HTMLFormElement
 
176
 ---------------
 
177
  elements      - array of all the form elements
 
178
  length        - number of controls in form 
 
179
  acceptCharset - list of supported charsets
 
180
  enctype       - content type of FORM element (???)
 
181
  encoding      - content type of FORM element (???)
 
182
  method        - method to submit form (GET/POST)
 
183
  action        - action of the FORM element (i.e. URL)
 
184
  target        - target of the action (i.e. frame to render its output in)  
 
185
 
 
186
Notes
 
187
-----
 
188
 text node      - node wich haven't nor subnodes nor attributes
 
189
 element        - non text node
 
190
 
 
191
 window, document               - Global variables
 
192
 
 
193
*************
 
194
* Functions *
 
195
*************
 
196
 
 
197
Selecting nodes
 
198
---------------
 
199
 document.getElementById(id)
 
200
 document.getElementByName(name)        - Returns nodeList
 
201
 documnet.getElementsByTagName(name)    - Returns nodeList
 
202
 
 
203
Manipulating nodes & attributes
 
204
-------------------------------
 
205
 document.createElement(node_name)      - node_name can be for example: TD
 
206
 document.createTextNode("text")        - create text node
 
207
 parent_node.appendChild(child_node)    - adds new subnode to node childre list
 
208
 element.insertBefore(node_name)
 
209
 
 
210
 element.cloneNode([deep])      - Cloning a node, copies all of its attributes 
 
211
                but does not copy any of the text that the node contains, since
 
212
                that text is contained in a child Text node.
 
213
                deep    - if true copy all subtree
 
214
 element.removeChild(child)
 
215
 element.replaceChild(new,old)
 
216
 element.hasChildNodes()
 
217
 element.item(i)                Returns child node by index in child list
 
218
 
 
219
 element.createAttribute(name)
 
220
 element.setAttribute(name,value)
 
221
 element.setAttributeNS(ns,name,value)
 
222
 element.setAttributeNode(attr,value)
 
223
 element.setAttributeNodeNS(ns,attr,value)
 
224
 element.getAttribute(name)
 
225
 element.getAttributeNS(namespace,name)
 
226
 element.getAttributeNode(arrt)         Returns attribute as separate node
 
227
 element.getAttirbuteNodeNS(ns,attr)
 
228
 element.hasAttribute(name)
 
229
 element.hasAttributeNS(ns,name)
 
230
 element.hasAttributes()
 
231
 element.removeAttribute(name)
 
232
 element.removeAttributeNS(ns,name)
 
233
 element.removeAttributeNode(attr)
 
234
 
 
235
 
 
236
Event Handling
 
237
--------------
 
238
 element.addEventListener(type,listener,useCapture)
 
239
        type    - Event type: oblur(removing keyboard focus), onclik, ondblclick, 
 
240
                onfocus, onkeydown, onkeypress, onkeyup, onmousedown, onmouseup, 
 
241
                onmousemove, onmouseout, onmouseover, onresize
 
242
        listener        - Function to be called
 
243
        useCapture      - If true all events of this type at first will be dispatched by
 
244
                this handler, befor being dispatched to any EventTargets 
 
245
                beneath them in the tree.
 
246
 element.removeEventListener(type,listener,useCapture)
 
247
 element.onclick=function;              Also sets event handler...
 
248
 element.dispatchEvent(event)           event - event object
 
249
 window.captureEvents(Event.EventType)  Capture all events of specified type
 
250
        Event type: Abort, Load, Blur, MouseDown, MouseUp, MouseMove, MouseOut
 
251
        MouseOver, Click, Change, DblClick, DragDrop, Error, Focus, KeyDown,
 
252
        KeyUp, KeyPress, Move, Reset, Resize, Select, Submit, Unload
 
253
        Example:        window.captureEvents(Event.CLICK); 
 
254
                        window.onclik = <function name>
 
255
 window.releaseEvents(Event.eventType)
 
256
 
 
257
 event.createEvent(???)                 Creates event
 
258
 event.initEvent(type,bubbles,cancelable) Must be created first 
 
259
        bubles  - boolean indicating whether the event should buble up through 
 
260
                the event chain or not.
 
261
 event.initMouseEvent(String typeArg,boolean canBubbleArg,boolean cancelableArg,
 
262
        AbstractView viewArg,int detailArg,int screenXArg,int screenYArg,
 
263
        int clientXArg,int clientYArg,boolean ctrlKeyArg,boolean altKeyArg,
 
264
        boolean shiftKeyArg,boolean metaKeyArg,short buttonArg,
 
265
        EventTarget relatedTargetArg)
 
266
 event.initUIEvent(type,canBuble,view,detail)
 
267
 event.preventDefault()                 Cancels event
 
268
 event.stopPropagation()                Stop propagation of the event
 
269
 EventHandlers:                 function ehandler(e) { ... }, e - Event Object
 
270
 
 
271
History
 
272
-------
 
273
 window.forward()                       History
 
274
 window.back()                          History
 
275
 window.home()
 
276
 
 
277
Messages
 
278
--------
 
279
 window.confirm(text)                   Yes/No dialog
 
280
 window.prompt(text)                    Prompts for a value
 
281
 window.dump(text)                      Dumps text to console
 
282
 window.escape(str)                     Escape string
 
283
 window.GetAttention()                  Flashes application icon to get
 
284
                                        users attention
 
285
 
 
286
Window
 
287
------ 
 
288
 window.open(URL, name, features)       features - comma separated list of 
 
289
        items to opened as well: toolbar, location, directories, status,
 
290
        menubar, scrollbars, resizable, copyhistory, width, height.
 
291
 window.close()                 Close window
 
292
 window.stop()                  Stop window loading
 
293
 window.getSelection()          returns selection object (can be automaticaly 
 
294
                                converted to string)
 
295
 window.sizeToContent()         sizes window according to its contetnt
 
296
 window.moveBy(deltax,deltay)   moves window
 
297
 window.moveTo(x,y)             moves window 
 
298
 window.resizeBy(width,height)  resizes window
 
299
 window.scrollBy(deltax,deltay) scroll window 
 
300
 window.scroll(x,y)             scroll window to specified position
 
301
 window.scrollTo(x,y)           scroll window to specified position
 
302
 window.scrollByLines(lines)    scroll window by specified number of lines
 
303
 window.scrollByPages(pages)    pages
 
304
 window.print()                 print current window context
 
305
 
 
306
Document
 
307
--------
 
308
 document.clear()                       Clears document
 
309
 document.close()                       Close document on writing
 
310
 document.write()                       Open document for writing
 
311
 document.write("text")                 Write something to document
 
312
 document.writeln("text")               write + \n
 
313
 
 
314
CSS
 
315
---
 
316
1. ss = document.styleSheets[i]
 
317
   ss.cssRules[0].style.<name>=<value>
 
318
                                        CSS classess specified in the begining
 
319
2. element.style.name                   Returns only rules specified directly
 
320
                                        (i.e. <td style="name=value">
 
321
3. element.setAttribute(style,"name=value") also only specified directly
 
322
4. element.getComputedStyle(???)        Final element style
 
323
 
 
324
 style.deleteRule(index)
 
325
 style.insertRule(rule,index)
 
326
 
 
327
Misc
 
328
----
 
329
 element.normalise()                    Puts all subtree in "normalized" form
 
330
 document.supports(feature[,version])   Tests if this DOM implementation
 
331
                                        supports a particular feature
 
332
 window.navigator.javaEnabled()         If Java enabled - true
 
333
 
 
334
 window.setCursor(type)                 Changes cursor, type is: wait, auto,
 
335
 id=window.setInterval("func_name",delay) Will execute function after specified
 
336
                                        delay (in ms).
 
337
 window.clearInterval(intervalID)
 
338
 id=window.setInterval("action",delay)  Specifies timeout for some actions
 
339
 window.clearTimeout(timeoutID)
 
340
 
 
341
 window.updateCommands(???)             ???
 
342
 
 
343
Forms
 
344
-----
 
345
 submit()                               Submits form
 
346
 reset()                                Resets form
 
347
 
 
 
b'\\ No newline at end of file'