| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). | 4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). |
| 5 * Copyright (C) 2009 Joseph Pecoraro | 5 * Copyright (C) 2009 Joseph Pecoraro |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * | 10 * |
| (...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1327 } | 1327 } |
| 1328 | 1328 |
| 1329 registerCustomElement("label", "dt-checkbox", { | 1329 registerCustomElement("label", "dt-checkbox", { |
| 1330 /** | 1330 /** |
| 1331 * @this {Element} | 1331 * @this {Element} |
| 1332 */ | 1332 */ |
| 1333 createdCallback: function() | 1333 createdCallback: function() |
| 1334 { | 1334 { |
| 1335 var root = WebInspector.createShadowRootWithCoreStyles(this); | 1335 var root = WebInspector.createShadowRootWithCoreStyles(this); |
| 1336 root.appendChild(WebInspector.Widget.createStyleElement("ui/checkbox
TextLabel.css")); | 1336 root.appendChild(WebInspector.Widget.createStyleElement("ui/checkbox
TextLabel.css")); |
| 1337 this.checkboxElement = this.createChild("input", "dt-checkbox-button
"); | 1337 var checkboxElement = createElementWithClass("input", "dt-checkbox-b
utton"); |
| 1338 this.checkboxElement.type = "checkbox"; | 1338 checkboxElement.type = "checkbox"; |
| 1339 root.createChild("content").select = ".dt-checkbox-button"; | 1339 root.appendChild(checkboxElement); |
| 1340 this.checkboxElement = checkboxElement; |
| 1341 |
| 1342 this.addEventListener("click", toggleCheckbox.bind(this)); |
| 1343 |
| 1344 /** |
| 1345 * @param {!Event} event |
| 1346 * @this {Node} |
| 1347 */ |
| 1348 function toggleCheckbox(event) |
| 1349 { |
| 1350 if (event.target !== checkboxElement && event.target !== this) |
| 1351 checkboxElement.click(); |
| 1352 } |
| 1353 |
| 1340 root.createChild("content"); | 1354 root.createChild("content"); |
| 1341 }, | 1355 }, |
| 1342 | 1356 |
| 1357 /** |
| 1358 * @param {string} color |
| 1359 * @this {Element} |
| 1360 */ |
| 1361 set backgroundColor(color) |
| 1362 { |
| 1363 this.checkboxElement.classList.add("dt-checkbox-colored"); |
| 1364 this.checkboxElement.style.backgroundColor = color; |
| 1365 }, |
| 1366 |
| 1367 /** |
| 1368 * @param {string} color |
| 1369 * @this {Element} |
| 1370 */ |
| 1371 set borderColor(color) |
| 1372 { |
| 1373 this.checkboxElement.classList.add("dt-checkbox-colored"); |
| 1374 this.checkboxElement.style.borderColor = color; |
| 1375 }, |
| 1376 |
| 1343 __proto__: HTMLLabelElement.prototype | 1377 __proto__: HTMLLabelElement.prototype |
| 1344 }); | 1378 }); |
| 1345 | 1379 |
| 1346 registerCustomElement("label", "dt-icon-label", { | 1380 registerCustomElement("label", "dt-icon-label", { |
| 1347 /** | 1381 /** |
| 1348 * @this {Element} | 1382 * @this {Element} |
| 1349 */ | 1383 */ |
| 1350 createdCallback: function() | 1384 createdCallback: function() |
| 1351 { | 1385 { |
| 1352 var root = WebInspector.createShadowRootWithCoreStyles(this); | 1386 var root = WebInspector.createShadowRootWithCoreStyles(this); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1437 // Due to the nature of regex, |items| array has matched elements on its
even indexes. | 1471 // Due to the nature of regex, |items| array has matched elements on its
even indexes. |
| 1438 var items = text.replace(regex, "\0$1\0").split("\0"); | 1472 var items = text.replace(regex, "\0$1\0").split("\0"); |
| 1439 for (var i = 0; i < items.length; ++i) { | 1473 for (var i = 0; i < items.length; ++i) { |
| 1440 var processedNode = i % 2 ? processor(items[i]) : this._runProcessor
(processorIndex + 1, items[i]); | 1474 var processedNode = i % 2 ? processor(items[i]) : this._runProcessor
(processorIndex + 1, items[i]); |
| 1441 container.appendChild(processedNode); | 1475 container.appendChild(processedNode); |
| 1442 } | 1476 } |
| 1443 | 1477 |
| 1444 return container; | 1478 return container; |
| 1445 } | 1479 } |
| 1446 } | 1480 } |
| OLD | NEW |