diff --git a/check.sh b/check.sh index f6355fa..391c571 100755 --- a/check.sh +++ b/check.sh @@ -43,7 +43,8 @@ fi # A collapsed disclosure is valid supporting content, but provenance inside one # is not visible by default. Remove only collapsed details subtrees; an open -# disclosure remains visible unless one of its ancestors is collapsed. +# disclosure remains visible unless one of its ancestors is collapsed. Media +# fallback subtrees are likewise hidden when the browser supports the element. VISIBLE_BODY=$(printf '%s\n' "${RENDERED_BODY}" | awk ' { @@ -54,7 +55,11 @@ VISIBLE_BODY=$(printf '%s\n' "${RENDERED_BODY}" | tag=tag char if (char == ">") { lower=tolower(tag) - if (lower ~ /^])/) { + if (lower ~ /^<(video|audio)([[:space:]>])/) media_depth++ + else if (lower ~ /^<\/(video|audio)([[:space:]>])/) { + if (media_depth > 0) media_depth-- + } + else if (lower ~ /^])/) { attributes=lower gsub(/"[^"]*"/, "", attributes) parent_hidden=(details_depth > 0 && hidden[details_depth]) @@ -67,7 +72,7 @@ VISIBLE_BODY=$(printf '%s\n' "${RENDERED_BODY}" | details_depth-- } } - else if (!hidden[details_depth]) printf "%s", tag + else if (!hidden[details_depth] && media_depth == 0) printf "%s", tag in_tag=0 tag="" } @@ -76,11 +81,13 @@ VISIBLE_BODY=$(printf '%s\n' "${RENDERED_BODY}" | in_tag=1 tag=char } - else if (!hidden[details_depth]) printf "%s", char + else if (!hidden[details_depth] && media_depth == 0) printf "%s", char } } ') +hidden_content_guidance='move ## Tracking and ## Attribution outside collapsed
or