amphtml
amphtml copied to clipboard
Mutating bound src from a url to amp-state does not work
Description
In amp-render, I'm mutating the [src] from a url to amp-state, but there is no effect. The issue seems that the amp-state id is being interpreted as a URL and being appended to the base URL as such.
Reproduction Steps
- Check out PR https://github.com/ampproject/amphtml/pull/34512 and run
amp - Go to http://localhost:8000/examples/amp-render-bind.html
- Verify that all 3 amp-render instances load data from a URL
- Now click "Show Other Foods" button. This is changing the src to amp-state. No effect.
- Now click "Increment foo" button. Again no effect. It will update if you click "Show Fruit" or "Show vegetable"
While debugging, it seems to that isUrlAttribute function in url-rewrite.js is returning true when the value is an amp-state id.
Relevant Logs
No response
Browser(s) Affected
Chrome, Firefox, Safari
OS(s) Affected
All
Device(s) Affected
n/a
AMP Version Affected
latest
Based on offline conversation with @caroqliu this is an unsupported use case that we haven't needed so far. Closing.