Skip to content

Commit e46fefc

Browse files
committed
Release Artifacts for v2.2.10
[skip ci]
1 parent c6ffa18 commit e46fefc

File tree

6 files changed

+21
-15
lines changed

6 files changed

+21
-15
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
## What is Mithril.js?
1717

18-
A modern client-side JavaScript framework for building Single Page Applications. It's small (<!-- size -->9.05 KB<!-- /size --> gzipped), fast and provides routing and XHR utilities out of the box.
18+
A modern client-side JavaScript framework for building Single Page Applications. It's small (<!-- size -->9.02 KB<!-- /size --> gzipped), fast and provides routing and XHR utilities out of the box.
1919

2020
Mithril.js is used by companies like Vimeo and Nike, and open source platforms like Lichess 👍.
2121

docs/recent-changes.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11

2+
# Release v2.2.10
3+
4+
### Patch Changes
5+
6+
#### [[refactor] Performance improvement of updateStyle() (@kfule)](https://github.com/MithrilJS/mithril.js/pull/2985)
7+
8+
This is a refactoring to improve the performance of `updateStyle()`.
9+
210
# Release v2.2.9
311

412
### Patch Changes

mithril.js

+8-10
Original file line numberDiff line numberDiff line change
@@ -922,13 +922,6 @@ var _11 = function() {
922922
) && key in vnode3.dom
923923
}
924924
//style
925-
var uppercaseRegex = /[A-Z]/g
926-
function toLowerCase(capital) { return "-" + capital.toLowerCase() }
927-
function normalizeKey(key) {
928-
return key[0] === "-" && key[1] === "-" ? key :
929-
key === "cssFloat" ? "float" :
930-
key.replace(uppercaseRegex, toLowerCase)
931-
}
932925
function updateStyle(element, old, style) {
933926
if (old === style) {
934927
// Styles are equivalent, do nothing.
@@ -944,21 +937,26 @@ var _11 = function() {
944937
// Add new style properties
945938
for (var key in style) {
946939
var value = style[key]
947-
if (value != null) element.style.setProperty(normalizeKey(key), String(value))
940+
if (value != null) {
941+
if (key[0] === "-" && key[1] === "-") element.style.setProperty(key, String(value))
942+
else element.style[key] = String(value)
943+
}
948944
}
949945
} else {
950946
// Both old & new are (different) objects.
951947
// Update style properties that have changed
952948
for (var key in style) {
953949
var value = style[key]
954950
if (value != null && (value = String(value)) !== String(old[key])) {
955-
element.style.setProperty(normalizeKey(key), value)
951+
if (key[0] === "-" && key[1] === "-") element.style.setProperty(key, value)
952+
else element.style[key] = value
956953
}
957954
}
958955
// Remove style properties that no longer exist
959956
for (var key in old) {
960957
if (old[key] != null && style[key] == null) {
961-
element.style.removeProperty(normalizeKey(key))
958+
if (key[0] === "-" && key[1] === "-") element.style.removeProperty(key)
959+
else element.style[key] = ""
962960
}
963961
}
964962
}

mithril.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mithril",
3-
"version": "2.2.9",
3+
"version": "2.2.10",
44
"description": "A framework for building brilliant applications",
55
"author": "Leo Horie",
66
"license": "MIT",

0 commit comments

Comments
 (0)