Skip to content

amp-bind validator clashes with default styling with empty class #8933

@kul3r4

Description

@kul3r4

I was trying to fix the validation errors that I get from product page in development mode as @rudygalfi noted that the page has a lot of errors. I pushed my changes here. However I noticed that some errors are still there in case I want to use an empty class.
My code is:
<li option="M" class="" selected [class]="(product[product.selectedColor].sizes['M'] != 'unavailable') ? '' : 'unavailable'">M</li>
and it becomes:
<li option="M" class="i-amphtml-error i-amphtml-element-error" selected="" [class]="(product[product.selectedColor].sizes['M'] != 'unavailable') ? '' : 'unavailable'" role="option" aria-selected="true" tabindex="0" error-message="amp-bind: Default value for [class] does not match first expression result (). This can result in unexpected behavior after the next state change.​​​"
What would be the best way to have an empty class?
I also think, no matter if the class is empty or not, the fact that amp runtime adds class like i-amphtml-error i-amphtml-element-error is confusing the validator.
@kmh287 @choumx Could you help with this?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions