Skip to content
This repository was archived by the owner on Jul 23, 2024. It is now read-only.

Commit 2653ad9

Browse files
committed
Insert mdn link into each issue
1 parent 456b303 commit 2653ad9

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

extension/lib/webcompat.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,12 @@ class WebCompat {
335335
: state === _SUPPORT_STATE.UNSUPPORTED;
336336
});
337337
const { deprecated, experimental } = this._getStatus(database, ...terms);
338+
const url = this._getMDNLink(database, ...terms);
338339

339340
return {
340341
database,
341342
terms,
343+
url,
342344
deprecated,
343345
experimental,
344346
unsupportedBrowsers,
@@ -425,6 +427,22 @@ class WebCompat {
425427
return summaries;
426428
}
427429

430+
_getMDNLink(compatNode, ...terms) {
431+
// In case of CSS value of particular CSS property such as `space-evenly` of
432+
// `align-content`, the link is not in the compat table of the CSS value.
433+
// Thus, we get the link while tracing the parents.
434+
for (; terms.length > 0; terms.pop()) {
435+
const compatTable = this._getCompatTable(compatNode, terms);
436+
const url = compatTable ? compatTable.mdn_url : null;
437+
438+
if (url) {
439+
return url;
440+
}
441+
}
442+
443+
return null;
444+
}
445+
428446
_getTermPath(database, ...terms) {
429447
const terminal = terms.pop();
430448
const compatNode = this._getCompatNode(database, terms);

0 commit comments

Comments
 (0)