Merge pull request #893 from isiahmeadows/speed
More performance improvements + etc. (fix mistakes in #887)
This commit is contained in:
commit
784f0f4f28
3 changed files with 11 additions and 10 deletions
17
mithril.js
17
mithril.js
|
|
@ -602,6 +602,7 @@
|
||||||
|
|
||||||
case MOVE:
|
case MOVE:
|
||||||
var changeElement = change.element
|
var changeElement = change.element
|
||||||
|
// changeElement is never null
|
||||||
if (inst.parent.childNodes[index] !== changeElement) {
|
if (inst.parent.childNodes[index] !== changeElement) {
|
||||||
inst.parent.insertBefore(
|
inst.parent.insertBefore(
|
||||||
changeElement,
|
changeElement,
|
||||||
|
|
@ -790,7 +791,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shallow array compare, assumes strings
|
// shallow array compare, assumes strings
|
||||||
function arraySortCompare(a, b) {
|
function arraySortCompare(a, b) {
|
||||||
var len = a.length
|
var len = a.length
|
||||||
if (len !== b.length) return false
|
if (len !== b.length) return false
|
||||||
|
|
@ -1043,9 +1044,10 @@
|
||||||
inst.editable.innerHTML = inst.data
|
inst.editable.innerHTML = inst.data
|
||||||
} else {
|
} else {
|
||||||
// was a trusted string
|
// was a trusted string
|
||||||
if (nodes[0].nodeType === 1 || nodes.length > 1 ||
|
if (nodes[0].nodeType === 1 ||
|
||||||
isString(nodes[0].nodeValue) &&
|
nodes.length > 1 ||
|
||||||
/\s*/.test(nodes[0].nodeValue)) {
|
(nodes[0].nodeValue.trim && !nodes[0].nodeValue.trim())
|
||||||
|
) {
|
||||||
clear(inst.cached.nodes, inst.cached)
|
clear(inst.cached.nodes, inst.cached)
|
||||||
nodes = [$document.createTextNode(inst.data)]
|
nodes = [$document.createTextNode(inst.data)]
|
||||||
}
|
}
|
||||||
|
|
@ -1159,7 +1161,7 @@
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// swallow IE's invalid argument errors to mimic HTML's
|
// swallow IE's invalid argument errors to mimic HTML's
|
||||||
// fallback-to-doing-nothing-on-invalid-attributes behavior
|
// fallback-to-doing-nothing-on-invalid-attributes behavior
|
||||||
if (!/\bInvalid argument\b/.test(e.message)) throw e
|
if (/\bInvalid argument\b/.test(e.message)) throw e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1346,7 +1348,7 @@
|
||||||
|
|
||||||
function getCellCacheKey(element) {
|
function getCellCacheKey(element) {
|
||||||
var index = nodeCache.indexOf(element)
|
var index = nodeCache.indexOf(element)
|
||||||
return index >= 0 ? index : nodeCache.push(element) - 1
|
return index < 0 ? nodeCache.push(element) - 1 : index
|
||||||
}
|
}
|
||||||
|
|
||||||
m.trust = function (value) {
|
m.trust = function (value) {
|
||||||
|
|
@ -2177,7 +2179,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function ajax(options) {
|
function ajax(options) {
|
||||||
if (options.dataType === "JSONP") {
|
if (options.dataType && options.dataType.toUpperCase() === "JSONP") {
|
||||||
return getJsonp(options)
|
return getJsonp(options)
|
||||||
} else {
|
} else {
|
||||||
return runXhr(options)
|
return runXhr(options)
|
||||||
|
|
@ -2220,7 +2222,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!options.dataType || options.dataType.toUpperCase() !== "JSONP") {
|
if (!options.dataType || options.dataType.toUpperCase() !== "JSONP") {
|
||||||
options.dataType = "JSONP"
|
|
||||||
serialize = options.serialize || JSON.stringify
|
serialize = options.serialize || JSON.stringify
|
||||||
deserialize = options.deserialize || JSON.parse
|
deserialize = options.deserialize || JSON.parse
|
||||||
extract = options.extract || function (xhr) {
|
extract = options.extract || function (xhr) {
|
||||||
|
|
|
||||||
2
mithril.min.js
vendored
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
Loading…
Add table
Add a link
Reference in a new issue