Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!doctype html>
<title>CSS Test: ::first-line updates after inserting text node at start of paragraph</title>
<link rel="author" title="Tim Nguyen" href="https://github.com/nt1m">
<link rel="match" href="first-line-insert-text-node-dynamic-ref.html">
<style>
p { width: 100px; }
p::first-line { text-decoration: underline; color: #CB000F; }
</style>
<p id="test">This is a test paragraph. You can insert extra text at its start; the ::first-line styles should be updated to accommodate this new text.</p>
<script>
document.body.offsetTop;
var para = document.getElementById('test');
para.insertBefore(document.createTextNode('I am adding a new text. '), para.firstChild);
</script>