-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
amp-audio default layout only works when script is cached #100
Comments
|
No special handling as in a layout type that would just let an element use
|
That is not what I meant and while it would be cool I think it wouldn't I meant: require specifying size.
|
However, having a default size map (constant) in core would be fine with me.
|
After thinking about it, I don't think a default size map would work, there just too much variance. Instead, I'll have a PR that uses "natural" as a keyword for layout, height, or width that triggers a natural-size calculation based on the amp-xxx element name; essentially @dvoytenko #1 generic sizing idea. |
If we go for "natural" - we don't really need to calculate width/height, right? E.g. we can do something like this: NATURAL_FIXED_SIZE_ELEMENTS = {'amp-audio': true}; // I'm about to throw an exception because layout/width/height not defined, instead: |
In other words our main requirement that element's size doesn't change after loading. There's no risk of this with amp-audio, amp-pixel and such elements so we fulfill our requirements and we just need to express it in the code so that we don't trip up any exceptions. |
It was my assumption that an element needs to reserve its height upfront such that any elements afterwards do not change their position. If we just squash the exception its height would still not be known until the extension js has loaded and calculated the default. Is that not an issue? The PR also allows an element to use a different layout value, but still have |
Yep, sorry. Running ahead of myself. |
So, I agree. We could have a map that would allow a function for an element name that would return default layout, width and height. |
/cc @rgthree @cramforce
For non-upgraded amp-audio it will have no chance to download the script and execute getBrowserAudioDefaultDimensions so it will fail in cases where amp-audio.js is not available quickly enough.
I only see two options:
The text was updated successfully, but these errors were encountered: