mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
Merge b56b15e03a
into d6bcd3fb0b
This commit is contained in:
commit
cc2d1797f7
3 changed files with 30 additions and 1 deletions
|
@ -232,7 +232,12 @@ void HTMLParser::run(HTMLTokenizer::StopAtInsertionPoint stop_at_insertion_point
|
||||||
break;
|
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();
|
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