Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliminate obsolete transformation of @-moz-document url-prefix() Firefox CSS hack into @supports (-moz-appearance:meterbar) #5801

Closed
westonruter opened this issue Jan 23, 2021 · 1 comment · Fixed by #5998
Assignees
Labels
CSS Groomed P2 Low priority Punted WS:Core Work stream for Plugin core
Milestone

Comments

@westonruter
Copy link
Member

Feature description

The @-moz-document CSS at-rule is now allowed in AMP as of ampproject/amphtml#26406 so we no longer need to transform this Firefox-specific CSS hack into another Firefox CSS hack, which was implemented in #5530.

Specifically, this code is no longer necessary:

if (
'-moz-document' === $css_item->atRuleName()
&&
'url-prefix()' === $css_item->atRuleArgs()
&&
in_array( 'supports', $options['allowed_at_rules'], true )
) {
// Replace `@-moz-document url-prefix()` with `@supports (-moz-appearance:meterbar)` as an alternative
// way to provide Firefox-specific style rules. This is a workaround since @-moz-document is not
// yet allowed in AMP, and this use of @supports is another recognized Firefox-specific CSS hack,
// per <http://browserhacks.com/#hack-8e9b5504d9fda44ec75169381b3c3157>.
// For adding @-moz-document to AMP, see <https://github.com/ampproject/amphtml/issues/26406>.
$new_css_item = new AtRuleBlockList( 'supports', '(-moz-appearance:meterbar)' );
$new_css_item->setContents( $css_item->getContents() );
$this->replace_inside_css_list( $css_list, $css_item, [ $new_css_item ] );
$css_item = $new_css_item; // To process_css_list below.
$sanitized = false;


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

Implementation brief

QA testing instructions

Demo

Changelog entry

@westonruter westonruter added the WS:Core Work stream for Plugin core label Jan 23, 2021
@westonruter westonruter added this to the v2.1 milestone Jan 23, 2021
@kmyram kmyram added P2 Low priority Groomed labels Feb 2, 2021
@westonruter westonruter modified the milestones: v2.1, v2.2 Feb 11, 2021
@westonruter westonruter modified the milestones: v2.2, v2.1 Mar 19, 2021
@westonruter westonruter self-assigned this Mar 19, 2021
@westonruter westonruter changed the title Eliminate obsolete transformation of @-moz-document url-prefix() Firefox CSS hack into @supports (-moz-appearance:meterbar) Eliminate obsolete transformation of @-moz-document url-prefix() Firefox CSS hack into @supports (-moz-appearance:meterbar) Apr 25, 2021
@westonruter westonruter self-assigned this Apr 25, 2021
@westonruter
Copy link
Member Author

westonruter commented Apr 25, 2021

QA Passed

When switching to Twenty Nineteen and I add a block with a drop cap:

<!-- wp:paragraph {"dropCap":true} -->
<p class="has-drop-cap">This has a drop cap!</p>
<!-- /wp:paragraph -->

On an AMP page I can see in the source:

@-moz-document url-prefix(){.entry .entry-content .has-drop-cap:not(:focus):first-letter{margin-top:.2em}}

And the page is valid AMP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS Groomed P2 Low priority Punted WS:Core Work stream for Plugin core
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants