in WordPress is responsive with 100% width, so this infers fixed-layout. * In AMP, the amp-audio's default height is inferred from the browser. */ $new_attributes['width'] = 'auto'; // @todo Make sure poster and artwork attributes are HTTPS. $new_node = AMP_DOM_Utils::create_node( $this->dom, 'amp-audio', $new_attributes ); foreach ( $child_nodes as $child_node ) { $new_node->appendChild( $child_node ); if ( ! ( $child_node instanceof DOMElement ) || ! $child_node->hasAttribute( 'fallback' ) ) { $old_node->appendChild( $child_node->cloneNode( true ) ); } } // Make sure the updated src and poster are applied to the original. foreach ( [ 'src', 'poster', 'artwork' ] as $attr_name ) { if ( $new_node->hasAttribute( $attr_name ) ) { $old_node->setAttribute( $attr_name, $new_node->getAttribute( $attr_name ) ); } } /* * If the node has at least one valid source, replace the old node with it. * Otherwise, just remove the node. * * @todo Add a fallback handler. * See: https://github.com/ampproject/amphtml/issues/2261 */ if ( empty( $sources ) ) { $this->remove_invalid_child( $node, [ 'code' => AMP_Tag_And_Attribute_Sanitizer::ATTR_REQUIRED_BUT_MISSING, 'attributes' => [ 'src' ], 'spec_name' => 'amp-audio', ] ); } else { $node->parentNode->replaceChild( $new_node, $node ); if ( $this->args['add_noscript_fallback'] ) { // Preserve original node in noscript for no-JS environments. $this->append_old_node_noscript( $new_node, $old_node, $this->dom ); } } $this->did_convert_elements = true; } } /** * "Filter" HTML attributes for elements. * * @since 0.2 * * @param string[] $attributes { * Attributes. * * @type string $src Audio URL - Empty if HTTPS required per $this->args['require_https_src'] * @type int $width