Bug 147301 - Web Inspector: Start using Node.prototype.append
Summary: Web Inspector: Start using Node.prototype.append
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nikita Vasilyev
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-07-25 21:06 PDT by Nikita Vasilyev
Modified: 2015-07-27 15:29 PDT (History)
8 users (show)

See Also:


Attachments
Patch (36.80 KB, patch)
2015-07-25 21:14 PDT, Nikita Vasilyev
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nikita Vasilyev 2015-07-25 21:06:34 PDT
https://bugs.webkit.org/show_bug.cgi?id=74648 introduced Node.prototype.append, among a few other new DOM methods.

Convert the following code:

    element.appendChild(document.createTextNode(aString))

to

    element.append(aString)
Comment 1 Radar WebKit Bug Importer 2015-07-25 21:06:58 PDT
<rdar://problem/22000352>
Comment 2 Nikita Vasilyev 2015-07-25 21:14:44 PDT
Created attachment 257527 [details]
Patch
Comment 3 WebKit Commit Bot 2015-07-25 22:47:54 PDT
Comment on attachment 257527 [details]
Patch

Clearing flags on attachment: 257527

Committed r187402: <http://trac.webkit.org/changeset/187402>
Comment 4 WebKit Commit Bot 2015-07-25 22:47:58 PDT
All reviewed patches have been landed.  Closing bug.
Comment 5 Joseph Pecoraro 2015-07-27 15:29:26 PDT
Comment on attachment 257527 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=257527&action=review

Nice!

> Source/WebInspectorUI/UserInterface/Models/Breakpoint.js:399
>          checkboxLabel.appendChild(checkboxElement);
> -        checkboxLabel.appendChild(document.createTextNode(this._sourceCodeLocation.displayLocationString()));
> +        checkboxLabel.append(this._sourceCodeLocation.displayLocationString());

Cases like this, where we have multiple appends in a row, we can reduce to a single append call:

From:

    checkboxLabel.appendChild(checkboxElement);
    checkboxLabel.append(text);

To:

    checkboxLabel.append(checkboxElement, text);

> Source/WebInspectorUI/UserInterface/Views/BoxModelDetailsSectionRow.js:219
> +                boxElement.append(widthElement, " \u00D7 ", heightElement);

Which I see you did here.

> Source/WebInspectorUI/UserInterface/Views/CSSStyleDetailsSidebarPanel.js:59
>                  labelElement.appendChild(checkboxElement);
> -                labelElement.appendChild(document.createTextNode(label));
> +                labelElement.append(label);

Another case.