Merge pull request #729 from impinball/speed

Profile and optimize
This commit is contained in:
Leo Horie 2015-07-23 21:28:42 -04:00
commit b0c876f57b
7 changed files with 1178 additions and 1036 deletions

View file

@ -1,6 +1,5 @@
module.exports = function(grunt) {
_ = require('lodash');
var _ = require("lodash");
var version = "0.2.0";
var inputFolder = "./docs";
@ -8,7 +7,6 @@ module.exports = function(grunt) {
var archiveFolder = "./archive";
var outputFolder = "../mithril";
var guideLayout = "guide";
var guide = [
"auto-redrawing",
"benchmarks",
@ -25,7 +23,6 @@ module.exports = function(grunt) {
"tools",
"web-services"
];
var apiLayout = "api";
var api = [
"change-log",
"roadmap",
@ -47,8 +44,6 @@ module.exports = function(grunt) {
"mithril.xhr"
];
var md2htmlTasks = {};
var makeTasks = function(layout, pages) {
pages.map(function(name) {
@ -83,7 +78,7 @@ module.exports = function(grunt) {
url: ['https://saucelabs.com/rest/v1', user, 'jobs', result.job_id].join('/'),
auth: { user: user, pass: pass },
json: { passed: result.passed }
}, function (error, response, body) {
}, function (error, response) {
if (error) {
callback(error);
} else if (response.statusCode !== 200) {

File diff suppressed because it is too large Load diff

2
mithril.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
//saucelabs reporting; see https://github.com/axemclion/grunt-saucelabs#test-result-details-with-qunit
var log = []
var testName
QUnit.done(function (test_results) {
var tests = []
@ -85,7 +85,7 @@ test('array item removal', function() {
m('div', {}, '2')
])
var view2= m('div', {}, [
var view2 = m('div', {}, [
m('div', {}, '0')
])
@ -105,7 +105,7 @@ test('issue99 regression', function() {
m('div', {}, '2')
])
var view2= m('div', {}, [
var view2 = m('div', {}, [
m('span', {}, '0')
])
@ -124,7 +124,7 @@ test('config handler context', function() {
}})
m.render(dummyEl, view)
var view = m('div', {config: function(evt, isInitialized, context) {
view = m('div', {config: function(evt, isInitialized, context) {
equal(context instanceof Object, true)
equal(context.data, 1)
}})

File diff suppressed because it is too large Load diff

View file

@ -55,11 +55,11 @@ mock.window = (function() {
else this.childNodes.splice(referenceIndex, 0, node)
},
insertAdjacentHTML: function(position, html) {
//todo: accept markup
if (position == "beforebegin") {
// todo: accept markup
if (position === "beforebegin") {
this.parentNode.insertBefore(window.document.createTextNode(html), this)
}
else if (position == "beforeend") {
else if (position === "beforeend") {
this.appendChild(window.document.createTextNode(html))
}
},
@ -104,7 +104,8 @@ mock.window = (function() {
this.childNodes.splice(index, 1)
child.parentNode = null
}
//getElementsByTagName is only used by JSONP tests, it's not required by Mithril
// getElementsByTagName is only used by JSONP tests, it's not required by
// Mithril
window.document.getElementsByTagName = function(name){
name = name.toLowerCase();
var out = [];
@ -112,12 +113,13 @@ mock.window = (function() {
var traverse = function(node){
if(node.childNodes && node.childNodes.length > 0){
node.childNodes.map(function(curr){
if(curr.nodeName.toLowerCase() === name)
if (curr.nodeName.toLowerCase() === name) {
out.push(curr);
}
traverse(curr);
});
}
};
}
traverse(window.document);
return out;
@ -156,15 +158,15 @@ mock.window = (function() {
request.$instances = []
return request
}())
window.location = {search: "", pathname: "", hash: ""},
window.location = {search: "", pathname: "", hash: ""}
window.history = {}
window.history.$$length = 0
window.history.pushState = function(data, title, url) {
window.history.$$length++
window.location.pathname = window.location.search = window.location.hash = url
},
}
window.history.replaceState = function(data, title, url) {
window.location.pathname = window.location.search = window.location.hash = url
}
return window
}())
}())