Changeset 53366 in webkit


Ignore:
Timestamp:
Jan 16, 2010 3:30:01 PM (14 years ago)
Author:
timothy@apple.com
Message:

Use String.trim() instead of a regex in the Web Inspector.

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

Reviewed by George Staikos.

  • inspector/front-end/ElementsPanel.js:

(WebInspector.ElementsPanel.prototype.performSearch): Use .trim().

  • inspector/front-end/ObjectPropertiesSection.js:

(WebInspector.ObjectPropertyTreeElement.prototype.applyExpression): Ditto.

  • inspector/front-end/ProfileView.js:
  • inspector/front-end/SourceFrame.js:

(WebInspector.SourceFrame.prototype._evalSelectionInCallFrame): Ditto.

  • inspector/front-end/StylesSidebarPane.js:

(WebInspector.StylePropertyTreeElement.prototype): Ditto.

  • inspector/front-end/utilities.js:

(String.prototype.trimLeadingWhitespace): Removed.
(String.prototype.trimTrailingWhitespace): Removed.
(String.prototype.trimWhitespace): Removed.

Location:
trunk/WebCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r53365 r53366  
     12010-01-16  Timothy Hatcher  <timothy@apple.com>
     2
     3        Use String.trim() instead of a regex in the Web Inspector.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=33765
     6
     7        Reviewed by George Staikos.
     8
     9        * inspector/front-end/ElementsPanel.js:
     10        (WebInspector.ElementsPanel.prototype.performSearch): Use .trim().
     11        * inspector/front-end/ObjectPropertiesSection.js:
     12        (WebInspector.ObjectPropertyTreeElement.prototype.applyExpression): Ditto.
     13        * inspector/front-end/ProfileView.js:
     14        * inspector/front-end/SourceFrame.js:
     15        (WebInspector.SourceFrame.prototype._evalSelectionInCallFrame): Ditto.
     16        * inspector/front-end/StylesSidebarPane.js:
     17        (WebInspector.StylePropertyTreeElement.prototype): Ditto.
     18        * inspector/front-end/utilities.js:
     19        (String.prototype.trimLeadingWhitespace): Removed.
     20        (String.prototype.trimTrailingWhitespace): Removed.
     21        (String.prototype.trimWhitespace): Removed.
     22
    1232010-01-16  Oliver Hunt  <oliver@apple.com>
    224
  • trunk/WebCore/inspector/front-end/ElementsPanel.js

    r53232 r53366  
    266266        this.searchCanceled();
    267267
    268         const whitespaceTrimmedQuery = query.trimWhitespace();
     268        const whitespaceTrimmedQuery = query.trim();
    269269        if (!whitespaceTrimmedQuery.length)
    270270            return;
  • trunk/WebCore/inspector/front-end/ObjectPropertiesSection.js

    r52544 r53366  
    234234    applyExpression: function(expression, updateInterface)
    235235    {
    236         expression = expression.trimWhitespace();
     236        expression = expression.trim();
    237237        var expressionLength = expression.length;
    238238        var self = this;
     
    252252            }
    253253        };
    254         InjectedScriptAccess.setPropertyValue(this.property.parentObjectProxy, this.property.name, expression.trimWhitespace(), callback);
     254        InjectedScriptAccess.setPropertyValue(this.property.parentObjectProxy, this.property.name, expression.trim(), callback);
    255255    }
    256256}
  • trunk/WebCore/inspector/front-end/ProfileView.js

    r53328 r53366  
    234234        this.searchCanceled();
    235235
    236         query = query.trimWhitespace();
     236        query = query.trim();
    237237
    238238        if (!query.length)
  • trunk/WebCore/inspector/front-end/SourceFrame.js

    r52820 r53366  
    445445            return;
    446446
    447         var expression = selection.getRangeAt(0).toString().trimWhitespace();
     447        var expression = selection.getRangeAt(0).toString().trim();
    448448        WebInspector.panels.scripts.evaluateInSelectedCallFrame(expression, false, "console", function(result, exception) {
    449449            WebInspector.showConsole();
  • trunk/WebCore/inspector/front-end/StylesSidebarPane.js

    r52547 r53366  
    13111311        var section = this.treeOutline.section;
    13121312        var elementsPanel = WebInspector.panels.elements;
    1313         var styleTextLength = styleText.trimWhitespace().length;
     1313        var styleTextLength = styleText.trim().length;
    13141314        if (!styleTextLength && updateInterface) {
    13151315            if (this._newProperty) {
     
    13621362        }
    13631363
    1364         InjectedScriptAccess.applyStyleText(this.style.id, styleText.trimWhitespace(), this.name, callback);
     1364        InjectedScriptAccess.applyStyleText(this.style.id, styleText.trim(), this.name, callback);
    13651365    }
    13661366}
  • trunk/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js

    r52547 r53366  
    243243            return;
    244244
    245         this.nameElement.textContent = this.property.name.trimWhitespace();
     245        this.nameElement.textContent = this.property.name.trim();
    246246
    247247        var context = { expanded: this.expanded };
     
    266266    applyExpression: function(expression, updateInterface)
    267267    {
    268         expression = expression.trimWhitespace();
     268        expression = expression.trim();
    269269
    270270        if (!expression)
  • trunk/WebCore/inspector/front-end/utilities.js

    r52495 r53366  
    332332{
    333333    return this.replace(/[\s\xA0]+/g, " ");
    334 }
    335 
    336 String.prototype.trimLeadingWhitespace = function()
    337 {
    338     return this.replace(/^[\s\xA0]+/g, "");
    339 }
    340 
    341 String.prototype.trimTrailingWhitespace = function()
    342 {
    343     return this.replace(/[\s\xA0]+$/g, "");
    344 }
    345 
    346 String.prototype.trimWhitespace = function()
    347 {
    348     return this.replace(/^[\s\xA0]+|[\s\xA0]+$/g, "");
    349334}
    350335
Note: See TracChangeset for help on using the changeset viewer.