Update allowed tags/attributes from spec in amphtml 1910161528000#3619
Update allowed tags/attributes from spec in amphtml 1910161528000#3619westonruter merged 7 commits intodevelopfrom
Conversation
…-src meta tag merging
9d0abc1 to
d0b13f1
Compare
includes/class-amp-theme-support.php
Outdated
| // Merge meta amp-script-src elements. | ||
| $first_meta_amp_script_src = array_shift( $meta_amp_script_srcs ); | ||
| foreach ( $meta_amp_script_srcs as $meta_amp_script_src ) { | ||
| $first_meta_amp_script_src->setAttribute( |
There was a problem hiding this comment.
Seems wasteful to constantly rewrite this attribute (although I ignore how much processing happens in the DOM abtraction). Would make more sense to collect and merge as a variable, and then write (i.e. setAttribute()) only once.
Also, storing the first element, and then iterating over the rest is a rather arbitrary logic. Using array_reduce() would be conceptually clearer.
There was a problem hiding this comment.
Yeah, I think calling setAttribute multiple times may not be a concern like it would be in the browser, since there are no layout calculations being performed. Nevertheless, minimizing writes and redundant string concatenations seems beneficial. To that end, I think actually array_reduce() isn't the best fit here because it would do more concatenation operations than required, while all we need to do is push onto a single copy of an array. At the same time, we also need to remove the elements from the DOM, and that doesn't seem super clean to do in an array_reduce().
Please take a look at 03d587a.
Previously #3239.
./bin/amphtml-update.shChangelog
scriptforamp-script, eliminating requirement that external scripts be used. Take note of the requiredmeta[name=amp-script-src]tag, but the plugin will automatically merge multiple instances of themetatag in theheadinto the one required. A newamp_generate_script_hash()function is provided to aid with generating the sha384 script hashes. See demonstration plugin for usage. ✨amp-audio.smoothingattribute toamp-orientation-observer.max-ageattribute toamp-script.amp-experiment story extension .json script. Allowscriptinamp-story-grid-layer.Details
( PREV_VERSION=1910071803120; THIS_VERSION=1910161528000; git checkout $THIS_VERSION; git diff $PREV_VERSION...$THIS_VERSION -w -- $( git ls-files | grep '.protoascii' ); git checkout - > /dev/null )Compare 1910071803120..1910161528000