| 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 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1311 */ | 1311 */ |
| 1312 function createRadioLabel(name, title, checked) | 1312 function createRadioLabel(name, title, checked) |
| 1313 { | 1313 { |
| 1314 var element = createElement("label", "dt-radio"); | 1314 var element = createElement("label", "dt-radio"); |
| 1315 element.radioElement.name = name; | 1315 element.radioElement.name = name; |
| 1316 element.radioElement.checked = !!checked; | 1316 element.radioElement.checked = !!checked; |
| 1317 element.createTextChild(title); | 1317 element.createTextChild(title); |
| 1318 return element; | 1318 return element; |
| 1319 } | 1319 } |
| 1320 | 1320 |
| 1321 /** |
| 1322 * @param {string=} title |
| 1323 * @param {boolean=} checked |
| 1324 * @return {!Element} |
| 1325 */ |
| 1326 function createCheckboxLabel(title, checked) |
| 1327 { |
| 1328 var element = createElement("label", "dt-checkbox"); |
| 1329 element.checkboxElement.checked = !!checked; |
| 1330 if (title !== undefined) { |
| 1331 element.textElement = element.createChild("div", "dt-checkbox-text"); |
| 1332 element.textElement.textContent = title; |
| 1333 } |
| 1334 return element; |
| 1335 } |
| 1336 |
| 1321 ;(function() { | 1337 ;(function() { |
| 1322 registerCustomElement("button", "text-button", HTMLButtonElement, { | 1338 registerCustomElement("button", "text-button", HTMLButtonElement, { |
| 1323 /** | 1339 /** |
| 1324 * @this {Element} | 1340 * @this {Element} |
| 1325 */ | 1341 */ |
| 1326 createdCallback: function() | 1342 createdCallback: function() |
| 1327 { | 1343 { |
| 1328 this.type = "button"; | 1344 this.type = "button"; |
| 1329 var root = this.createShadowRoot(); | 1345 var root = this.createShadowRoot(); |
| 1330 root.appendChild(WebInspector.View.createStyleElement("ui/textButton
.css")); | 1346 root.appendChild(WebInspector.View.createStyleElement("ui/textButton
.css")); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1354 * @suppressReceiverCheck | 1370 * @suppressReceiverCheck |
| 1355 * @this {Element} | 1371 * @this {Element} |
| 1356 */ | 1372 */ |
| 1357 function radioClickHandler(event) | 1373 function radioClickHandler(event) |
| 1358 { | 1374 { |
| 1359 if (this.radioElement.checked) | 1375 if (this.radioElement.checked) |
| 1360 return; | 1376 return; |
| 1361 this.radioElement.checked = true; | 1377 this.radioElement.checked = true; |
| 1362 this.radioElement.dispatchEvent(new Event("change")); | 1378 this.radioElement.dispatchEvent(new Event("change")); |
| 1363 } | 1379 } |
| 1380 |
| 1381 registerCustomElement("label", "dt-checkbox", HTMLLabelElement, { |
| 1382 /** |
| 1383 * @this {Element} |
| 1384 */ |
| 1385 createdCallback: function() |
| 1386 { |
| 1387 var root = this.createShadowRoot(); |
| 1388 root.appendChild(WebInspector.View.createStyleElement("ui/checkboxTe
xtLabel.css")); |
| 1389 this.checkboxElement = this.createChild("input", "dt-checkbox-button
"); |
| 1390 this.checkboxElement.type = "checkbox"; |
| 1391 root.createChild("content").select = ".dt-checkbox-button"; |
| 1392 root.createChild("content"); |
| 1393 } |
| 1394 }); |
| 1364 })(); | 1395 })(); |
| OLD | NEW |