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

URL rewrite in templates #1645

Merged
merged 1 commit into from
Jan 29, 2016
Merged

Conversation

dvoytenko
Copy link
Contributor

No description provided.

* Reconstructs the string expression for this srcset.
* @return {string}
*/
stringify() {
Copy link
Contributor

Choose a reason for hiding this comment

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

This would generally be called #toString, so that coercion will work correctly:

var obj = {
  toString() { return 'test'; }
};
String(obj); // => 'test'
'' + obj; // => 'test'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't really like coercion to be honest. Usually I try to steer away. You feel strongly about it, I'll switch.

@dvoytenko
Copy link
Contributor Author

@cramforce changes have been made. PTAL.

@dvoytenko
Copy link
Contributor Author

@cramforce freundlich Ping!

function resolveImageUrlAttr(attrValue, baseUrl, isProxy) {
const src = parseUrl(resolveRelativeUrl(attrValue, baseUrl));

// URLs such as `data:` or proxy URLs are returned as is.
Copy link
Member

Choose a reason for hiding this comment

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

Need to document here why this is safe.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. I made it explicit to data:

@cramforce
Copy link
Member

LGTM with one comment. If the comment is correct. Otherwise not LGTM :)

dvoytenko added a commit that referenced this pull request Jan 29, 2016
@dvoytenko dvoytenko merged commit fa90642 into ampproject:master Jan 29, 2016
@dvoytenko dvoytenko deleted the templ-urlrepl branch January 29, 2016 21:57
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.

4 participants