Commit graph

306 commits

Author SHA1 Message Date
makibishi
a73c157dff refactor: Vnode.normalizeChildren to anonymous function (#2208) 2018-10-28 18:02:32 -04:00
spacejack
ea0ce7f762 Store normalized vnodes in the dom element. Add render tests. (#2266)
* Store normalized vnodes in the dom element. Add render tests.

* Add entry to change-log
2018-10-28 17:17:24 -04:00
Isiah Meadows
2635070734 Merge branch 'next' 2018-10-25 14:23:33 -04:00
Isiah Meadows
88b17c1c60
Avoid triggering Object.prototype.__proto__ with keys (#2251)
This way, the diff algorithm works with untrusted keys.
2018-10-15 15:09:55 -04:00
Isiah Meadows
62eb081a13 Simplify element removal to save a few bytes
It's also a minor peephole optimization, but I saw bigger size wins, so
I'm citing that.
2018-09-22 12:02:58 -04:00
Isiah Meadows
1ecc30a064 Fix custom elements attribute application, improve key checking
- Fix custom elements attribute application to acknowledge that not all
  custom elements operate purely based on attributes. (Plus, those
  blasted things are verbose as heck when you're working with them in
  raw form. It's also not that uncommon for functionality to be exposed
  via property and *not* attribute.)
- Don't memoize the normalized value when we 1. only use it once in each
  branch, and 2. only use it for a few special cases.
- Centralize the "has property key" code, so it's easier to tune and
  read. I also inlined a couple functions while I was at it since they
  were small and only used once.
- Actually test for how attributes are applied to raw DOM elements vs
  when we choose to use keys. When I first developed the patch, it
  silently worked, when I should've been breaking things.
2018-09-20 15:08:49 -04:00
Isiah Meadows
ad5118165c
Fix redundancy (#2213)
* Remove redundant empty fragment return

* Rebuild bundles

* Update changelog
2018-09-19 01:23:33 -04:00
Isiah Meadows
c703b03253
Unbreak accidental back-compat break with event optimization (#2222)
This was supposed to be purely additive. See here for more details:

https://github.com/MithrilJS/mithril.js/pull/1949#issuecomment-417824513
2018-09-18 10:14:21 -04:00
Sebastian Sandqvist
571b60830b [render/render] Prevent activeElement.focus on SVGs, fix #1983 2018-06-11 22:04:34 +02:00
Pierre-Yves Gérardy
32b319d140 [render/hyperscript] Normalize to class attrs to className, ignore only nullish values 2018-06-07 18:09:38 +02:00
Pierre-Yves Gérardy
8daa386e5e [render/test] add a render/hyperscript integration suite for classes 2018-06-07 18:09:38 +02:00
Pierre-Yves Gérardy
92b22fe8e6 [render/hyperscript] have the attrs take precedence over the selector, improve class normalization
fix #1773
fix #2172
2018-06-07 18:09:38 +02:00
Pierre-Yves Gérardy
3f5cabc5c5 Chore: Normalize the way we use eslint-disable 2018-06-01 21:27:02 +02:00
Pierre-Yves Gérardy
6283aa4a7d [render/render] Test for removing styles and assorted domMock changes 2018-06-01 21:27:02 +02:00
Pierre-Yves Gérardy
cfa128a5cd [render/render] make updateAttrs smarter about null values 2018-06-01 21:27:02 +02:00
Pierre-Yves Gérardy
4921083898 [render/render] Fix xlink:href handling 2018-06-01 21:27:02 +02:00
Pierre-Yves Gérardy
2469505b1b Move xlink:href test to the proper file 2018-06-01 21:27:02 +02:00
Pierre-Yves Gerardy
5b51b682ee Improve attrs removal, fix #1804 2018-06-01 21:27:02 +02:00
Pierre-Yves Gerardy
dc15acd791 Improve attrs setting performance
before:

> mutate styles/properties x 7,999 ops/sec ±10.87% (46 runs sampled)

after:

> mutate styles/properties x 16,104 ops/sec ±4.36% (66 runs sampled)
2018-06-01 21:27:02 +02:00
Pierre-Yves Gerardy
4197cf0ae1 Enable the tests for #1804 2018-06-01 21:27:02 +02:00
Pierre-Yves Gérardy
285cb5382f [render] cleanup and comments 2018-05-29 23:50:29 +02:00
Pierre-Yves Gérardy
144ce68192 [render/render] get rid of vnode.skip 2018-05-29 23:50:29 +02:00
Pierre-Yves Gérardy
2cfc68359d [render/render] Introduce longest increasing subsequence-based node moves in keyed diff, fix #1791, fix #2026 2018-05-29 23:50:29 +02:00
Pierre-Yves Gérardy
95ec3d28aa test for the LIS-based diff 2018-05-29 23:50:29 +02:00
Barney Carroll
1579fe8430
Do not normalise component children on ingestion (#2155)
* Do not normalise component children on ingestion

* Don't normalise vnode children

* Component hyperscript tests: children aren't normalised

* test, not text

* Update change log: #2155 & #2064
2018-05-29 10:53:16 +01:00
magikstm
6097cfb2e9 Small optimization in render hyperscript.js (#2064)
* Small optimization in render hyperscript.js

* Remove temporary variable

* Small optimization in render hyperscript.js

Squashed commits:

[5b103291] Small optimization in render hyperscript.js

* Remove sloppy mode comment
2018-05-18 20:48:56 +02:00
Pierre-Yves Gérardy
44e165a357 [render/render] Misc comment fixes 2018-04-23 13:52:03 +02:00
Pierre-Yves Gérardy
f7a95d8c12 Cleanup, comments, and optimize getKeyMap 2018-04-23 13:52:03 +02:00
Pierre-Yves Gérardy
801bde219e [render/render] move keyed cached nodes when needed, fix diff semantics for cached nodes, fix #2132 2018-04-23 13:52:03 +02:00
Pierre-Yves Gérardy
878e4958dc tests for #2132 2018-04-23 13:52:03 +02:00
Pierre-Yves Gérardy
9490950c30 [render/render] Simplify updateNodes, fix #2128 2018-04-23 13:52:03 +02:00
Pierre-Yves Gérardy
dd6ceca31d tests for #2128 2018-04-23 13:52:03 +02:00
Pierre-Yves Gérardy
c6693aa361 Disentangle keyed and unkeyed diff 2018-04-23 13:52:03 +02:00
Pierre-Yves Gérardy
203df39c30 Remove the DOM nodes recycling pool (fix #1653, fix #2023) 2018-04-16 09:45:45 +02:00
Pierre-Yves Gérardy
d21ba5ee6a Document the reason for the possibleParents map 2018-03-06 02:13:15 +01:00
Pierre-Yves Gérardy
ad46a21a7d [render] add support for SVG in m.trust() strings 2018-03-06 01:12:32 +01:00
Fabiano Taioli
83884bdc90 element value is not cleared when value valor change to undefined 2018-02-09 00:47:59 +01:00
Pierre-Yves Gérardy
1782fa8b63 render: fix perf regression introduced by #1918 2017-12-08 21:37:08 +01:00
Pierre-Yves Gérardy
9f09ac069c Address #2021 review comments 2017-12-04 14:38:39 +01:00
Pierre-Yves Gérardy
3f37d3d7c0 #2021 change log and docs 2017-12-04 14:38:39 +01:00
Pierre-Yves Gérardy
02aab654f0 render: remove check that may hide bugs 2017-12-04 14:38:39 +01:00
Pierre-Yves Gérardy
fc0240da0f Tests for #1990, #1991 and #2003 2017-12-04 14:38:39 +01:00
Pierre-Yves Gérardy
9c835f4eac render/updateNodes: call toFragment on the new vnodes, solves issues with actual fragments (fix #1991 partim 2) 2017-12-04 14:38:39 +01:00
Pierre-Yves Gérardy
39ff8d7217 render: make removeNode aware that it is removing children from an object that's brought back from the pool 2017-12-04 14:38:39 +01:00
Pierre-Yves Gérardy
98c053e12b render/updateNodes: revamp unkeyed list detection, don't skip null nodes in unkeyed lists when old and vnodes don't have the same length
Fix #2003 partim 2
2017-12-04 14:38:39 +01:00
Pierre-Yves Gérardy
e839c9e80a render/updateNodes: Don't fetch the next sibling from the pool 2017-12-04 14:38:39 +01:00
Pierre-Yves Gérardy
eaa9f589af render/updateNodes: recycling, clarify terminology, fix logic
fix #2003 partim 1
fix #1991 partim 1
2017-12-04 14:38:39 +01:00
Pierre-Yves Gérardy
8950760e85 render: extract pool addtition logic, don't run onremove on nodes that move from pool to pool (fix #1990) 2017-12-04 14:38:39 +01:00
Ilya Sarantsev
1ce8357866 Performance optimization for #1941 per @isiahmeadows suggestion 2017-11-29 16:01:58 +01:00
Ilya Sarantsev
0986140ed5 Handle shared attributes object in hyperscript (#1941) 2017-11-29 16:01:33 +01:00