@@ -163,9 +163,45 @@ function _renderIssue(issue) {
163163
164164 issueEl . classList . add ( ( issue . deprecated ? "warning" : "information" ) ) ;
165165
166+ if ( issue . nodes ) {
167+ issueEl . append ( _renderOccurrences ( issue ) ) ;
168+ }
169+
166170 return issueEl ;
167171}
168172
173+ function _renderOccurrences ( { nodes } ) {
174+ const occurrencesEl = document . createElement ( "section" ) ;
175+ occurrencesEl . classList . add ( "occurrences" ) ;
176+
177+ const nodelistEl = document . createElement ( "ul" ) ;
178+ for ( const { id, className, nodeName } of nodes ) {
179+ const nodeEl = document . createElement ( "li" ) ;
180+ nodeEl . append ( _renderTerm ( nodeName . toLowerCase ( ) , [ "node-name" ] ) ) ;
181+
182+ if ( id ) {
183+ nodeEl . append ( _renderTerm ( `#${ id } ` , [ "node-id" ] ) ) ;
184+ } else if ( className . length ) {
185+ nodeEl . append ( _renderTerm ( `.${ className . replace ( / \s + / g, "." ) } ` , [ "node-class" ] ) ) ;
186+ }
187+ nodelistEl . append ( nodeEl ) ;
188+ }
189+
190+ if ( nodes . length !== 1 ) {
191+ const summaryEl = document . createElement ( "summary" ) ;
192+ summaryEl . textContent = `${ nodes . length } occurrences` ;
193+
194+ const detailsEl = document . createElement ( "details" ) ;
195+ detailsEl . append ( summaryEl , nodelistEl ) ;
196+
197+ occurrencesEl . append ( detailsEl ) ;
198+ } else {
199+ occurrencesEl . append ( nodelistEl ) ;
200+ }
201+
202+ return occurrencesEl ;
203+ }
204+
169205function _renderSubject ( issue ) {
170206 const { type, url } = issue ;
171207 const subjectEl = document . createElement ( "span" ) ;
0 commit comments