Ensure no-large-element styling is removed

This commit is contained in:
Raymond Hill 2020-10-25 08:05:26 -04:00
parent f122e0b34b
commit ed2ad57dca
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 2 additions and 1 deletions

View File

@ -157,7 +157,6 @@ const loadImage = async function(elem) {
const loadMany = function(elems) {
for ( const elem of elems ) {
elem.removeAttribute(largeMediaElementAttribute);
switch ( elem.localName ) {
case 'audio':
case 'video':
@ -183,6 +182,7 @@ const onMouseClick = function(ev) {
: [ ev.target ];
for ( const elem of elems ) {
if ( elem.matches(largeMediaElementSelector) === false ) { continue; }
elem.removeAttribute(largeMediaElementAttribute);
if ( mediaNotLoaded(elem) ) {
toLoad.push(elem);
}
@ -244,6 +244,7 @@ vAPI.loadAllLargeMedia = function() {
const toLoad = [];
for ( const elem of document.querySelectorAll(largeMediaElementSelector) ) {
elem.removeAttribute(largeMediaElementAttribute);
if ( mediaNotLoaded(elem) ) {
toLoad.push(elem);
}