Permalink
Browse files

implemented minimal event

  • Loading branch information...
1 parent 41c3f4a commit fba65ffffd08af8f4fbc0d3c8bc69d863a31c4a7 @Raynos committed Mar 26, 2014
Showing with 47 additions and 1 deletion.
  1. +30 −0 .jshintrc
  2. +9 −0 event.js
  3. +8 −1 index.js
View
@@ -0,0 +1,30 @@
+{
+ "maxdepth": 4,
+ "maxstatements": 200,
+ "maxcomplexity": 12,
+ "maxlen": 80,
+ "maxparams": 5,
+
+ "curly": true,
+ "eqeqeq": true,
+ "immed": true,
+ "latedef": false,
+ "noarg": true,
+ "noempty": true,
+ "nonew": true,
+ "undef": true,
+ "unused": "vars",
+ "trailing": true,
+
+ "quotmark": true,
+ "expr": true,
+ "asi": true,
+
+ "browser": false,
+ "esnext": true,
+ "devel": false,
+ "node": false,
+ "nonstandard": false,
+
+ "predef": ["require", "module", "__dirname", "__filename"]
+}
View
@@ -0,0 +1,9 @@
+module.exports = Event
+
+function Event(family) {}
+
+Event.prototype.initEvent = function _Event_initEvent(type, bubbles, cancelable) {
+ this.type = type
+ this.bubbles = bubbles
+ this.cancelable = cancelable
+}
View
@@ -1,17 +1,21 @@
var DOMText = require("./dom-text.js")
var DOMElement = require("./dom-element.js")
var DocumentFragment = require("./dom-fragment.js")
+var Event = require("./event.js")
var body = createElement("body")
+var rootElement = createElement("html")
module.exports = Document()
function Document() {
return {
body: body,
+ rootElement: rootElement,
createTextNode: createTextNode,
createElement: createElement,
createDocumentFragment: createDocumentFragment,
+ createEvent: createEvent,
getElementById: getElementById,
Document: Document,
Text: DOMText,
@@ -32,6 +36,10 @@ function createDocumentFragment() {
return new DocumentFragment()
}
+function createEvent(family) {
+ return new Event(family)
+}
+
/*
* getElementById returns the Element whose ID is given by elementId.
* If no such element exists, returns null.
@@ -59,4 +67,3 @@ function getElementById(id, parent) {
return result
}
-

0 comments on commit fba65ff

Please sign in to comment.