-
Notifications
You must be signed in to change notification settings - Fork 384
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
Remove 'sizes' attribute for <amp-iframe> and <amp-video>; add appropriate layout #937
Changes from 19 commits
87e8501
936f302
6848541
9348ed3
11405b3
f95c0be
6bd4326
613f16f
878e023
037f6ef
a233b59
011e478
c5c46ac
e344418
adce308
81e20c5
bc5c407
ece0f86
02db229
f983029
f5a3c73
c347f2b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,7 +119,6 @@ private function filter_attributes( $attributes ) { | |
case 'alt': | ||
case 'class': | ||
case 'srcset': | ||
case 'sizes': | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kienstra We need to add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That sounds good, @delawski. If it's alright, I'll work on this in several hours. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @delawski @kienstra Adding a We'll need to allow There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, @westonruter. The 2 commits below convert |
||
case 'on': | ||
case 'attribution': | ||
$out[ $name ] = $value; | ||
|
@@ -130,6 +129,10 @@ private function filter_attributes( $attributes ) { | |
$out[ $name ] = $this->sanitize_dimension( $value, $name ); | ||
break; | ||
|
||
case 'data-amp-layout': | ||
$out['layout'] = $value; | ||
break; | ||
|
||
default: | ||
break; | ||
} | ||
|
@@ -204,7 +207,10 @@ private function adjust_and_replace_nodes_in_array_map( $node_lists ) { | |
private function adjust_and_replace_node( $node ) { | ||
$old_attributes = AMP_DOM_Utils::get_node_attributes_as_assoc_array( $node ); | ||
$new_attributes = $this->filter_attributes( $old_attributes ); | ||
$new_attributes = $this->enforce_sizes_attribute( $new_attributes ); | ||
$this->add_or_append_attribute( $new_attributes, 'class', 'amp-wp-enforced-sizes' ); | ||
if ( empty( $new_attributes['layout'] ) && ! empty( $new_attributes['height'] ) && ! empty( $new_attributes['width'] ) ) { | ||
$new_attributes['layout'] = 'intrinsic'; | ||
} | ||
if ( $this->is_gif_url( $new_attributes['src'] ) ) { | ||
$this->did_convert_elements = true; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 3 lines are copied from
enforce_sizes_attribute()
.