summary refs log tree commit diff stats
path: root/lib/js/dom.nim
diff options
context:
space:
mode:
authorKonstantin Molchanov <moigagoo@live.com>2017-03-29 16:54:36 +0400
committerGitHub <noreply@github.com>2017-03-29 16:54:36 +0400
commit04646052aba3e52d962eb20388588ff6be92bda8 (patch)
treef9d3387bb2d5f9b9dcc0de33527c1f69b9e4527e /lib/js/dom.nim
parent0c121b38eccde230255d706131c46434e29018e1 (diff)
parent875e344be0f0202885f0d5ed7f10188835a171d0 (diff)
downloadNim-04646052aba3e52d962eb20388588ff6be92bda8.tar.gz
Merge branch 'devel' into fix_time_offset_in_times_js
Diffstat (limited to 'lib/js/dom.nim')
-rw-r--r--lib/js/dom.nim30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/js/dom.nim b/lib/js/dom.nim
index 5a33dfa9f..a879ddb61 100644
--- a/lib/js/dom.nim
+++ b/lib/js/dom.nim
@@ -130,6 +130,16 @@ type
     readOnly*: bool
     options*: seq[OptionElement]
 
+  # https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
+  HtmlElement* = ref object of Element
+    contentEditable*: string
+    isContentEditable*: bool
+    dir*: string
+    offsetHeight*: int
+    offsetWidth*: int
+    offsetLeft*: int
+    offsetTop*: int
+
   LinkElement* = ref LinkObj
   LinkObj {.importc.} = object of ElementObj
     target*: cstring
@@ -270,6 +280,8 @@ type
     wordSpacing*: cstring
     zIndex*: int
 
+  # TODO: A lot of the fields in Event belong to a more specific type of event.
+  # TODO: Should we clean this up?
   Event* = ref EventObj
   EventObj {.importc.} = object of RootObj
     target*: Node
@@ -310,6 +322,20 @@ type
     SUBMIT*: int
     UNLOAD*: int
 
+  TouchList* {.importc.} = ref object of RootObj
+    length*: int
+
+  TouchEvent* {.importc.} = ref object of Event
+    changedTouches*, targetTouches*, touches*: TouchList
+
+  Touch* {.importc.} = ref object of RootObj
+    identifier*: int
+    screenX*, screenY*, clientX*, clientY*, pageX*, pageY*: int
+    target*: Element
+    radiusX*, radiusY*: int
+    rotationAngle*: int
+    force*: float
+
   Location* = ref LocationObj
   LocationObj {.importc.} = object of RootObj
     hash*: cstring
@@ -488,6 +514,10 @@ proc setAttribute*(s: Style, attr, value: cstring, caseSensitive=false)
 # Event "methods"
 proc preventDefault*(ev: Event)
 
+# TouchEvent "methods"
+proc identifiedTouch*(list: TouchList): Touch
+proc item*(list: TouchList, i: int): Touch
+
 {.pop.}
 
 var