Bundled output for commit 4c5968a526 [skip ci]
This commit is contained in:
parent
4c5968a526
commit
87033bf1e0
3 changed files with 17 additions and 6 deletions
|
|
@ -18,7 +18,7 @@ mithril.js [](https://ww
|
||||||
|
|
||||||
## What is Mithril?
|
## What is Mithril?
|
||||||
|
|
||||||
A modern client-side Javascript framework for building Single Page Applications. It's small (<!-- size -->8.94 KB<!-- /size --> gzipped), fast and provides routing and XHR utilities out of the box.
|
A modern client-side Javascript framework for building Single Page Applications. It's small (<!-- size -->9.00 KB<!-- /size --> gzipped), fast and provides routing and XHR utilities out of the box.
|
||||||
|
|
||||||
Mithril is used by companies like Vimeo and Nike, and open source platforms like Lichess 👍.
|
Mithril is used by companies like Vimeo and Nike, and open source platforms like Lichess 👍.
|
||||||
|
|
||||||
|
|
|
||||||
19
mithril.js
19
mithril.js
|
|
@ -1160,16 +1160,27 @@ var coreRenderer = function($window) {
|
||||||
) && key2 in vnode.dom
|
) && key2 in vnode.dom
|
||||||
}
|
}
|
||||||
//style
|
//style
|
||||||
function updateStyle(element, old, style) {
|
function updateStyle(element, old, input) {
|
||||||
|
if(typeof input === "object") {
|
||||||
|
var style = {}
|
||||||
|
for(var key2 in input) {
|
||||||
|
style[key2] = String(input[key2]).replace(/[A-Z]/g, function(capital){
|
||||||
|
return "-" + capital.toLowerCase()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var style = input
|
||||||
|
}
|
||||||
if (old != null && style != null && typeof old === "object" && typeof style === "object" && style !== old) {
|
if (old != null && style != null && typeof old === "object" && typeof style === "object" && style !== old) {
|
||||||
// Both old & new are (different) objects.
|
// Both old & new are (different) objects.
|
||||||
// Update style properties that have changed
|
// Update style properties that have changed
|
||||||
for (var key2 in style) {
|
for (var key2 in style) {
|
||||||
if (style[key2] !== old[key2]) element.style[key2] = style[key2]
|
if (style[key2] !== old[key2]) element.style.setProperty(key2, style[key2])
|
||||||
}
|
}
|
||||||
// Remove style properties that no longer exist
|
// Remove style properties that no longer exist
|
||||||
for (var key2 in old) {
|
for (var key2 in old) {
|
||||||
if (!(key2 in style)) element.style[key2] = ""
|
if (!(key2 in style)) element.style.removeProperty(key2)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -1179,7 +1190,7 @@ var coreRenderer = function($window) {
|
||||||
else {
|
else {
|
||||||
if (typeof old === "string") element.style.cssText = ""
|
if (typeof old === "string") element.style.cssText = ""
|
||||||
for (var key2 in style) {
|
for (var key2 in style) {
|
||||||
element.style[key2] = style[key2]
|
element.style.setProperty(key2, style[key2])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
mithril.min.js
vendored
2
mithril.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue