diff --git a/src/browserlib/extract-cssdfn.mjs b/src/browserlib/extract-cssdfn.mjs index 5a63b3c9..c7c559d3 100644 --- a/src/browserlib/extract-cssdfn.mjs +++ b/src/browserlib/extract-cssdfn.mjs @@ -364,11 +364,19 @@ const extractTableDfn = table => { const cleanedLine = line.cloneNode(true); const annotations = cleanedLine.querySelectorAll(asideSelector); annotations.forEach(n => n.remove()); - return { - name: dfnLabel2Property(cleanedLine.querySelector(':first-child').textContent), - value: normalize(cleanedLine.querySelector('td:last-child').textContent) - }; - }); + const nameEl = cleanedLine.querySelector(':first-child'); + const valueEl = cleanedLine.querySelector('td:last-child'); + if (nameEl && valueEl) { + return { + name: dfnLabel2Property(nameEl.textContent), + value: normalize(valueEl.textContent) + }; + } + else { + return null; + } + }) + .filter(line => !!line); for (let prop of lines) { res[prop.name] = prop.value; } diff --git a/tests/extract-css.js b/tests/extract-css.js index aa2e189d..df726feb 100644 --- a/tests/extract-css.js +++ b/tests/extract-css.js @@ -1484,6 +1484,28 @@ that spans multiple lines */ type: 'type', prose: 'Determines the gradient center of the gradient.' }] + }, + + { + title: 'ignores empty lines in table definitions', + html: ` + + + + + + + + + + + + +
Name:background-color
Value:<color>
`, + css: [{ + "name": "background-color", + "value": "" + }] } ];