Skip to content

Transform CSS selectors according to sanitizer HTML element to AMP component conversions #1094

@westonruter

Description

@westonruter

In Twenty Ten without AMP, the header looks like this:

image

In AMP, however, it looks like this:

image

Notice the white gap appearing in AMP where a border appears on the non-AMP version. This is due in part to Twenty Ten having a stylesheet with:

#branding img {
    border-top: 4px solid #000;
    border-bottom: 1px solid #000;
    display: block;
    float: left;
}

When the image sanitizer converts img to amp-img, this style selector then stops working as expected. Really, the style sanitizer should be converting img elements in stylesheets to amp-img. All such conversions which are done by the sanitizers should be communicated down to the style sanitizer so that it can make the necessary replacements when it processes a stylesheet.

In other words, I don't think this is something that a theme necessarily should be expected to fix by switching to use a CSS class name or manipulate with a custom sanitizer (e.g. #1074).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions