Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Element Collapse API #3721

Merged
merged 15 commits into from
Jul 8, 2016
Merged

Conversation

jridgewell
Copy link
Contributor

@jridgewell jridgewell commented Jun 22, 2016

Adds the AmpElement#collapse API, which hides the element and notifies its owner that it has collapsed. Owner's may react to this by collapsing themselves, for example.

Fixes #3338.

  • Needs tests

* Collapses the element, and notifies its owner (if there is one) that the
* element is no longer present.
*/
collapse() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we restrict access to this method via presubmits?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean that it has to be marked /*OK*/ and /*REVIEW*/?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@jridgewell
Copy link
Contributor Author

PTAL.

@@ -100,11 +119,45 @@ class AmpFlyingCarpet extends AMP.BaseElement {
this.assertPosition();
} catch (e) {
// Collapse the element if the effect is broken by the viewport location.
toggle(this.element, false);
this./*REVIEW*/collapse();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

@cramforce
Copy link
Member

LGTM

@dvoytenko
Copy link
Contributor

@jridgewell Sorry for the delay. This is LGTM

@jridgewell jridgewell merged commit 74f25ee into ampproject:master Jul 8, 2016
@jridgewell jridgewell deleted the collapse-parents branch July 8, 2016 17:14
ariangibson pushed a commit to Mixpo/amphtml that referenced this pull request Sep 7, 2016
* Fix flying carpet example

* Add #collapse and #collapsedCallback

* Use #collapse when collapsing AmpElement

* Collapse Flying Carpet when all children collapse

* Take ownership of the children

* Fix imports

* Keep track of childNodes, but own children

* Tests

* #collapse is not a protected API

* Collapse a Flying Carpet if only whitespace is visible

* OK #collapse

* linting

* Update presubmit

* Update amp-ad

* Add more docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants