@@ -2,6 +2,7 @@ import {matchEmoji, matchMention, matchIssue} from '../../utils/match.ts';
22import { emojiString } from '../emoji.ts' ;
33import { svg } from '../../svg.ts' ;
44import { parseIssueHref } from '../../utils.ts' ;
5+ import { createElementFromAttrs , createElementFromHTML } from '../../utils/dom.ts' ;
56
67type Issue = { id : number ; title : string ; state : 'open' | 'closed' ; pull_request ?: { draft : boolean ; merged : boolean } } ;
78function getIssueIcon ( issue : Issue ) {
@@ -92,14 +93,14 @@ export function initTextExpander(expander) {
9293 const ul = document . createElement ( 'ul' ) ;
9394 ul . classList . add ( 'suggestions' ) ;
9495 for ( const issue of matches ) {
95- const li = document . createElement ( 'li' ) ;
96+ const li = createElementFromAttrs ( 'li' , {
97+ role : 'option' ,
98+ 'data-value' : `${ key } ${ issue . id } ` ,
99+ } ) ;
96100 li . classList . add ( 'tw-flex' , 'tw-gap-2' ) ;
97- li . setAttribute ( 'role' , 'option' ) ;
98- li . setAttribute ( 'data-value' , `${ key } ${ issue . id } ` ) ;
99101
100- const icon = document . createElement ( 'div' ) ;
101- icon . innerHTML = svg ( getIssueIcon ( issue ) , 16 , [ 'text' , getIssueColor ( issue ) ] . join ( ' ' ) ) . trim ( ) ;
102- li . append ( icon . firstChild ) ;
102+ const icon = svg ( getIssueIcon ( issue ) , 16 , [ 'text' , getIssueColor ( issue ) ] . join ( ' ' ) ) ;
103+ li . append ( createElementFromHTML ( icon ) ) ;
103104
104105 const id = document . createElement ( 'span' ) ;
105106 id . classList . add ( 'id' ) ;
0 commit comments