Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: chrome/browser/resources/md_history/searched_label.js

Issue 2578013002: [MD History] clang-format all javascript. (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 Polymer({ 5 Polymer({
6 is: 'history-searched-label', 6 is: 'history-searched-label',
7 7
8 properties: { 8 properties: {
9 // The text to show in this label. 9 // The text to show in this label.
10 title: String, 10 title: String,
(...skipping 16 matching lines...) Expand all
27 if (this.searchTerm == '' || this.searchTerm == null) { 27 if (this.searchTerm == '' || this.searchTerm == null) {
28 this.textContent = titleText; 28 this.textContent = titleText;
29 return; 29 return;
30 } 30 }
31 31
32 var re = new RegExp(quoteString(this.searchTerm), 'gim'); 32 var re = new RegExp(quoteString(this.searchTerm), 'gim');
33 var match; 33 var match;
34 this.textContent = ''; 34 this.textContent = '';
35 while (match = re.exec(titleText)) { 35 while (match = re.exec(titleText)) {
36 if (match.index > i) 36 if (match.index > i)
37 this.appendChild(document.createTextNode( 37 this.appendChild(
38 titleText.slice(i, match.index))); 38 document.createTextNode(titleText.slice(i, match.index)));
39 i = re.lastIndex; 39 i = re.lastIndex;
40 // Mark the highlighted text in bold. 40 // Mark the highlighted text in bold.
41 var b = document.createElement('b'); 41 var b = document.createElement('b');
42 b.textContent = titleText.substring(match.index, i); 42 b.textContent = titleText.substring(match.index, i);
43 this.appendChild(b); 43 this.appendChild(b);
44 } 44 }
45 if (i < titleText.length) 45 if (i < titleText.length)
46 this.appendChild( 46 this.appendChild(document.createTextNode(titleText.slice(i)));
47 document.createTextNode(titleText.slice(i)));
48 }, 47 },
49 }); 48 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_history/router.js ('k') | chrome/browser/resources/md_history/side_bar.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698