fix: nested stylesheets should have absolute URLs (#1533)
* Replace relative URLs with absolute URLs when stringifying stylesheets * Add test to show desired behavior for imported stylesheets from seperate directory * Rename `absoluteToStylesheet` to `absolutifyURLs` and call it once after stringifying imported stylesheet * Don't create the intermediary array of the spread operator * Formalize that `stringifyRule` should expect a sheet href * Ensure a <style> element can also import and gets it's url absolutized * Handle case where non imported stylesheet has relative urls that need to be absolutified * Clarify in test files where jpegs are expected to appear in absolutified urls * Move absolutifyURLs call for import rules out of trycatch * Add a benchmarking test for stringifyStylesheet * Avoid the duplication on how to fall back --------- Co-authored-by: Eoghan Murray <eoghan@getthere.ie> Co-authored-by: eoghanmurray <eoghanmurray@users.noreply.github.com>
This commit is contained in:
@@ -67,7 +67,7 @@ export class StylesheetManager {
|
||||
styles.push({
|
||||
styleId,
|
||||
rules: Array.from(sheet.rules || CSSRule, (r, index) => ({
|
||||
rule: stringifyRule(r),
|
||||
rule: stringifyRule(r, sheet.href),
|
||||
index,
|
||||
})),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user