Bundled output for commit f149003d03 [skip ci]
This commit is contained in:
parent
f149003d03
commit
3e3834a762
3 changed files with 50 additions and 50 deletions
16
mithril.js
16
mithril.js
|
|
@ -4,7 +4,7 @@ function Vnode(tag, key, attrs0, children, text, dom) {
|
|||
return {tag: tag, key: key, attrs: attrs0, children: children, text: text, dom: dom, domSize: undefined, state: {}, events: undefined, instance: undefined, skip: false}
|
||||
}
|
||||
Vnode.normalize = function(node) {
|
||||
if (node instanceof Array) return Vnode("[", undefined, undefined, Vnode.normalizeChildren(node), undefined, undefined)
|
||||
if (Array.isArray(node)) return Vnode("[", undefined, undefined, Vnode.normalizeChildren(node), undefined, undefined)
|
||||
if (node != null && typeof node !== "object") return Vnode("#", undefined, undefined, node, undefined, undefined)
|
||||
return node
|
||||
}
|
||||
|
|
@ -52,19 +52,19 @@ function hyperscript(selector) {
|
|||
break
|
||||
}
|
||||
}
|
||||
if (children instanceof Array && children.length == 1 && children[0] != null && children[0].tag === "#") text = children[0].children
|
||||
if (Array.isArray(children) && children.length == 1 && children[0] != null && children[0].tag === "#") text = children[0].children
|
||||
else childList = children
|
||||
return Vnode(tag || "div", attrs.key, hasAttrs ? attrs : undefined, childList, text, undefined)
|
||||
}
|
||||
}
|
||||
var attrs, children, childrenIndex
|
||||
if (arguments[1] == null || typeof arguments[1] === "object" && arguments[1].tag === undefined && !(arguments[1] instanceof Array)) {
|
||||
if (arguments[1] == null || typeof arguments[1] === "object" && arguments[1].tag === undefined && !Array.isArray(arguments[1])) {
|
||||
attrs = arguments[1]
|
||||
childrenIndex = 2
|
||||
}
|
||||
else childrenIndex = 1
|
||||
if (arguments.length === childrenIndex + 1) {
|
||||
children = arguments[childrenIndex] instanceof Array ? arguments[childrenIndex] : [arguments[childrenIndex]]
|
||||
children = Array.isArray(arguments[childrenIndex]) ? arguments[childrenIndex] : [arguments[childrenIndex]]
|
||||
}
|
||||
else {
|
||||
children = []
|
||||
|
|
@ -190,7 +190,7 @@ var buildQueryString = function(object) {
|
|||
}
|
||||
return args.join("&")
|
||||
function destructure(key0, value) {
|
||||
if (value instanceof Array) {
|
||||
if (Array.isArray(value)) {
|
||||
for (var i = 0; i < value.length; i++) {
|
||||
destructure(key0 + "[" + i + "]", value[i])
|
||||
}
|
||||
|
|
@ -332,7 +332,7 @@ var _8 = function($window, Promise) {
|
|||
function extract(xhr) {return xhr.responseText}
|
||||
function cast(type0, data) {
|
||||
if (typeof type0 === "function") {
|
||||
if (data instanceof Array) {
|
||||
if (Array.isArray(data)) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
data[i] = new type0(data[i])
|
||||
}
|
||||
|
|
@ -746,7 +746,7 @@ var coreRenderer = function($window) {
|
|||
if (vnode.instance != null) onremove(vnode.instance)
|
||||
else {
|
||||
var children = vnode.children
|
||||
if (children instanceof Array) {
|
||||
if (Array.isArray(children)) {
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
var child = children[i]
|
||||
if (child != null) onremove(child)
|
||||
|
|
@ -888,7 +888,7 @@ var coreRenderer = function($window) {
|
|||
var active = $doc.activeElement
|
||||
// First time0 rendering into a node clears it out
|
||||
if (dom.vnodes == null) dom.textContent = ""
|
||||
if (!(vnodes instanceof Array)) vnodes = [vnodes]
|
||||
if (!Array.isArray(vnodes)) vnodes = [vnodes]
|
||||
updateNodes(dom, dom.vnodes, Vnode.normalizeChildren(vnodes), hooks, null, undefined)
|
||||
dom.vnodes = vnodes
|
||||
for (var i = 0; i < hooks.length; i++) hooks[i]()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue