amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

Nested media attributes cause JS Error on resize

Open p2er opened this issue 9 years ago • 4 comments

Short description of your issue:

amp-video elements with media="(orientation: portrait)" tag inside of a amp-carousel with media="(max-width: 599px)" will trigger a JS Error on resize.

discoverResourcesForElement_ -> element is undefined and classList property can not be read.

How do we reproduce the issue?

  1. Open https://p2er.github.io/amp-articleslider/stacked-media-carousel.html in portrait viewport with window width < 599px
  2. Navigate to second slide
  3. Increase browser window width above > 599px

What browsers are affected?

Tested on Chrome 57 on Mac OS X. Does also happen on Safari 10.1. Very likely to occur on all browsers.

Which AMP version is affected?

AMP Version 0.1 affected. Can be reproduced every time.

Stack Trace

resources-impl.js:1805 Uncaught TypeError: Cannot read property 'classList' of undefined at Mh (https://cdn.ampproject.org/v0.js:274:190) at https://cdn.ampproject.org/v0.js:274:155 at Array.forEach (native) at oh (https://cdn.ampproject.org/v0.js:274:113) at Eh (https://cdn.ampproject.org/v0.js:274:48) at bh.f.updateInViewport (https://cdn.ampproject.org/v0.js:255:406) at P.f.updateInViewport (https://cdn.ampproject.org/v0.js:146:62) at T (https://cdn.ampproject.org/v0/amp-carousel-0.1.js:29:222) at V (https://cdn.ampproject.org/v0/amp-carousel-0.1.js:30:94) at https://cdn.ampproject.org/v0/amp-carousel-0.1.js:28:106

Intention

The media attribute on the videos would be used to swap content for portrait and landscape dimensions. Surrounding carousel would only be visible on mobile devices and therefore hidden at a certain width.

p2er avatar Apr 10 '17 20:04 p2er

This issue hasn't been updated in awhile. @aghassemi Do you have any updates?

ampprojectbot avatar Oct 19 '17 23:10 ampprojectbot

This issue hasn't been updated in awhile. @aghassemi Do you have any updates?

ampprojectbot avatar Jan 22 '18 22:01 ampprojectbot

This issue hasn't been updated in awhile. @aghassemi Do you have any updates?

ampprojectbot avatar Jun 05 '18 16:06 ampprojectbot

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 30 '20 22:12 stale[bot]