-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Christopher Baker
committed
Feb 16, 2018
1 parent
f62c9cc
commit f2979c2
Showing
9 changed files
with
571 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/*can-vdom@4.0.0#can-vdom*/ | ||
define([ | ||
'require', | ||
'exports', | ||
'module', | ||
'can-assign', | ||
'./make-window/make-window', | ||
'can-globals/global' | ||
], function (require, exports, module) { | ||
(function (global, require, exports, module) { | ||
var assign = require('can-assign'); | ||
var makeWindow = require('./make-window/make-window'); | ||
var GLOBAL = require('can-globals/global'); | ||
var global = GLOBAL(); | ||
assign(global, makeWindow(global)); | ||
}(function () { | ||
return this; | ||
}(), require, exports, module)); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/*can-vdom@4.0.0#make-document/make-document*/ | ||
define([ | ||
'require', | ||
'exports', | ||
'module', | ||
'can-simple-dom', | ||
'../make-parser/make-parser' | ||
], function (require, exports, module) { | ||
var simpleDOM = require('can-simple-dom'); | ||
var makeParser = require('../make-parser/make-parser'); | ||
function CanSimpleDocument() { | ||
simpleDOM.Document.apply(this, arguments); | ||
var serializer = new simpleDOM.HTMLSerializer(simpleDOM.voidMap); | ||
var parser = makeParser(this); | ||
this.__addSerializerAndParser(serializer, parser); | ||
} | ||
CanSimpleDocument.prototype = new simpleDOM.Document(); | ||
CanSimpleDocument.prototype.constructor = CanSimpleDocument; | ||
module.exports = function () { | ||
return new CanSimpleDocument(); | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/*can-vdom@4.0.0#make-parser/make-parser*/ | ||
define([ | ||
'require', | ||
'exports', | ||
'module', | ||
'can-view-parser', | ||
'can-simple-dom' | ||
], function (require, exports, module) { | ||
var canParser = require('can-view-parser'); | ||
var simpleDOM = require('can-simple-dom'); | ||
module.exports = function (document) { | ||
return new simpleDOM.HTMLParser(function (string) { | ||
var tokens = []; | ||
var currentTag, currentAttr; | ||
canParser(string, { | ||
start: function (tagName, unary) { | ||
currentTag = { | ||
type: 'StartTag', | ||
attributes: [], | ||
tagName: tagName | ||
}; | ||
}, | ||
end: function (tagName, unary) { | ||
tokens.push(currentTag); | ||
currentTag = undefined; | ||
}, | ||
close: function (tagName) { | ||
tokens.push({ | ||
type: 'EndTag', | ||
tagName: tagName | ||
}); | ||
}, | ||
attrStart: function (attrName) { | ||
currentAttr = [ | ||
attrName, | ||
'' | ||
]; | ||
currentTag.attributes.push(currentAttr); | ||
}, | ||
attrEnd: function (attrName) { | ||
}, | ||
attrValue: function (value) { | ||
currentAttr[1] += value; | ||
}, | ||
chars: function (value) { | ||
tokens.push({ | ||
type: 'Chars', | ||
chars: value | ||
}); | ||
}, | ||
comment: function (value) { | ||
tokens.push({ | ||
type: 'Comment', | ||
chars: value | ||
}); | ||
}, | ||
special: function (value) { | ||
}, | ||
done: function () { | ||
} | ||
}); | ||
return tokens; | ||
}, document, simpleDOM.voidMap); | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/*can-vdom@4.0.0#make-window/make-window*/ | ||
define([ | ||
'require', | ||
'exports', | ||
'module', | ||
'../make-document/make-document', | ||
'can-simple-dom' | ||
], function (require, exports, module) { | ||
(function (global, require, exports, module) { | ||
var makeDocument = require('../make-document/make-document'); | ||
var simpleDOM = require('can-simple-dom'); | ||
var noop = function () { | ||
}; | ||
module.exports = function (global) { | ||
global = global || {}; | ||
global.document = makeDocument(); | ||
global.window = global.self = global; | ||
global.addEventListener = function () { | ||
}; | ||
global.removeEventListener = function () { | ||
}; | ||
global.Node = simpleDOM.Node; | ||
global.navigator = { | ||
userAgent: '', | ||
platform: '', | ||
language: '', | ||
languages: [], | ||
plugins: [], | ||
onLine: true | ||
}; | ||
global.location = { | ||
href: '', | ||
protocol: '', | ||
host: '', | ||
hostname: '', | ||
port: '', | ||
pathname: '', | ||
search: '', | ||
hash: '' | ||
}; | ||
global.history = { | ||
pushState: noop, | ||
replaceState: noop | ||
}; | ||
global.getComputedStyle = function (node) { | ||
return node.style; | ||
}; | ||
return global; | ||
}; | ||
}(function () { | ||
return this; | ||
}(), require, exports, module)); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/*can-vdom@4.0.0#can-vdom*/ | ||
var assign = require('can-assign'); | ||
var makeWindow = require('./make-window/make-window.js'); | ||
var GLOBAL = require('can-globals/global/global'); | ||
var global = GLOBAL(); | ||
assign(global, makeWindow(global)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/*can-vdom@4.0.0#make-document/make-document*/ | ||
var simpleDOM = require('can-simple-dom'); | ||
var makeParser = require('../make-parser/make-parser.js'); | ||
function CanSimpleDocument() { | ||
simpleDOM.Document.apply(this, arguments); | ||
var serializer = new simpleDOM.HTMLSerializer(simpleDOM.voidMap); | ||
var parser = makeParser(this); | ||
this.__addSerializerAndParser(serializer, parser); | ||
} | ||
CanSimpleDocument.prototype = new simpleDOM.Document(); | ||
CanSimpleDocument.prototype.constructor = CanSimpleDocument; | ||
module.exports = function () { | ||
return new CanSimpleDocument(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/*can-vdom@4.0.0#make-parser/make-parser*/ | ||
var canParser = require('can-view-parser'); | ||
var simpleDOM = require('can-simple-dom'); | ||
module.exports = function (document) { | ||
return new simpleDOM.HTMLParser(function (string) { | ||
var tokens = []; | ||
var currentTag, currentAttr; | ||
canParser(string, { | ||
start: function (tagName, unary) { | ||
currentTag = { | ||
type: 'StartTag', | ||
attributes: [], | ||
tagName: tagName | ||
}; | ||
}, | ||
end: function (tagName, unary) { | ||
tokens.push(currentTag); | ||
currentTag = undefined; | ||
}, | ||
close: function (tagName) { | ||
tokens.push({ | ||
type: 'EndTag', | ||
tagName: tagName | ||
}); | ||
}, | ||
attrStart: function (attrName) { | ||
currentAttr = [ | ||
attrName, | ||
'' | ||
]; | ||
currentTag.attributes.push(currentAttr); | ||
}, | ||
attrEnd: function (attrName) { | ||
}, | ||
attrValue: function (value) { | ||
currentAttr[1] += value; | ||
}, | ||
chars: function (value) { | ||
tokens.push({ | ||
type: 'Chars', | ||
chars: value | ||
}); | ||
}, | ||
comment: function (value) { | ||
tokens.push({ | ||
type: 'Comment', | ||
chars: value | ||
}); | ||
}, | ||
special: function (value) { | ||
}, | ||
done: function () { | ||
} | ||
}); | ||
return tokens; | ||
}, document, simpleDOM.voidMap); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/*can-vdom@4.0.0#make-window/make-window*/ | ||
var makeDocument = require('../make-document/make-document.js'); | ||
var simpleDOM = require('can-simple-dom'); | ||
var noop = function () { | ||
}; | ||
module.exports = function (global) { | ||
global = global || {}; | ||
global.document = makeDocument(); | ||
global.window = global.self = global; | ||
global.addEventListener = function () { | ||
}; | ||
global.removeEventListener = function () { | ||
}; | ||
global.Node = simpleDOM.Node; | ||
global.navigator = { | ||
userAgent: '', | ||
platform: '', | ||
language: '', | ||
languages: [], | ||
plugins: [], | ||
onLine: true | ||
}; | ||
global.location = { | ||
href: '', | ||
protocol: '', | ||
host: '', | ||
hostname: '', | ||
port: '', | ||
pathname: '', | ||
search: '', | ||
hash: '' | ||
}; | ||
global.history = { | ||
pushState: noop, | ||
replaceState: noop | ||
}; | ||
global.getComputedStyle = function (node) { | ||
return node.style; | ||
}; | ||
return global; | ||
}; |
Oops, something went wrong.