Selaa lähdekoodia

LibWeb: Use file's URL as document's URL when loading markdown files

A markdown file gets loaded as an inline content document by
`create_document_for_inline_content()`, for which the default document
URL is "about:error". That breaks the fragment links.

Overriding "about:error" URL by passing the URL of the just loaded
markdown file as an argument to `HTMLParser::run()` ensures that the URL
of the document is as expected.
ronak69 1 vuosi sitten
vanhempi
commit
05e53b5fd3
1 muutettua tiedostoa jossa 1 lisäystä ja 1 poistoa
  1. 1 1
      Userland/Libraries/LibWeb/DOM/DocumentLoading.cpp

+ 1 - 1
Userland/Libraries/LibWeb/DOM/DocumentLoading.cpp

@@ -78,7 +78,7 @@ static WebIDL::ExceptionOr<JS::NonnullGCPtr<DOM::Document>> load_markdown_docume
                 return;
 
             auto parser = HTML::HTMLParser::create(document, markdown_document->render_to_html(extra_head_contents), "utf-8");
-            parser->run(document.url());
+            parser->run(url);
         };
 
         auto process_body_error = [](auto) {