Skip to main content

Search and Top Navigation

#6753 closed enhancement (duplicate)

Opened December 15, 2010 05:06PM UTC

Closed December 15, 2010 06:40PM UTC

Last modified December 15, 2010 06:40PM UTC

Reinstate HTML labels (and query highlighting)

Reported by: draenor Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.core Version: 1.8.7
Keywords: Cc:
Blocked by: Blocking:
Description

Reinstate (as in jQuery UI 1.8.2) HTML labels when plotting the result. Thus allowing e.g., rendering objects such as


{
  value: test
  label: <b>te</b>st
}

assuming that the "te" is the search term.

Proposed fix:

_renderItem: function( ul, item) {
                return $( "<li></li>" )
                    .data( "item.autocomplete", item )
                    .append( "<a>" + item.label + "</a>" )
                    .appendTo( ul );
            }


Even better would be to support this highlighting the query term directly in the autocomplete module.

Proposed fix 2

(requires the first fix)

  var termregex = new RegExp( "(" + term + ")", "i" ),
  this.label = this.label.replace( termregex, "<b>$1</b>" );
Attachments (0)
Change History (2)

Changed December 15, 2010 06:40PM UTC by scottgonzalez comment:1

resolution: → duplicate
status: newclosed

Changed December 15, 2010 06:40PM UTC by scottgonzalez comment:2

Duplicate of #5918.