Skip to content

Commit

Permalink
BaseElement: remove .getWin() (#36294)
Browse files Browse the repository at this point in the history
  • Loading branch information
samouri committed Oct 8, 2021
1 parent 0aef555 commit 9610c72
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 27 deletions.
7 changes: 0 additions & 7 deletions build-system/test-configs/forbidden-terms.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ const privateServiceFactory =
const shouldNeverBeUsed =
'Usage of this API is not allowed - only for internal purposes.';

const backwardCompat =
'This method must not be called. It is only retained ' +
'for backward compatibility during rollout.';

const realiasGetMode =
'Do not re-alias getMode or its return so it can be ' +
'DCE\'d. Use explicitly like "getMode().localDev" instead.';
Expand Down Expand Up @@ -588,9 +584,6 @@ const forbiddenTermsGlobal = {
message: 'Use src/open-window-dialog',
allowlist: ['src/open-window-dialog.js'],
},
'\\.getWin\\(': {
message: backwardCompat,
},
'/\\*\\* @type \\{\\!Element\\} \\*/': {
message: 'Use assertElement instead of casting to !Element.',
allowlist: [
Expand Down
4 changes: 2 additions & 2 deletions docs/building-an-amp-extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,9 @@ class AmpInstagram extends AMP.BaseElement {
// ...
/** @override */
createPlaceholderCallback() {
const placeholder = this.getWin().document.createElement('div');
const placeholder = this.win.document.createElement('div');
placeholder.setAttribute('placeholder', '');
const image = this.getWin().document.createElement('amp-img');
const image = this.win.document.createElement('amp-img');
// This is always the same URL that is actually used inside of the embed.
// This lets us avoid loading the image twice and make use of browser cache.

Expand Down
9 changes: 0 additions & 9 deletions src/base-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,15 +319,6 @@ export class BaseElement {
return this.element.getLayoutSize();
}

/**
* DO NOT CALL. Retained for backward compat during rollout.
* @public
* @return {!Window}
*/
getWin() {
return this.win;
}

/**
* Returns the associated ampdoc. Only available when `buildCallback` and
* going forward. It throws an exception before `buildCallback`.
Expand Down
9 changes: 0 additions & 9 deletions src/service/ampdoc-impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,15 +326,6 @@ export class AmpDoc {
return this.parent_;
}

/**
* DO NOT CALL. Retained for backward compat during rollout.
* @return {!Window}
* @deprecated Use `ampdoc.win` instead.
*/
getWin() {
return this.win;
}

/** @return {!Signals} */
signals() {
return this.signals_;
Expand Down

0 comments on commit 9610c72

Please sign in to comment.