wpt / css / css-text / hanging-punctuation / hanging-punctuation-first-ascii-quote.html

Status: PASS | Duration: 10ms | Subtests: 1/1 | Open test on wpt.live | Open ref on wpt.live | wpt.fyi

/css/css-text/hanging-punctuation/hanging-punctuation-first-ascii-quote.html

<!DOCTYPE html>
<meta charset="UTF-8">
<title>CSS Text: hanging-punctuation first with ASCII quote characters</title>
<link rel="author" title="Tim Nguyen" href="https://github.com/nt1m">
<link rel="help" href="https://drafts.csswg.org/css-text-3/#hanging-punctuation-property">
<link rel="match" href="reference/hanging-punctuation-first-ascii-quote-ref.html">
<meta name="assert" content="hanging-punctuation: first causes U+0022 QUOTATION MARK and U+0027 APOSTROPHE to hang at the start of the first line.">
<link rel="stylesheet" href="/fonts/ahem.css">
<style>
    body { font-family: 'Ahem'; color:green }
    .hang { hanging-punctuation: first; margin:1em }
</style>
<div class="hang">"This should hang.</div>
<div class="hang">'This should hang.</div>

/css/css-text/hanging-punctuation/reference/hanging-punctuation-first-ascii-quote-ref.html

<!DOCTYPE html>
<meta charset="UTF-8">
<title>CSS Reference</title>
<link rel="stylesheet" href="/fonts/ahem.css">
<style>
    body { font-family: 'Ahem'; color:green }
    .hang { margin:1em }
</style>
<div class="hang" id="ref1">"This should hang.</div>
<div class="hang" id="ref2">'This should hang.</div>
<script>
function setIndent(id, char) {
    const probe = document.createElement('span');
    probe.textContent = char;
    probe.style.visibility = 'hidden';
    document.body.appendChild(probe);
    const width = probe.getBoundingClientRect().width;
    document.body.removeChild(probe);
    document.getElementById(id).style.textIndent = `-${width}px`;
}
setIndent('ref1', '"');
setIndent('ref2', "'");
</script>