Merge pull request #1119 from futurist/next
FIX: ES3 props keyword bug in IE8; eslint errors
This commit is contained in:
commit
015f127563
2 changed files with 20 additions and 11 deletions
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
"curly": [2, "multi-line"],
|
||||
"dot-location": [2, "property"],
|
||||
"dot-notation": 2,
|
||||
"dot-notation": [2, {"allowKeywords": false}],
|
||||
"eqeqeq": [2, "allow-null"],
|
||||
"no-alert": 2,
|
||||
"no-caller": 2,
|
||||
|
|
@ -72,7 +72,7 @@
|
|||
"operator-assignment": 2,
|
||||
"operator-linebreak": [2, "after"],
|
||||
"padded-blocks": [2, "never"],
|
||||
"quote-props": [2, "as-needed"],
|
||||
"quote-props": [2, "as-needed", {"keywords": true}],
|
||||
"quotes": [2, "double", "avoid-escape"],
|
||||
"semi-spacing": 0,
|
||||
"semi": [2, "never"],
|
||||
|
|
|
|||
27
mithril.js
27
mithril.js
|
|
@ -1,3 +1,5 @@
|
|||
/* global Promise */
|
||||
|
||||
;(function (global, factory) { // eslint-disable-line
|
||||
"use strict"
|
||||
/* eslint-disable no-undef */
|
||||
|
|
@ -84,7 +86,9 @@
|
|||
|
||||
function parseTagAttrs(cell, tag) {
|
||||
var classes = []
|
||||
/* eslint-disable max-len */
|
||||
var parser = /(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g
|
||||
/* eslint-enable max-len */
|
||||
var match
|
||||
|
||||
while ((match = parser.exec(tag))) {
|
||||
|
|
@ -188,7 +192,9 @@
|
|||
// value of Console.log in some versions of Firefox (behavior depends on
|
||||
// version)
|
||||
try {
|
||||
if (typeof data !== "boolean" && data != null && data.toString() != null) return data
|
||||
if (typeof data !== "boolean" &&
|
||||
data != null &&
|
||||
data.toString() != null) return data
|
||||
} catch (e) {
|
||||
// silently ignore errors
|
||||
}
|
||||
|
|
@ -1082,8 +1088,7 @@
|
|||
} catch (e) {
|
||||
node.setAttribute(attrName, dataAttr)
|
||||
}
|
||||
}
|
||||
else node.setAttribute(attrName, dataAttr)
|
||||
} else node.setAttribute(attrName, dataAttr)
|
||||
}
|
||||
|
||||
function trySetAttr(
|
||||
|
|
@ -1095,7 +1100,10 @@
|
|||
tag,
|
||||
namespace
|
||||
) {
|
||||
if (!(attrName in cachedAttrs) || (cachedAttr !== dataAttr) || typeof dataAttr === "object" || ($document.activeElement === node)) {
|
||||
if (!(attrName in cachedAttrs) ||
|
||||
(cachedAttr !== dataAttr) ||
|
||||
typeof dataAttr === "object" ||
|
||||
($document.activeElement === node)) {
|
||||
cachedAttrs[attrName] = dataAttr
|
||||
try {
|
||||
return setSingleAttr(
|
||||
|
|
@ -1111,7 +1119,7 @@
|
|||
if (e.message.indexOf("Invalid argument") < 0) throw e
|
||||
}
|
||||
} else if (attrName === "value" && tag === "input" &&
|
||||
node.value !== dataAttr) {
|
||||
node.value !== dataAttr) {
|
||||
// #348 dataAttr may not be a string, so use loose comparison
|
||||
node.value = dataAttr
|
||||
}
|
||||
|
|
@ -1343,7 +1351,9 @@
|
|||
}
|
||||
|
||||
m.prop = function (store) {
|
||||
if ((store != null && (isObject(store) || isFunction(store)) || ((typeof Promise !== "undefined") && (store instanceof Promise))) &&
|
||||
if ((store != null && (isObject(store) || isFunction(store)) ||
|
||||
((typeof Promise !== "undefined") &&
|
||||
(store instanceof Promise))) &&
|
||||
isFunction(store.then)) {
|
||||
return propify(store)
|
||||
}
|
||||
|
|
@ -1829,8 +1839,7 @@
|
|||
if (params[key] != null) {
|
||||
if (!isArray(params[key])) params[key] = [params[key]]
|
||||
params[key].push(value)
|
||||
}
|
||||
else params[key] = value
|
||||
} else params[key] = value
|
||||
})
|
||||
|
||||
return params
|
||||
|
|
@ -1858,7 +1867,7 @@
|
|||
return propify(promise.then(resolve, reject), initialValue)
|
||||
}
|
||||
|
||||
prop.catch = prop.then.bind(null, null)
|
||||
prop["catch"] = prop.then.bind(null, null)
|
||||
return prop
|
||||
}
|
||||
// Promiz.mithril.js | Zolmeister | MIT
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue