mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-11 01:22:43 +02:00
When the HTML parser blocks on a synchronous external script, run a separate tokenizer over the unparsed input and issue speculative fetches for the resources it finds (script src, link rel=stylesheet|preload, img src), with <base href> tracking and template/foreign-content skipping. Also fills in the previously-stubbed "consume a preloaded resource" algorithm and the document's "map of preloaded resources", so that <link rel="preload"> followed by a matching consumer deduplicates to a single fetch.
34 lines
910 B
C++
34 lines
910 B
C++
/*
|
|
* Copyright (c) 2026, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/FlyString.h>
|
|
#include <AK/Optional.h>
|
|
#include <AK/Vector.h>
|
|
#include <LibWeb/Forward.h>
|
|
#include <LibWeb/HTML/Parser/HTMLToken.h>
|
|
|
|
namespace Web::HTML {
|
|
|
|
// https://html.spec.whatwg.org/multipage/parsing.html#speculative-mock-element
|
|
struct SpeculativeMockElement {
|
|
// local name
|
|
FlyString local_name;
|
|
|
|
// attribute list
|
|
Vector<HTMLToken::Attribute> attribute_list;
|
|
|
|
// FIXME: namespace and children — populate when speculative tree-building is implemented.
|
|
|
|
Optional<String> attribute(FlyString const& name) const;
|
|
};
|
|
|
|
// https://html.spec.whatwg.org/multipage/parsing.html#create-a-speculative-mock-element
|
|
SpeculativeMockElement create_a_speculative_mock_element(FlyString tag_name, Vector<HTMLToken::Attribute> attributes);
|
|
|
|
}
|