diff --git a/src/browserlib/extract-cssdfn.mjs b/src/browserlib/extract-cssdfn.mjs index 295f69c6..89d7c5af 100644 --- a/src/browserlib/extract-cssdfn.mjs +++ b/src/browserlib/extract-cssdfn.mjs @@ -435,11 +435,19 @@ const extractDlDfns = dl => { })); } else { - // Markup does not seem to contain IDs, let's extract the text instead - const value = normalize(cleanedLine.querySelector('td:last-child').textContent); - res = value.split(',').map(name => Object.assign({ - name: normalize(name.replace(/'/g, '')) - })); + // Markup does not use definitions, let's look for an ID in the dt itself + const dt = dl.querySelector('dt'); + if (dt.id) { + res = [{ + name: normalize(dt.textContent.replace(/'/g, '')), + href: getAbsoluteUrl(dt) + }]; + } + else { + res = dt.textContent.split(',').map(name => Object.assign({ + name: normalize(name.replace(/'/g, '')) + })); + } } const properties = [...dl.querySelectorAll('dd table tr')] diff --git a/tests/extract-css.js b/tests/extract-css.js index 780d1ec8..83aae24e 100644 --- a/tests/extract-css.js +++ b/tests/extract-css.js @@ -1525,6 +1525,59 @@ that spans multiple lines */ "name": "background-color", "value": "" }] + }, + + { + title: 'extracts the definition ID from a dt element when needed (SVG11)', + html: `
+
+
‘lighting-color’
+
+ + + + + + + + + +
Value:  currentColor |
<color> [<icccolor>] |
inherit
Initial:  white
+
+
+
`, + css: [{ + "name": "‘lighting-color’", + "href": "about:blank#lighting-color", + "value": "currentColor | [] | inherit", + "initial": "white" + }] + }, + + { + title: 'does not choke on the absence of a definition ID when dt elements are used (SVG11)', + html: `
+
+
‘lighting-color’
+
+ + + + + + + + + +
Value:  currentColor |
<color> [<icccolor>] |
inherit
Initial:  white
+
+
+
`, + css: [{ + "name": "‘lighting-color’", + "value": "currentColor | [] | inherit", + "initial": "white" + }] } ];