MCPcopy
hub / github.com/ampproject/amphtml / initMediaAttrs_

Method initMediaAttrs_

src/custom-element.js:1016–1034  ·  view source on GitHub ↗

@private

()

Source from the content-addressed store, hash-verified

1014
1015 /** @private */
1016 initMediaAttrs_() {
1017 const hasMediaAttrs =
1018 this.hasAttribute('media') ||
1019 (this.hasAttribute('sizes') &&
1020 !this.hasAttribute('disable-inline-width')) ||
1021 this.hasAttribute('heights');
1022 const hadMediaAttrs = !!this.mediaQueryProps_;
1023 const win = this.ownerDocument.defaultView;
1024 if (hasMediaAttrs != hadMediaAttrs && win) {
1025 if (hasMediaAttrs) {
1026 this.mediaQueryProps_ = new MediaQueryProps(win, () =>
1027 this.applyMediaAttrs_()
1028 );
1029 this.applyMediaAttrs_();
1030 } else {
1031 this.disposeMediaAttrs_();
1032 }
1033 }
1034 }
1035
1036 /** @private */
1037 disposeMediaAttrs_() {

Callers 1

connectedCallbackMethod · 0.95

Calls 2

applyMediaAttrs_Method · 0.95
disposeMediaAttrs_Method · 0.95

Tested by

no test coverage detected