Changeset 35632 in webkit


Ignore:
Timestamp:
Aug 7, 2008 8:55:53 PM (16 years ago)
Author:
timothy@apple.com
Message:

The search is only performed if the field contains more than 3
letters or if Enter is pressed.

Search is now performed through a keyup event.

Added a WebInspector.lastQuery to remember the last query and not
perform it again (eg. the user hits a modifier key).

https://bugs.webkit.org/show_bug.cgi?id=18548

Reviewed by Timothy Hatcher.

  • page/inspector/inspector.html: Removed the onsearch and incremental attributes
  • page/inspector/inspector.js:
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r35629 r35632  
     12008-08-07  Anthony Ricaud  <rik24d@gmail.com>
     2
     3        The search is only performed if the field contains more than 3
     4        letters or if Enter is pressed.
     5
     6        Search is now performed through a keyup event.
     7
     8        Added a WebInspector.lastQuery to remember the last query and not
     9        perform it again (eg. the user hits a modifier key).
     10
     11        https://bugs.webkit.org/show_bug.cgi?id=18548
     12
     13        Reviewed by Timothy Hatcher.
     14
     15        * page/inspector/inspector.html: Removed the onsearch and incremental
     16        attributes
     17        * page/inspector/inspector.js:
     18
    1192008-08-07  Steve Falkenburg  <sfalken@apple.com>
    220
  • trunk/WebCore/page/inspector/inspector.html

    r34631 r35632  
    7474    <div id="toolbar">
    7575        <div class="toolbar-item flexable-space"></div>
    76         <div class="toolbar-item"><input id="search" type="search" results="20" incremental="incremental" onsearch="WebInspector.performSearch(this.value)"><div id="search-toolbar-label" class="toolbar-label"></div></div>
     76        <div class="toolbar-item"><input id="search" type="search" results="20"><div id="search-toolbar-label" class="toolbar-label"></div></div>
    7777    </div>
    7878    <div id="main">
  • trunk/WebCore/page/inspector/inspector.js

    r35616 r35632  
    341341
    342342    document.getElementById("search-toolbar-label").textContent = WebInspector.UIString("Search");
     343    var searchField = document.getElementById("search");
     344    searchField.addEventListener("keyup", this.performSearch.bind(this), false);
    343345
    344346    if (platform === "mac-leopard")
     
    975977}
    976978
    977 WebInspector.performSearch = function(query)
    978 {
     979WebInspector.performSearch = function(event)
     980{
     981    var query = event.target.value;
     982
    979983    if (!query || !query.length) {
    980984        this.showingSearchResults = false;
    981985        return;
    982986    }
     987
     988    var forceSearch = event.keyIdentifier === "Enter";
     989    if(!forceSearch && query.length < 3)
     990        return;
     991
     992    if (!forceSearch && this.lastQuery && this.lastQuery === query)
     993        return;
     994    this.lastQuery = query;
    983995
    984996    var resultsContainer = document.getElementById("searchResults");
Note: See TracChangeset for help on using the changeset viewer.