1033 Commits

Author SHA1 Message Date
Michael Rawlings
df79fcc5f0
Diffing/Keying fixes (#1094)
* Updates the diffing algorithm to use an HTMLFragment node as an abstraction rather than keeping track of startNode and endNode all throughout the diffing algorithm.

* Uses the HTMLFragment for the <${dynamic}> tag and <include> tags to preserve server-rendered content for which the renderBody is not available in the browser.

* Component ids are based on the resulting parent tree (not the owner tree). This means we cannot rely on the ids in the global lookup, so component key/refs are now also stored on the component instance.

* Static node trees are now only auto assigned a key for the top-level node (instead of all nodes).

* Server comment starting markers now have the component's key serialized so the component can be attached to its owner

* Server comment markers no longer have the id on the closing marker, it is stack based.

* Normalize differences between hydration and client-rendering, so post mount the DOM looks the same regardless of whether a component was server or client rendered.

* fix matching up fragments when hydrating by taking components and normalized text nodes into account

* remove wrapping divs in test, should no longer be needed.  address hydration issue with alternate fragment matching approach.

* add fragment to dom if there's a parentNode even if no startNode

* add test for mismatched hydration

* don't detach components before moving

* use fragments to preserve renderBody content

* use ___finishFragment as the incomplete fragment marker

* ensure fragments get destroyed properly and dom node key sequences don't continue from previous renders

* use parent/owner terminology in more places, component ids are now parent scoped, key/ref components are attached to their owner for both client + server render, server comment boundaries include the owner and the key in addition to the fully scoped component id, autokeyed dom nodes are attached to their parent, hydration now uses a stack: ids in ending comment nodes not needed, hydration checks to see if a component has been initialized and will attach keys directly to the owner if so

* add mutation guards for text/comment nodes, add mutation guard for input value

* make component-pages test better represent streaming hydration, fix html/head/body hydration in a better/more generic way

* add test for async rendered keyrefs

* add test for repeated mult-level transclusion

* Autokeyed elements are now stored on the parent rather than the owner. User assigned key/refs are still stored on the owner component. Because of this, user assigned keys are now prefixed (with @) to differentiate them from autokeys. This also has the benefit that assigning numeric keys can no longer conflict with the autokeys.

* add re-rendering the intermediate container to one of the new tests
2018-08-27 11:46:47 -07:00
Michael Rawlings
342ddb0084
fix event names with dashes 2018-08-16 12:24:27 -07:00
Dylan Piercey
cd7d93ba3b Add test for nested fragments. (#1107) 2018-08-14 12:56:06 -07:00
Dylan Piercey
e7057f140e Add test for top level transcluded content. (#1108) 2018-08-13 16:03:41 -07:00
Michael Rawlings
168dc9b71e
support functions as event handlers (#1106) 2018-08-07 14:58:47 -07:00
Michael Rawlings
b749da95ed
Use capture for event delegation (#1104)
use delegation for all events
2018-08-06 15:50:55 -07:00
Michael Rawlings
671ef757e3
don't render invalid attribute names on the server (#1103) 2018-08-02 11:40:53 -07:00
Dylan Piercey
e4a01a9558 Remove extra parenthesis from compiled javascript. (#1099) 2018-07-26 10:38:21 -07:00
Michael Rawlings
c7b993db08
fix all for loop types (#1091) 2018-07-19 16:47:10 -07:00
Michael Rawlings
7b7e6328bb
fixes #1022 - transcluded keys don't match, stateful component not preserved (#1086) 2018-07-16 13:22:33 -07:00
Michael Rawlings
8bcb848297
enable style arrays (#1082) 2018-07-10 13:06:14 -07:00
Michael Rawlings
280f734f70
fixes #1075 - cannot compile dynamic tag at root with user key (#1081) 2018-07-10 13:05:43 -07:00
Michael Rawlings
f48e22c414
Fixes #1078 - don't mutate spread attributes (#1080) 2018-07-10 13:05:14 -07:00
Michael Rawlings
f5ebda8f2a
Tag params (#1076) 2018-07-10 13:04:46 -07:00
Cameron Braid
d49498cb94 added failing test for #1059 (#1072)
* added failing test for #1059
2018-06-29 13:19:25 -07:00
Michael Rawlings
5fe6cbec2e
fix nextsibiling error caused by components not being removed from lookup (#1068)
* fix nextSibiling error caused by components not being removed from lookup
2018-06-28 15:13:31 -07:00
Dylan Piercey
6d9c11d072 No longer set scoped attributes as default keys. (#1069)
* No longer set scoped attributes as default keys.
* Remove now unnecessary variable from compiled output
2018-06-28 12:19:31 -07:00
Michael Rawlings
505dd1e1ba
switch to using extracted jsdom-context-require 2018-06-27 14:12:41 -07:00
Michael Rawlings
a5b93ebb25
fix for loop autokeys (#1067) 2018-06-25 21:35:39 -07:00
Dylan Piercey
66f7de0530
Fix regression with dynamic tag converting attributes to camelCase. 2018-06-21 13:02:52 -07:00
Austin Kelleher
d9805d0e28 Update prettier (#1062)
* update prettier
* format files with new version of prettier
2018-06-21 10:40:44 -07:00
Michael Rawlings
ec9b644a92
Dynamic class style (#1058)
* fix dynamic tag class/style attributes
* allow object/arrays as class/style attributes in spread attributes
2018-06-20 17:13:27 -07:00
Michael Rawlings
e2fd5b63da
dynamic tag (#1057) 2018-06-19 17:11:54 -07:00
Michael Rawlings
f29b9a21ec
additional tests 2018-06-19 13:54:34 -07:00
Dylan Piercey
a383a18932
Add lock file. 2018-06-15 15:35:47 -07:00
Dylan Piercey
b5425a0930
Cleanup comment node cache for multiple inits. 2018-06-14 09:32:53 -07:00
Dylan Piercey
048a563a86 Add failing test cases from branches. 2018-05-16 10:43:09 -07:00
Dylan Piercey
1a37333440 Add same test for legacy compatibility layer. 2018-05-10 13:26:49 -07:00
Dylan Piercey
5be4d52d32 Add test for updating in onMount 2018-05-10 13:26:49 -07:00
Austin Kelleher
89dfb4ba5c
Fixes #877 - Allow array of transformers in marko.json. (#1034) 2018-04-26 08:48:34 -04:00
Michael Rawlings
dfc079ac76 remove dirty check for legacy components 2018-04-25 13:32:17 -07:00
Michael Rawlings
c619f29c1e update prettier 2018-04-25 13:26:36 -07:00
Michael Rawlings
6a6d13d50c Fix spread fns #1008 (#1029)
* fix #1008 - parsing of spread attributes that end in function calls
2018-04-03 13:10:07 -07:00
Michael Rawlings
17e623d049 add failing test case (#1025) 2018-04-03 13:09:44 -07:00
Denis Budyak
eae689a8fd Fix import-var compilation when there are no explicit attributes 2018-03-23 15:10:35 -07:00
Jason MacDonald
4a7be17af8 Added failing test for #1008 (#1017)
* Added failing test for issue #1008
2018-03-23 12:14:45 -07:00
Michael Rawlings
92c448f639 Autotest refactor (#1023)
* update autotest api and first few test suites

* refactor components-browser to use the new autotest api

* minor changes to update adjustIndent and components-pages to new autotest api

* refactor and combine async-render, deprecated-async-fragments, and render suites

* migrate compiler tests to new autotest runner

* migrate components-compilation tests to use new autotest api

* migrate most remaining test runners to new autotest api

* update adjustIndent

* migrate express tests to new autotest api

* switch from compare to snapshot

* move versions into directory

* remove snapshot sequences, prefix to name, suffix to ext

* refactor autotest

* keep node 4 happy: don't use destructured parameters

* use strict

* update contributing document to reflect new autotest api

* better snapshot errors with clickable path

* remove old vdomSkip property, fix some normalization in the render test runner, skip only tests that need to be skipped

* for generated vdom expectations use expected.html instead of rerendering the html template, update expected files that had editor added newlines at the end

* remove half-finished test that was intended to replace another test (render/fixtures/preserveWhitespace-load-option) - we'll keep the original
2018-03-23 11:27:52 -07:00
Michael Rawlings
0f5e639775 Format + lint (#1016)
* add prettierignore

* switch to eslint:recommended + eslint-config-prettier

* fix eslint violations

* remove more .jshintrc files

* better conditional structure

* add prettier and update prettier ignore

* add precommit hook to run prettier

* add lint check to precommit and format check to ci

* format all the things

* add generated files

* let npm do it's thing with package.json
2018-03-09 10:02:11 -08:00
Michael Rawlings
64da7034d9
Test allow failures (#1014)
* update mocha, add it-fails, add failing tests and skip reasons to autotest, use in the existing tests

* update labels and testing info in CONTRIBUTING
2018-03-05 21:48:08 -08:00
Jason MacDonald
279744495e Fixed an issue with keyed elements not getting properly removed from component context when transclusion is used with a single, rendered, body item. (#1009) (#1013) 2018-03-05 14:33:48 -08:00
Michael Rawlings
bd4855271d Hydrate fixes (#1010)
* enable legacy hydrate tests, update test harness to support legacy widgets

* enable autokey for tests, update expectations, add better html diff output

* update test harness to register statically discovered components

* return to using a single mount function for legacy and modern components

* remove lasso from test package dependencies

* add all renders to the renderedCache, track instances separately

* temporarily skip failing hydrate test for widget types

* update widget lifecycle tracker to work with hydrate test as well

* update tests/expectations to use serialize globals: onCreate should be called when hydrating stateful components

* preserve included renderbodies

* update legacy renderbodies to use the new method of preservations

* mount components in preserved renderbodies

* stateful components should rerender when mounting, not all legacy components are split components

* ensure elements with events in split components have thier keys serialized

* call onCreate and onInput when mounting root rerender components

* fix code supporting once-* causing all events (on-* included) for hydrated split components to be handled only once

* change the way input is removed from legacy components
2018-03-02 16:09:14 -08:00
Michael Rawlings
ddca804915 Hydrate tests (#994)
* enable hydrate tests, use repeated key in split component to get references to server-rendered components

* allow tests to determine if hydrate mode, update attach event tests for correct expectations when hydrating

* add empty class so that the component is mounted when hydrating and we have a component reference to use for testing

* add support for  to the hydrate tests, update tests to serializeGlobals

* allow skipping hydrate only, skip hydrate for implicit component tests

* skip hydrate for test with two different global inputs

* better support for split/legacy components in the test harness

* components are already mounted in hydrate mode, so setup needs to be done elsewhere

* temporarily skip tests failing due to onCreate not being called for root level hydrated components

* only add attach/detach global helpers if target is vdom - this should not run on the server and was causing the morphdom/vdom tests to fail if it was included before them

* skip hydrate tests for deprecated components - there are a number of issues here that still need to be fixed
2018-02-23 12:15:44 -08:00
Scott Davis
f76bfff323 Add once-[event] directive Fixes #985 (#990)
* Add `once-[event]` directive.
* Improve docs for attaching events.
2018-02-20 10:33:43 -08:00
Dylan Piercey
a7f529debd Testing Improvements. (#989)
* * Setup utility to run jsdom tests in the same process without bundling.
* Cleanup require hooks in test suite.
* Test organization and cleanup.
* Remove redundant autotest utilities.

* Switch to require for browser.json loading

* Cache browser.json remaps. Fix components-browser rehydration setup

* Improve inline docs, remove some unneeded init code for testing modules.

* Remove unneeded promise polyfill
2018-02-20 10:26:48 -08:00
Dylan Piercey
d00ea44d46 Test perf and organization (#981)
* Switch to in memory lasso builds and other optimizations.

* Condense components-compilation tests.

* Update lasso-fs-writer

* Condense components-compilation and compiler tests

* Increase mocha test timeout

* Allow lasso to be gc'd for tests

* Improve test cache clearing

* Fix lasso memory leak in tests

* Cache instanbul intrumenting.

* Hide complain logs.
2018-02-06 18:53:55 -08:00
Michael Rawlings
4d11fa6802 Spread attributes. Completes #878 (#967)
* add spread operator and update docs.
2018-02-06 16:01:25 -08:00
Dylan Piercey
d484de9f14 Fixes top level static for custom tags. (#959)
* Fixes top level static for custom tags.

* Switch static tag from code-generator to transformer to increase it's priority.

* Rename test.

* Fix expected file for tests.
2018-02-06 15:59:42 -08:00
Dylan Piercey
5936c1301c Issue 938 (#966)
* Add failing test case

* Add a temporary patch to fix focus.
2018-02-06 15:58:39 -08:00
Dylan Piercey
f60d59ccd8
Fix issue with browser tests reporting as passing. Remove duplicate test runs from npm scripts. (#950) 2017-12-14 15:30:09 -08:00
Michael Rawlings
62ddb65fa1
allow conditionally binding to different roots in a legacy widget (#944) 2017-12-07 12:02:05 -06:00