You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On SSR generated amp pages are some nodes with same id, which breaks the logic of generated css rules with display: block, so some images wouldn't be displayed.
Reason
Because of decreasing the counter transformedNodesCounter on following line, we've got on some nodes duplicated ids generated:
DK-Stern
changed the title
SSR: Duplicated ids on nodes with attributes 'media', 'heights' and 'sizes'
SSR: Duplicated ids on nodes with attributes 'media', 'heights' or 'sizes'
Feb 18, 2022
DK-Stern
changed the title
SSR: Duplicated ids on nodes with attributes 'media', 'heights' or 'sizes'
SSR: Duplicated ids if there are nodes with attributes 'media', 'heights' or 'sizes'
Feb 18, 2022
DK-Stern
changed the title
SSR: Duplicated ids if there are nodes with attributes 'media', 'heights' or 'sizes'
SSR: Duplicated ids in rendered markup, if there are nodes with attributes 'media', 'heights' or 'sizes'
Feb 18, 2022
…e are nodes with attributes 'media', 'heights' or 'sizes'" (#1303)
* fix duplicated ids
* Added transformation test and refactored fix.
* Adjusted input.html of transformation test with more realistic example
…e are nodes with attributes 'media', 'heights' or 'sizes'" (#1303)
* fix duplicated ids
* Added transformation test and refactored fix.
* Adjusted input.html of transformation test with more realistic example
Issue
On SSR generated amp pages are some nodes with same id, which breaks the logic of generated css rules with
display: block
, so some images wouldn't be displayed.Reason
Because of decreasing the counter
transformedNodesCounter
on following line, we've got on some nodes duplicated ids generated:amp-toolbox/packages/optimizer/lib/transformers/ApplyCommonAttributes.js
Line 220 in b367a2d
I cannot say why this happen, but we can ensure an easy fix to preventing of generating duplicated ids.
Solutions
First possible solution
One possible solution would be, to add the generated id to the Set of
ids
before line 269 to find collisions.amp-toolbox/packages/optimizer/lib/transformers/ApplyCommonAttributes.js
Lines 265 to 270 in b367a2d
That would look like this:
Second possible solution
A other possible solution would be, to remove the else condition where the counter
transformedNodesCounter
will be decreased:amp-toolbox/packages/optimizer/lib/transformers/ApplyCommonAttributes.js
Lines 219 to 221 in b367a2d
PR
For the first solution i've created a PR: #1303
The text was updated successfully, but these errors were encountered: