Skip to content
This repository was archived by the owner on Jan 10, 2020. It is now read-only.
This repository was archived by the owner on Jan 10, 2020. It is now read-only.

Feature request: Find deprecated styles in imported documents #91

@tomalec

Description

@tomalec

Currently Chrome throws a warning:

[Deprecation] Styling master document from stylesheets defined in HTML Imports is deprecated. Please refer to https://goo.gl/EGXzpw for possible migration paths.

But it does not mention the problematic document or styles. It would be nice to easily check those to make sure whether it's something that needs to be fixed or not.
I created a snipped to find them, but it would be nice to have it accessible easier.

function findStylesheetsInImportedDocs(doc, map) {
    map = map || {};
    // map = map || new Map();
    Array.prototype.forEach.call(doc.querySelectorAll('link[rel=import]'), (e) => {
        const importedDoc = e.import;
        if (importedDoc && !map[importedDoc]) {
            const styles = importedDoc.querySelectorAll('style,link[rel=stylesheet]');
            if (styles.length) {
                map[importedDoc.URL] = {
                    doc: importedDoc,
                    styles: styles
                };
                // map.set(importedDoc, styles);
            }
            findStylesheetsInImportedDocs(importedDoc, map)
        }
    });
    return map;
}
console.log(findStylesheetsInImportedDocs(document));

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions