Skip to content

Commit

Permalink
cl/375586004 Allow i-amphtml-layout-awaiting-size class in FLUID layo…
Browse files Browse the repository at this point in the history
…ut (#34533)

Co-authored-by: Justin Ridgewell <[email protected]>
  • Loading branch information
antiphoton and jridgewell authored May 25, 2021
1 parent a7b2332 commit 30a80a6
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions validator/js/engine/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -3851,6 +3851,13 @@ function getLayoutSizeDefinedClass() {
return 'i-amphtml-layout-size-defined';
}

/**
* @return {string}
*/
function getLayoutAwaitingSizeClass() {
return "i-amphtml-layout-awaiting-size";
}

/**
* @param {!generated.AmpLayout.Layout} layout
* @return {boolean}
Expand All @@ -3866,6 +3873,14 @@ function isLayoutSizeDefined(layout) {
layout === generated.AmpLayout.Layout.RESPONSIVE);
}

/**
* @param {!generated.AmpLayout.Layout} layout
* @return {boolean}
*/
function isLayoutAwaitingSize(layout) {
return layout === generated.AmpLayout.Layout.FLUID;
}

/**
* @param {string} layout
* @return {!generated.AmpLayout.Layout}
Expand Down Expand Up @@ -4439,6 +4454,10 @@ function validateSsrLayout(
// i-amphtml-layout-size-defined
validInternalClasses[getLayoutSizeDefinedClass()] = 0;
}
if (isLayoutAwaitingSize(layout)) {
// i-amphtml-layout-awaiting-size
validInternalClasses[getLayoutAwaitingSizeClass()] = 0;
}
const classes = classAttr.split(/[\s+]/);
for (const classToken of classes) {
if (googString./*OK*/ startsWith(classToken, 'i-amphtml-') &&
Expand Down

0 comments on commit 30a80a6

Please sign in to comment.