| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> | 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> |
| 4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1204 function linkifyValue(value) { | 1204 function linkifyValue(value) { |
| 1205 var rewrittenHref = node.resolveURL(value); | 1205 var rewrittenHref = node.resolveURL(value); |
| 1206 if (rewrittenHref === null) { | 1206 if (rewrittenHref === null) { |
| 1207 var span = createElement('span'); | 1207 var span = createElement('span'); |
| 1208 setValueWithEntities.call(this, span, value); | 1208 setValueWithEntities.call(this, span, value); |
| 1209 return span; | 1209 return span; |
| 1210 } | 1210 } |
| 1211 value = value.replace(closingPunctuationRegex, '$&\u200B'); | 1211 value = value.replace(closingPunctuationRegex, '$&\u200B'); |
| 1212 if (value.startsWith('data:')) | 1212 if (value.startsWith('data:')) |
| 1213 value = value.trimMiddle(60); | 1213 value = value.trimMiddle(60); |
| 1214 return node.nodeName().toLowerCase() === 'a' ? | 1214 var link = node.nodeName().toLowerCase() === 'a' ? |
| 1215 UI.createExternalLink(rewrittenHref, value, '', true) : | 1215 UI.createExternalLink(rewrittenHref, value, '', true) : |
| 1216 Components.Linkifier.linkifyURL(rewrittenHref, value, '', undefined, u
ndefined, true); | 1216 Components.Linkifier.linkifyURL(rewrittenHref, value, '', undefined, u
ndefined, true); |
| 1217 link[Elements.ElementsTreeElement.HrefSymbol] = rewrittenHref; |
| 1218 return link; |
| 1217 } | 1219 } |
| 1218 | 1220 |
| 1219 if (node && (name === 'src' || name === 'href')) { | 1221 if (node && (name === 'src' || name === 'href')) { |
| 1220 attrValueElement.appendChild(linkifyValue.call(this, value)); | 1222 attrValueElement.appendChild(linkifyValue.call(this, value)); |
| 1221 } else if ( | 1223 } else if ( |
| 1222 node && (node.nodeName().toLowerCase() === 'img' || node.nodeName().toLo
werCase() === 'source') && | 1224 node && (node.nodeName().toLowerCase() === 'img' || node.nodeName().toLo
werCase() === 'source') && |
| 1223 name === 'srcset') { | 1225 name === 'srcset') { |
| 1224 var sources = value.split(','); | 1226 var sources = value.split(','); |
| 1225 for (var i = 0; i < sources.length; ++i) { | 1227 for (var i = 0; i < sources.length; ++i) { |
| 1226 if (i > 0) | 1228 if (i > 0) |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1549 | 1551 |
| 1550 this._node.resolveToObject('', scrollIntoViewCallback); | 1552 this._node.resolveToObject('', scrollIntoViewCallback); |
| 1551 } | 1553 } |
| 1552 | 1554 |
| 1553 _editAsHTML() { | 1555 _editAsHTML() { |
| 1554 var promise = Common.Revealer.revealPromise(this.node()); | 1556 var promise = Common.Revealer.revealPromise(this.node()); |
| 1555 promise.then(() => UI.actionRegistry.action('elements.edit-as-html').execute
()); | 1557 promise.then(() => UI.actionRegistry.action('elements.edit-as-html').execute
()); |
| 1556 } | 1558 } |
| 1557 }; | 1559 }; |
| 1558 | 1560 |
| 1561 Elements.ElementsTreeElement.HrefSymbol = Symbol('ElementsTreeElement.Href'); |
| 1562 |
| 1559 Elements.ElementsTreeElement.InitialChildrenLimit = 500; | 1563 Elements.ElementsTreeElement.InitialChildrenLimit = 500; |
| 1560 | 1564 |
| 1561 // A union of HTML4 and HTML5-Draft elements that explicitly | 1565 // A union of HTML4 and HTML5-Draft elements that explicitly |
| 1562 // or implicitly (for HTML5) forbid the closing tag. | 1566 // or implicitly (for HTML5) forbid the closing tag. |
| 1563 Elements.ElementsTreeElement.ForbiddenClosingTagElements = new Set([ | 1567 Elements.ElementsTreeElement.ForbiddenClosingTagElements = new Set([ |
| 1564 'area', 'base', 'basefont', 'br', 'canvas', 'col', 'command', 'embed',
'frame', 'hr', | 1568 'area', 'base', 'basefont', 'br', 'canvas', 'col', 'command', 'embed',
'frame', 'hr', |
| 1565 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source',
'track', 'wbr' | 1569 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source',
'track', 'wbr' |
| 1566 ]); | 1570 ]); |
| 1567 | 1571 |
| 1568 // These tags we do not allow editing their tag name. | 1572 // These tags we do not allow editing their tag name. |
| 1569 Elements.ElementsTreeElement.EditTagBlacklist = new Set(['html', 'head', 'body']
); | 1573 Elements.ElementsTreeElement.EditTagBlacklist = new Set(['html', 'head', 'body']
); |
| OLD | NEW |