Bundled output for commit 4c5968a526 [skip ci]

This commit is contained in:
Gandalf-the-Bot 2018-11-26 10:51:03 +00:00
parent 4c5968a526
commit 87033bf1e0
3 changed files with 17 additions and 6 deletions

View file

@ -18,7 +18,7 @@ mithril.js [![NPM Version](https://img.shields.io/npm/v/mithril.svg)](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 👍.

View file

@ -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

File diff suppressed because one or more lines are too long