mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-24 16:40:21 +00:00
Merge b56b15e03a
into 001df24935
This commit is contained in:
commit
ff0bcc6db9
3 changed files with 30 additions and 1 deletions
|
@ -232,7 +232,12 @@ void HTMLParser::run(HTMLTokenizer::StopAtInsertionPoint stop_at_insertion_point
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Set element as target element if url fragment matches its id.
|
||||
auto url_fragment = m_document->url().fragment();
|
||||
GC::Ptr<DOM::Element> target_element;
|
||||
if (url_fragment.has_value() && (target_element = m_document->get_element_by_id(url_fragment.value()))){
|
||||
m_document->set_target_element(target_element);
|
||||
}
|
||||
flush_character_insertions();
|
||||
}
|
||||
|
||||
|
|
12
Tests/LibWeb/Ref/expected/iframe-target-element.html
Normal file
12
Tests/LibWeb/Ref/expected/iframe-target-element.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<iframe id="iframe"></iframe>
|
||||
|
||||
<script>
|
||||
const IFRAME_DATA_SRC = `data:text/html,
|
||||
|
||||
<p id="foo">This should be green.</p>
|
||||
<style>%23foo { color: green; }<\/style>#foo`.replace('\n', '');
|
||||
|
||||
const iframe = document.getElementById("iframe");
|
||||
iframe.src = IFRAME_DATA_SRC;
|
||||
</script>
|
12
Tests/LibWeb/Ref/input/iframe-target-element.html
Normal file
12
Tests/LibWeb/Ref/input/iframe-target-element.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="match" href="../expected/iframe-target-element.html" />
|
||||
<iframe id="iframe"></iframe>
|
||||
|
||||
<script>
|
||||
const IFRAME_DATA_SRC = `data:text/html,
|
||||
<style>:target { color: green; }<\/style>
|
||||
<p id="foo">This should be green.</p>#foo`.replace('\n', '');
|
||||
|
||||
const iframe = document.getElementById("iframe");
|
||||
iframe.src = IFRAME_DATA_SRC;
|
||||
</script>
|
Loading…
Reference in a new issue