* Synchronizes any attribute mutations done on the real body to the layer. * This is to better simulate the body in CSS selectors. * @override
()
| 1039 | * @override |
| 1040 | */ |
| 1041 | update() { |
| 1042 | const {body} = this.doc_; |
| 1043 | const layer = this.layer_; |
| 1044 | const bodyAttrs = body.attributes; |
| 1045 | const layerAttrs = layer.attributes; |
| 1046 | for (let i = 0; i < bodyAttrs.length; i++) { |
| 1047 | const attr = bodyAttrs[i]; |
| 1048 | // Style is not copied because the fixed-layer must have very precise |
| 1049 | // styles to enable smooth scrolling. |
| 1050 | if (attr.name === 'style') { |
| 1051 | continue; |
| 1052 | } |
| 1053 | // Use cloneNode to get around invalid attribute names. Ahem, amp-bind. |
| 1054 | layerAttrs.setNamedItem(attr.cloneNode(false)); |
| 1055 | } |
| 1056 | for (let i = 0; i < layerAttrs.length; i++) { |
| 1057 | const {name} = layerAttrs[i]; |
| 1058 | if ( |
| 1059 | name === 'style' || |
| 1060 | name === LIGHTBOX_MODE_ATTR || |
| 1061 | body.hasAttribute(name) |
| 1062 | ) { |
| 1063 | continue; |
| 1064 | } |
| 1065 | layer.removeAttribute(name); |
| 1066 | i--; |
| 1067 | } |
| 1068 | } |
| 1069 | |
| 1070 | /** @override */ |
| 1071 | transferTo(fe, index, state) { |