forked from ampproject/amphtml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Defer Layout Assertions till Upgrade (ampproject#8229)
* Remove attached and upgrade duplication They had very tangled state depending on the state of the element: - Stubbed - `#attachedCallback` - sync `#firstAttachedCallback` (on a stub!) - sync `amp:stubbed` - `#upgrade` - deferred "full" upgrade - deferred `#firstAttachedCallback` - deferred `amp:attached` - deferred `Resources#build` - BaseElement, sync "full" upgrade - `#attachedCallback` - sync "full" upgrade - sync `#firstAttachedCallback` - sync `amp:attached` - sync `#firstAttachedCallback` (twice!) - sync `Resources#build` - BaseElement, async "full" upgrade - `#attachedCallback` - sync `#firstAttachedCallback` (on nothing useful!) - sync `amp:stubbed` - `#upgrade` - deferred "full" upgrade - deferred `#firstAttachedCallback` - deferred `amp:attached` - deferred `Resources#build` This moves all that code into the `#completeUpgrade`, which is either called sync (if upgrade can be done sync) or async (if not). Thus we get all of the same behavior without mixing code between the two methods. * Remove bogus first `#firstAttachedCallback` It's either called on a stubbed element (useless), a sync upgraded element twice(!), or a deferred upgraded element (useless). It will be called a second time after the upgrade is complete. * Remove layout assertions from attachedCallback We must wait until the element is fully upgraded. * Make sure resources is added before it's upgraded * Make sure resources is rebuilt if needed after being reparented * Only mark the resoruce as upgraded when element is upgraded * Fix tests * Fix more tests
- Loading branch information
1 parent
39a2680
commit a6a95c8
Showing
6 changed files
with
104 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.