Compare commits

..

No commits in common. "ada8122f6093573d837ddf650c7641ac07d3152a" and "679cc3e3f26dd278efa0b296d5745926eb64a1e7" have entirely different histories.

View file

@ -58,65 +58,11 @@ function recurseElement(page: Page, el: Element) {
}); });
} }
} }
if (["audio", "video", "img", "source", "iframe"].includes(el.name)) {
if (["audio", "video"].includes(el.name)) {
const sources = getSources(el);
for (const source of sources) {
if (source.attribs.src) {
checkUrl(page, source, source.attribs.src);
} else {
report.things.push({
type: "media-no-src",
description: getHtml(rawHtml, source),
});
}
}
}
if (["picture"].includes(el.name)) {
const sources = getSources(el);
for (const source of sources) {
if (source.attribs.srcset) {
// TODO: implementar srcset #3
} else {
report.things.push({
type: "media-no-src",
description: getHtml(rawHtml, source),
});
}
}
}
if (["img"].includes(el.name)) {
if (el.attribs.srcset) {
// TODO: implementar srcset #3
}
}
if (["audio", "video"].includes(el.name)) {
const sources = getSources(el);
if (sources.length > 0) {
for (const source of sources) {
if (source.attribs.src) {
checkUrl(page, source, source.attribs.src);
} else {
report.things.push({
type: "media-no-src",
description: getHtml(rawHtml, source),
});
}
}
} else {
if (el.attribs.src) {
checkUrl(page, el, el.attribs.src);
} else {
report.things.push({
type: "media-no-src",
description: getHtml(rawHtml, el),
});
}
}
}
if (["img", "iframe", "track"].includes(el.name)) {
if (el.attribs.src) { if (el.attribs.src) {
checkUrl(page, el, el.attribs.src); checkUrl(page, el, el.attribs.src);
} else if (el.attribs.srcset) {
// TODO: implementar srcset #3
} else { } else {
report.things.push({ report.things.push({
type: "media-no-src", type: "media-no-src",
@ -132,12 +78,6 @@ function recurseElement(page: Page, el: Element) {
} }
} }
function getSources(el: Element) {
return el.children.filter(
(c) => c.type === "tag" && c.name === "source"
) as Element[];
}
function checkUrl({ report, rawHtml }: Page, el: Element, url: string) { function checkUrl({ report, rawHtml }: Page, el: Element, url: string) {
if (isHttp(url)) { if (isHttp(url)) {
report.things.push({ report.things.push({