0

for some reason the amp component amp-lightbox does not work when i do not regard the sequence of the included amp-components.

unrecognized AMP element: Did you forget to include it via <script.....

Of course i didn't forget to include it, but as far I switch the order of the include files, then it works.

Not working:

<script async custom-element="amp-list" src="https://cdn.ampproject.org/v0/amp-list-0.1.js"></script>    
<script async custom-element="amp-lightbox" src="https://cdn.ampproject.org/v0/amp-lightbox-0.1.js"></script>

and working example:

<script async custom-element="amp-lightbox" src="https://cdn.ampproject.org/v0/amp-lightbox-0.1.js"></script>    
<script async custom-element="amp-list" src="https://cdn.ampproject.org/v0/amp-list-0.1.js"></script>

I am also not using amp-list in conjuction with amp-lightbox...

Christian Felix
  • 644
  • 1
  • 9
  • 28

1 Answers1

1

Since the async attribute is used, the order shouldn't matter. Each script will execute as soon as it finishes downloading, regardless of the order it appears in. Not an AMP tagged question, but this one has some very good additional explanations regarding it.

smlync
  • 369
  • 9
  • 15
  • that was my first thougt also, the files shouln'd depent on each other while getting loaded. The question is, why the above example does not work, when the sequence of the both files gets swiched? Anyway the link is really helpful, thank you. – Christian Felix Apr 25 '18 at 15:21
  • I tested with list first on a page of mine, and it worked without issue, so maybe it's a false positive and there's another error on the page somewhere causing it? I've had good luck with the [Chrome AMP Validator extension](https://chrome.google.com/webstore/detail/amp-validator/nmoffdblmcmgeicmolmhobpoocbbmknc) pointing out mistakes for me, maybe that might help if you're not already using it? – smlync Apr 25 '18 at 15:37
  • the amp validator indicate that the page if valid (green, no errors at all). I suppose there are some other problems involved. – Christian Felix Apr 25 '18 at 15:56