Skip to content

Commit

Permalink
Release Artifacts for v2.2.10
Browse files Browse the repository at this point in the history
 [skip ci]
  • Loading branch information
JAForbes committed Nov 7, 2024
1 parent c6ffa18 commit e46fefc
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

## What is Mithril.js?

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

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

Expand Down
8 changes: 8 additions & 0 deletions docs/recent-changes.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@

# Release v2.2.10

### Patch Changes

#### [[refactor] Performance improvement of updateStyle() (@kfule)](https://github.com/MithrilJS/mithril.js/pull/2985)

This is a refactoring to improve the performance of `updateStyle()`.

# Release v2.2.9

### Patch Changes
Expand Down
18 changes: 8 additions & 10 deletions mithril.js
Original file line number Diff line number Diff line change
Expand Up @@ -922,13 +922,6 @@ var _11 = function() {
) && key in vnode3.dom
}
//style
var uppercaseRegex = /[A-Z]/g
function toLowerCase(capital) { return "-" + capital.toLowerCase() }
function normalizeKey(key) {
return key[0] === "-" && key[1] === "-" ? key :
key === "cssFloat" ? "float" :
key.replace(uppercaseRegex, toLowerCase)
}
function updateStyle(element, old, style) {
if (old === style) {
// Styles are equivalent, do nothing.
Expand All @@ -944,21 +937,26 @@ var _11 = function() {
// Add new style properties
for (var key in style) {
var value = style[key]
if (value != null) element.style.setProperty(normalizeKey(key), String(value))
if (value != null) {
if (key[0] === "-" && key[1] === "-") element.style.setProperty(key, String(value))
else element.style[key] = String(value)
}
}
} else {
// Both old & new are (different) objects.
// Update style properties that have changed
for (var key in style) {
var value = style[key]
if (value != null && (value = String(value)) !== String(old[key])) {
element.style.setProperty(normalizeKey(key), value)
if (key[0] === "-" && key[1] === "-") element.style.setProperty(key, value)
else element.style[key] = value
}
}
// Remove style properties that no longer exist
for (var key in old) {
if (old[key] != null && style[key] == null) {
element.style.removeProperty(normalizeKey(key))
if (key[0] === "-" && key[1] === "-") element.style.removeProperty(key)
else element.style[key] = ""
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion mithril.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mithril",
"version": "2.2.9",
"version": "2.2.10",
"description": "A framework for building brilliant applications",
"author": "Leo Horie",
"license": "MIT",
Expand Down

0 comments on commit e46fefc

Please sign in to comment.