Skip to content

Roll forward: Implement anchor href expand on document click with X/Y support#5053

Merged
jridgewell merged 66 commits intoampproject:masterfrom
google:a4a_clickUrlExpand
Sep 20, 2016
Merged

Roll forward: Implement anchor href expand on document click with X/Y support#5053
jridgewell merged 66 commits intoampproject:masterfrom
google:a4a_clickUrlExpand

Conversation

@keithwrightbos
Copy link
Copy Markdown
Contributor

Attempt to roll forward PR #4773 which was reverted due to test failures which have subsequently been addressed.

keithwrightbos and others added 30 commits August 30, 2016 14:20
…nt target rewrite for shadowDom elements; was not binding whether capture to click handler properly. Test coverage for fixes to be added shortly
…y offset, look for existence of event.path and use event.target which should match host element
The previous change was made in error (wrong branch).
…nt target rewrite for shadowDom elements; was not binding whether capture to click handler properly. Test coverage for fixes to be added shortly
…y offset, look for existence of event.path and use event.target which should match host element
…nt target rewrite for shadowDom elements; was not binding whether capture to click handler properly. Test coverage for fixes to be added shortly
…y offset, look for existence of event.path and use event.target which should match host element
@dvoytenko dvoytenko self-assigned this Sep 19, 2016
* Enforces synchronous evaluation.
* @param {string} startEvent
* @param {string=} endEvent
* @return {string|undefined} undefined if API is not available, empty string
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Update return type.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

@dvoytenko
Copy link
Copy Markdown
Contributor

@keithwrightbos thanks a lot! Couple of smaller comments from my side and LGTM. I'm leaving the final LGTM to @jridgewell

@keithwrightbos
Copy link
Copy Markdown
Contributor Author

@jridgewell PTAL. Note this also addresses issue #5113

Copy link
Copy Markdown
Contributor

@jridgewell jridgewell left a comment

Choose a reason for hiding this comment

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

Nitpicks left, LGTM.

const timingInfo = this.win_['performance']
&& this.win_['performance']['timing'];
getTimingDataAsync_(startEvent, endEvent) {
let metric = this.getTimingDataSync_(startEvent, endEvent);
Copy link
Copy Markdown
Contributor

@jridgewell jridgewell Sep 20, 2016

Choose a reason for hiding this comment

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

do not need to unnecessarily wait for load

We're returning a promise, though. Even if it's resolved sync (Promise.resolve(metric)), the caller can't get it's value until ~.1ms later. Adding another sync resolved Promise (loadPromise(this.win_)) only adds another ~.1ms delay.

This can definitely be in another PR, though.

// Metric is not yet available. Retry after a delay.
return loadPromise(this.win_).then(() => {
metric = this.getTimingDataSync_(startEvent, endEvent);
return metric === '' ? undefined : metric;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nitpick: metric || undefined

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done, collapse to return this.getTimingDataSync_(startEvent, endEvent);

if (!navigationInfo || navigationInfo[attribute] === undefined) {
// PerformanceNavigation interface is not supported or attribute is not implemented.
return Promise.resolve();
return ;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nitpick: no spacing before ;.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

@keithwrightbos
Copy link
Copy Markdown
Contributor Author

@jridgewell PTAL. Thanks

@jridgewell
Copy link
Copy Markdown
Contributor

LGTM.

@jridgewell jridgewell merged commit 6ee4876 into ampproject:master Sep 20, 2016
@jridgewell jridgewell deleted the a4a_clickUrlExpand branch September 20, 2016 20:37
jridgewell added a commit to jridgewell/amphtml that referenced this pull request Sep 23, 2016
This "rollsback" ampproject#5053, since it won't cleanly revert. To rollforward, revert only this commit.

/cc @keithwrightbos
jridgewell added a commit that referenced this pull request Sep 23, 2016
This "rollsback" #5053, since it won't cleanly revert. To rollforward, revert only this commit.

/cc @keithwrightbos
cramforce added a commit to cramforce/amphtml that referenced this pull request Sep 28, 2016
A more limited (to A4A) exposure of the work in ampproject#5053.

- Implements ability to provide a white list of replacements for a given operation.
- Moves the click handler from a global position to A4A specific code.
- Switches to simpler click position implementation (just `pageX/Y`). This is currently incorrect, but will be correct after A4A moves to friendly iframes from ShadowDOM.

Should help with ampproject#5205 and ampproject#4078. Related to ampproject#4891.
cramforce added a commit to cramforce/amphtml that referenced this pull request Oct 7, 2016
A more limited (to A4A) exposure of the work in ampproject#5053.

- Implements ability to provide a white list of replacements for a given operation.
- Moves the click handler from a global position to A4A specific code.
- Switches to simpler click position implementation (just `pageX/Y`). This is currently incorrect, but will be correct after A4A moves to friendly iframes from ShadowDOM.

Should help with ampproject#5205 and ampproject#4078. Related to ampproject#4891.
cramforce added a commit that referenced this pull request Oct 11, 2016
…A. (#5275)

A more limited (to A4A) exposure of the work in #5053.

- Implements ability to provide a white list of replacements for a given operation.
- Moves the click handler from a global position to A4A specific code.
- Switches to simpler click position implementation (just `pageX/Y`).
dreamofabear pushed a commit to dreamofabear/amphtml that referenced this pull request Oct 12, 2016
…A. (ampproject#5275)

A more limited (to A4A) exposure of the work in ampproject#5053.

- Implements ability to provide a white list of replacements for a given operation.
- Moves the click handler from a global position to A4A specific code.
- Switches to simpler click position implementation (just `pageX/Y`).
mityaha pushed a commit to brightcove-archive/ooyala_amphtml that referenced this pull request Nov 30, 2016
… support (ampproject#5053)

* Implement anchor href expand on document click with X/Y support

* Fixes after full stack testing: need to look at event path due to event target rewrite for shadowDom elements; was not binding whether capture to click handler properly.  Test coverage for fixes to be added shortly

* update tests; instead of looking for shadowRoot boundary to update x/y offset, look for existence of event.path and use event.target which should match host element

* slight refactor for readability

* fix javadoc error

* Update amp-ad-network-doubleclick-impl.md

* Reverting doc changes

The previous change was made in error (wrong branch).

* changes in response to PR review

* update var substititions documentation

* make capture listener actually use capture!

* remove unnecessary else clause

* fix pull conflicts

* Fixes after full stack testing: need to look at event path due to event target rewrite for shadowDom elements; was not binding whether capture to click handler properly.  Test coverage for fixes to be added shortly

* update tests; instead of looking for shadowRoot boundary to update x/y offset, look for existence of event.path and use event.target which should match host element

* slight refactor for readability

* fix javadoc error

* changes in response to PR review

* update var substititions documentation

* make capture listener actually use capture!

* remove unnecessary else clause

* fix test failure due to issue after merge

* address PR comments

* Implement anchor href expand on document click with X/Y support

* Fixes after full stack testing: need to look at event path due to event target rewrite for shadowDom elements; was not binding whether capture to click handler properly.  Test coverage for fixes to be added shortly

* update tests; instead of looking for shadowRoot boundary to update x/y offset, look for existence of event.path and use event.target which should match host element

* slight refactor for readability

* fix javadoc error

* changes in response to PR review

* update var substititions documentation

* make capture listener actually use capture!

* remove unnecessary else clause

* fix pull conflicts

* Fixes after full stack testing: need to look at event path due to event target rewrite for shadowDom elements; was not binding whether capture to click handler properly.  Test coverage for fixes to be added shortly

* update tests; instead of looking for shadowRoot boundary to update x/y offset, look for existence of event.path and use event.target which should match host element

* slight refactor for readability

* changes in response to PR review

* fix test failure due to issue after merge

* Revert "reenable history tests (ampproject#4758)"

This reverts commit 1375883.

* Revert "Reverting doc changes"

This reverts commit 8d8c6dd.

* Revert "Small Validator Updates, including blacklisting __amp_source_origin for URLs. (ampproject#4781)"

This reverts commit bffeb2d.

* Revert "Remove video-id from the amp-youtube extension runtime. This attr had (ampproject#4507)"

This reverts commit 8d1799d.

* Revert unintentionally added files.

* Revert unintentionally added file.

* Fix test failure from latest merge

* Fix conflict and lint errors

* Fix lint errors, type check failures, and test failures

* Fix test failures

* Remove Math.random override causing breakages in other tests

* PR comment feedback

* PR review changes

* PR code review

* PR review

* Address error in issue ampproject#5113

* PR review
mityaha pushed a commit to brightcove-archive/ooyala_amphtml that referenced this pull request Nov 30, 2016
This "rollsback" ampproject#5053, since it won't cleanly revert. To rollforward, revert only this commit.

/cc @keithwrightbos
Lith pushed a commit to Lith/amphtml that referenced this pull request Dec 22, 2016
…A. (ampproject#5275)

A more limited (to A4A) exposure of the work in ampproject#5053.

- Implements ability to provide a white list of replacements for a given operation.
- Moves the click handler from a global position to A4A specific code.
- Switches to simpler click position implementation (just `pageX/Y`).
Lith pushed a commit to Lith/amphtml that referenced this pull request Dec 22, 2016
…A. (ampproject#5275)

A more limited (to A4A) exposure of the work in ampproject#5053.

- Implements ability to provide a white list of replacements for a given operation.
- Moves the click handler from a global position to A4A specific code.
- Switches to simpler click position implementation (just `pageX/Y`).
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