WebKit Bugzilla
Attachment 373581 Details for
Bug 199396
: Web Inspector: Elements: pasting doesn't work when a comment node is selected
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-199396-20190706140700.patch (text/plain), 4.17 KB, created by
Devin Rousso
on 2019-07-06 14:07:01 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Devin Rousso
Created:
2019-07-06 14:07:01 PDT
Size:
4.17 KB
patch
obsolete
>diff --git a/Source/WebInspectorUI/ChangeLog b/Source/WebInspectorUI/ChangeLog >index 81b5be3e689e68d8dd6e2fd96a6bdecc06460d12..57318c53fc0689c6f7faf2728df01559f5002fc0 100644 >--- a/Source/WebInspectorUI/ChangeLog >+++ b/Source/WebInspectorUI/ChangeLog >@@ -1,3 +1,22 @@ >+2019-07-06 Devin Rousso <drousso@apple.com> >+ >+ Web Inspector: Elements: pasting doesn't work when a comment node is selected >+ https://bugs.webkit.org/show_bug.cgi?id=199396 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Check if the next/previous/parent DOM node exists and can call `insertAdjacentHTML` if the >+ target DOM node isn't able to. >+ >+ If the next/previous DOM nodes exist, but aren't able to call `insertAdjacentHTML`, mimic >+ the functionality of `insertAdjacentHTML` by creating a detached DOM node in the page and >+ moving each child (`insertBefore`) created from the given HTML to be a child of the parent >+ of the target DOM node at the right index. >+ >+ * UserInterface/Models/DOMNode.js: >+ (WI.DOMNode.prototype.insertAdjacentHTML): >+ (WI.DOMNode.prototype.insertAdjacentHTML.allowed): Added. >+ > 2019-07-05 Devin Rousso <drousso@apple.com> > > Web Inspector: current call frame indicator not visible in dark mode >diff --git a/Source/WebInspectorUI/UserInterface/Models/DOMNode.js b/Source/WebInspectorUI/UserInterface/Models/DOMNode.js >index caa7e9a078190dca668e9f44124477c983f028f2..49f98bc581d8eb97349eaabf56bdcdcbf8cea367 100644 >--- a/Source/WebInspectorUI/UserInterface/Models/DOMNode.js >+++ b/Source/WebInspectorUI/UserInterface/Models/DOMNode.js >@@ -548,8 +548,62 @@ WI.DOMNode = class DOMNode extends WI.Object > > insertAdjacentHTML(position, html) > { >- if (this.nodeType() !== Node.ELEMENT_NODE) >+ function allowed(node) { >+ return node && node.nodeType() === Node.ELEMENT_NODE; >+ } >+ >+ let mimicInsertAdjacentHTML = async () => { >+ let object = await WI.RemoteObject.resolveNode(this.parentNode); >+ >+ function inspectedPage_parent_mimic_insertAdjacentHTML(index, html) { >+ var wrapper = document.createElement("div"); >+ wrapper.innerHTML = html; >+ for (var child = wrapper.lastChild; child; child = wrapper.lastChild) >+ this.insertBefore(child, this.childNodes[index + 2]); >+ } >+ object.callFunction(inspectedPage_parent_mimic_insertAdjacentHTML, [this.parentNode.children.indexOf(this), html]); >+ object.release(); >+ }; >+ >+ if (!allowed(this)) { >+ switch (position) { >+ case "beforebegin": { >+ let previousSibling = this.previousSibling; >+ if (previousSibling) { >+ if (allowed(previousSibling)) { >+ previousSibling.insertAdjacentHTML("afterend", html); >+ return; >+ } else if (allowed(this.parentNode)) { >+ mimicInsertAdjacentHTML(); >+ return; >+ } >+ } else if (allowed(this.parentNode)) { >+ this.parentNode.insertAdjacentHTML("afterbegin", html); >+ return; >+ } >+ break; >+ } >+ case "afterend": { >+ let nextSibling = this.nextSibling; >+ if (nextSibling) { >+ if (allowed(nextSibling)) { >+ nextSibling.insertAdjacentHTML("beforebegin", html); >+ return; >+ } else if (allowed(this.parentNode)) { >+ mimicInsertAdjacentHTML(); >+ return; >+ } >+ } else if (allowed(this.parentNode)) { >+ this.parentNode.insertAdjacentHTML("beforeend", html); >+ return; >+ } >+ break; >+ } >+ } >+ >+ console.assert(false, "Cannot insertAdjacentHTML at position", position, html, this); > return; >+ } > > // COMPATIBILITY (iOS 11.0): DOM.insertAdjacentHTML did not exist. > if (!DOMAgent.insertAdjacentHTML) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 199396
:
373581
|
374747