Commit Graph

1035 Commits

Author SHA1 Message Date
Steven Orvell
2b0494a9c4 Fix Polymer.dom(el).attachShadow/shadowRoot 2021-07-09 18:05:09 -07:00
Kevin Schaaf
04a4ded879 Fix let back to const 2020-07-06 14:21:40 -07:00
Kevin Schaaf
32d7d61d4f Cancel chunking when disconnected. Fixes #5667 2020-07-01 12:03:13 -07:00
Kevin Schaaf
22ac86a8e3 Accept function in legacy _template field for template parsing. Fixes #5660 2020-05-14 16:21:23 -07:00
Russell Bicknell
33e149863e shareBuiltCSSWithAdoptedStyleSheets -> useAdoptedStyleSheetsWithBuiltCSS 2020-04-06 14:10:57 -07:00
Russell Bicknell
bdd765810a Gate feature behind shareBuiltCSSWithAdoptedStyleSheets; update tests. 2020-04-02 17:23:57 -07:00
Kevin Schaaf
91f01e5781 Remove obsolete tests. 2020-03-04 11:24:16 -08:00
Kevin Schaaf
b5664cba10 Simplify by making limit a derived value from existing state.
This centralizes the calculation of limit based on changes to other state variables.
2020-03-04 11:20:57 -08:00
Kevin Schaaf
d67a8b5192 Remove accidental commit of test.only 2020-03-02 23:45:50 -08:00
Kevin Schaaf
1d96db3c38 When re-enabling, ensure __limit is at a good starting point and add a test for that.
Also:
* Ensure `__itemsArrayChanged` is cleared after every render.
* Enqueue `__continueChunkingAfterRaf` before notifying renderedItemCount for safety
2020-03-02 23:41:12 -08:00
Kevin Schaaf
b503db15f1 Remove accidental commit of suite.only 2020-03-02 22:51:52 -08:00
Kevin Schaaf
60f6ccfb7d Ensure limit is reset when initialCount is disabled.
Note that any falsey value for initialCount (including `0`) is interpreted as "chunking disabled". This is consistent with 1.x logic, and follows from the logic of "starting chunking by rendering zero items" doesn't really make sense.
2020-03-02 22:44:19 -08:00
Kevin Schaaf
5421b5b140 Merge pull request #5632 from Polymer/legacy-undefined-noBatch-5631
Fixes for several related dom-repeat chunking issues. Fixes #5631.
2020-02-21 17:44:30 -08:00
Kevin Schaaf
b40840b969 Fixes for several related dom-repeat chunking issues. Fixes #5631.
* Only restart chunking (resetting the list to the initialCount) if the `items` array itself changed (and not splices to the array), to match Polymer 1 behavior.
* Add `reuseChunkedInstances` option to allow reusing instances even when `items` changes; this is likely the more common optimal case when using immutable data, but making it optional for backward compatibility.
* Only measure render time and throttle the chunk size if we rendered a full chunk of new items. Ensures that fast re-renders of existing items don't cause the chunk size to scale up dramatically, subsequently causing too many new items to be created in one chunk.
* Increase the limit by the chunk size as part of any render if there are new items to render, rather than only as a result of rendering.
* Continue chunking by comparing the filtered item count to the limit (not the unfiltered item count).
2020-02-20 23:26:59 -08:00
Kevin Schaaf
b9bbee2c75 Update comment. 2020-02-19 09:39:22 -08:00
Kevin Schaaf
353eabde23 Store syncInfo on instance and don't sync paths. Fixes #5629
* Previously the `syncInfo` used to store changed properties while the dom-if was false was stored on the dom-if. This means that even under `restamp`, any stored properties from a previous instance would be applied to the next instance. This change moves the `syncInfo` storage to the instance, so it naturally goes away when the instance is discarded.  Any new instance will take current values from the host.
* Due to limitations described in #4818, it is bad/illegal to allow paths to be batched and played through `runEffects`, since effect de-duping occurs by _root property_, so effects will only be running once for the first path matching an effect, with all other paths being dropped on the ground.  This can be particularly bad if the user e.g. `set` a path to an object, and then subsequently nulled the object; the observer would then be acting on a path that is no longer valid.  This change only stores the root property & value for any paths that come in, which matches the non-`fastDomIf` behavior with only storing `root(prop)` in `__invalidProps`.
2020-02-12 22:53:12 -08:00
Steven Orvell
5383f5f294 Avoid Array.find (doesn't exist in IE) 2020-01-30 09:26:05 -08:00
Steven Orvell
7df89ae2ed Add comment to skip. 2020-01-29 18:52:31 -08:00
Steven Orvell
fb1a7835a7 Skip test when custom elements polyfill is in use
Cannot be supported with polyfill because it uses setAttribute.
2020-01-29 18:51:56 -08:00
Steven Orvell
3fd967190e Lint fix. 2020-01-29 18:04:48 -08:00
Steven Orvell
dfd0e64183 Update test name. 2020-01-29 17:57:58 -08:00
Steven Orvell
eaca195467 Introduce opt-out per class for legacyNoObservedAttributes
This is necessary when a native property that sets an attribute should be observeable via attributeChangedCallback or Polymer property reflection (e.g. element.tabIndex = 5 setting the `tabindex` attribute).
2020-01-29 17:54:02 -08:00
Steven Orvell
63addd39ec Ensure telemetry system works with legacyNoObservedAttributes setting 2020-01-29 10:40:33 -08:00
Steve Orvell
3e6ba3e907 Merge pull request #5622 from Polymer/legacy-undefined-noBatch-undefinedTemplate
Allow `undefined` in legacy _template field to fall-through to normal lookup path
2020-01-22 10:08:02 -08:00
Steven Orvell
c0bb601824 Merge branch 'legacy-undefined-noBatch' into legacy-undefined-noBatch-undefinedTemplate 2020-01-22 08:59:10 -08:00
Steven Orvell
b759988102 Merge branch 'legacy-undefined-noBatch' into legacy-undefined-noBatch-imperative-attributes 2020-01-22 08:57:20 -08:00
Steven Orvell
5e88e6a70d Merge branch 'master' into legacy-undefined-noBatch-master-merge 2020-01-21 18:14:00 -08:00
Steve Orvell
47a54ef8c7 Update test/unit/inheritance.html 2020-01-21 17:42:32 -08:00
Steven Orvell
61a14c17ce Fix testing issues with latest webcomponentsjs
* querySelectorAll now polyfills an NodeList so coerce to Array when doing `deepEquals`
* when testing noPatch, add workaround for https://github.com/webcomponents/polyfills/issues/250.
2020-01-21 17:29:25 -08:00
Kevin Schaaf
220099cfb4 Allow undefined in legacy _template field to fall-through to normal lookup path. 2020-01-21 16:05:03 -08:00
Steven Orvell
28f12ca9fa Adds support for imperatively created elements to legacyNoObservedAttributes
Using this flag previously read attributes in the element constructor (in addition to patching setAttribute). This covers use cases except imperative or parser created custom elements (not upgraded). In that case the element will not have attributes in the constructor. This is addressed here by checking if the element has a parentNode (which will also not be true in these cases) and if so, records attributes at connected time. This is not always done to avoid having to filter out changes made by bindings.
2020-01-21 13:56:53 -08:00
Peter Burns
afdd9119ad Rebase sanitize dom value getter onto legacy-undefined-noBatch (#5618)
* Add  getSanitizeDOMValue to settings API

For environments that don't well support `export let`.

* Add a test for getSanitizeDOMValue
2020-01-17 14:07:17 -08:00
Peter Burns
aec4cb681e Add getSanitizeDOMValue to settings API (#5617)
* Add  getSanitizeDOMValue to settings API

For environments that don't well support `export let`.

* Add a test for getSanitizeDOMValue
2020-01-17 14:06:33 -08:00
Steven Orvell
c6675db07f legacyNoObservedAttributes: Ensure user created runs before attributesChanged 2020-01-09 15:18:54 -08:00
Steven Orvell
b8315d6061 Enable tests for legacyNoObservedAttributes 2020-01-09 12:06:38 -08:00
Steven Orvell
fa5570b15d Lint fixes. 2019-12-19 17:14:24 -08:00
Steven Orvell
957c8c4d25 Address review feedback. 2019-12-19 15:32:40 -08:00
Steven Orvell
f8dfaa5628 Address review feedback
* DisableUpgradeMixin: fIx finding superClass observedAttributes getter so that it's always correct
* Class: grab observedAttributes getter 1x off of LegacyElement
* Add tests for camelCase properties used with dash cased attributes.
2019-12-19 12:31:06 -08:00
Steven Orvell
7b0c57a43e Lint fixes. 2019-12-18 18:45:43 -08:00
Steven Orvell
8ef2cc7089 Adds legacyNoAttributes setting
Applies a number of optimizations that speed up defining a legacy element. These optimizations are mostly beneficial when a large number of elements are defined that are not used for initial render.

* Fixes an issue with `dedupingMixin` that was causing info to be cached on the resulting class even when no mixin should be applied.
* In Polymer.Class, avoids using `LegacyElementMixin(HTMLElement)` in favor of a cached `LegacyElement`.
* Copies `DisableUpgradeMixin` into Polymer's legacy class generation. This avoids the need to mix this on top of all legacy elements.
* Adds `legacyNoAttributes` setting which avoids setting `observedAttributes` and instead (1) applies the values of all attributes at create time, (2) patches set/removeAttribute so that they call attributeChangedCallback. This is faster since it avoids the work Polymer needs to do to calculate `observedAttributes`.
2019-12-18 18:40:46 -08:00
Steven Orvell
ab04377bda Add basic support for adoptedStyleSheets
Uses `shadowRoot.adoptedStyleSheets` for element styling when supported (currently Chrome) and only if a css build is used. The build restriction is in place in order to support `@apply` via ShadyCSS. Currently ShadyCSS works only with a style element in the element template.
2019-10-08 17:55:38 -07:00
Steven Orvell
280f4f0a37 Applies micro-optimizations and removes obsolete settings
Applies micro-optimizations that were found to improve element creation benchmarks by 5-10%, and removes obsolete settings:

* Removed `legacyNoBatch` and `legacyNotifyOrder` settings.
* dom-if/repeat: `dom-change` and `renderedCount` no longer fire with `legacyOptimizations` set.
* legacy-element-mixin: `isAttached` now set before calling `connectedCallback` so it is batched with initial rendering.
* `PropertiesChanged`: property accessor code now inlined for efficiency rather than calling `_get/_setProperty`. The `__dataCounter` tracking flag has been moved here to avoid the need to override `_flushProperties` in `PropertyEffects`.
* `PropertyEffects`: inlined `runEffectsForProperty` into `runEffects` for efficiency. Removed wrapping around sending data events.
* `async`: In the microtask scheduler, now only provoke a DOM mutation if needed.
2019-09-12 15:11:38 -07:00
Kevin Schaaf
991b099715 Avoid Array.from on Set. 2019-09-03 17:06:33 -07:00
Kevin Schaaf
dc0754ee83 Update nested template names. 2019-09-03 16:59:54 -07:00
Kevin Schaaf
9e106d8229 Add runtime stamping tests around linking & unlinking effects. 2019-09-03 15:17:15 -07:00
Kevin Schaaf
5e1a8b6d3b Ensure parent is linked to child templateInfo. Fixes fastDomIf unstopping issue. 2019-08-29 16:01:50 -07:00
Kevin Schaaf
8b699334a4 Merge branch 'legacy-undefined-noBatch' into legacy-undefined-noBatch-fastDomIfFlush 2019-08-26 16:52:58 -07:00
Kevin Schaaf
2656060cba Merge pull request #5570 from Polymer/legacy-undefined-noBatch-disableUpgrade
Add `disable-upgrade` support to legacy elements
2019-08-26 16:51:28 -07:00
Kevin Schaaf
7e7febc3b6 Ensure clients are flushed when runtime stamping via _stampTemplate.
Maintains flush semantics with Templatizer stamping (relevant to fastDomIf, which is a switch between Templatizer-based stamping and runtime _stampTemplate-based stamping). Works around an issue with `noPatch` where nested undistributed dom-if's won't stamp.  The changes to the tests are to remove testing that the full host tree is correct since the host doing the runtime stamping will no longer be the DOM getRootNode().host at ready time (this is exactly the case with Templatizer, whose semantics we intend to match).
2019-08-21 18:01:40 -07:00
Daniel Freedman
f95fd3276d Fix issue with camel cased properties and disable-upgrade 2019-08-09 12:29:55 -07:00