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

Small clarification for how some natural dimensions get calculated. #1053

Merged
merged 1 commit into from
Dec 3, 2015
Merged

Small clarification for how some natural dimensions get calculated. #1053

merged 1 commit into from
Dec 3, 2015

Conversation

powdercloud
Copy link
Contributor

I like an explicit === null check better because it makes sure
this only triggers when there's an existing entry in the
table with a null value. I think in practice, while the
getNaturalDimensions function would fill in values for tags that
don't have an entry (say, amp-video), this doesn't happen
because it only gets called if hasNaturalDimensions returns false.
That's my reading anyways. No offense taken if I'm wrong or this
doesn't make things clearer.

@ampsauce
Copy link

ampsauce commented Dec 3, 2015

Tests passed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED

Commit: 6d255d84704b2c13b6269fd8c77a18d6267475c9
Build details: https://travis-ci.org/ampsauce/amphtml/builds/94540971

(Please note that this is a fully automated comment.)

* Set or cached browser natural dimensions for elements. The tagname
* initialized here will return true `hasNaturalDimensions`, even if yet to be
* calculated. Exported for testing.
* Set of cached browser natural dimensions for elements. The tagname
Copy link
Contributor

Choose a reason for hiding this comment

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

Both descriptions do not talk to the API. It should read simply "Returns the natural dimensions of an element with the specified name. This operation can only be completed for an element whitelisted by hasNaturalDimensions".

Or something like this. I'd certainly appreciate if you'd update this.

@ampsauce
Copy link

ampsauce commented Dec 3, 2015

Tests failed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: ba25107bdf737f99fbff306eafb59d04d6dc8edd
Build details: https://travis-ci.org/ampsauce/amphtml/builds/94547114

(Please note that this is a fully automated comment.)

@ampsauce
Copy link

ampsauce commented Dec 3, 2015

Tests passed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED

Commit: 6bfa1e511e1bd89bf39cdb680aca9072b00dc783
Build details: https://travis-ci.org/ampsauce/amphtml/builds/94547185

(Please note that this is a fully automated comment.)

@powdercloud
Copy link
Contributor Author

@dvoytenko Thank you, I put the assert in and massaged the prose some more. Please take another look.

* `hasNaturalDimensions` checks for membership in this set.
* `getNaturalDimensions` determines the dimensions for an element in the
* set and caches it.
* Exported for testing.
Copy link
Contributor

Choose a reason for hiding this comment

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

No need for "Exported for testing". It already says it below.

@dvoytenko dvoytenko added the LGTM label Dec 3, 2015
@dvoytenko dvoytenko self-assigned this Dec 3, 2015
@dvoytenko
Copy link
Contributor

LGTM with one small comment.

@ampsauce
Copy link

ampsauce commented Dec 3, 2015

Tests failed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: BUSTED

Commit: 84c2bf97345f74ed2df63e3af43e220dfa7df0d8
Build details: https://travis-ci.org/ampsauce/amphtml/builds/94555365

(Please note that this is a fully automated comment.)

Use an assertion to document that getNaturalDimensions
can't get called on an element that's not whitelisted by
hasNaturalDimensions.
@ampsauce
Copy link

ampsauce commented Dec 3, 2015

Tests passed. Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: CONFIRMED

Commit: 9ab4ce2
Build details: https://travis-ci.org/ampsauce/amphtml/builds/94560709

(Please note that this is a fully automated comment.)

@powdercloud
Copy link
Contributor Author

@dvoytenko Removed "Exported for testing" and updated the commit message.

@dvoytenko dvoytenko merged commit e600485 into ampproject:master Dec 3, 2015
@powdercloud powdercloud deleted the natural-dimensions branch April 8, 2016 22:13
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.

3 participants