# HG changeset patch # User David Walsh # Date 1515785703 21600 # Node ID dc1c587aa4ed61131849ca82d8e4cf449d576a84 # Parent 1f3b830d7047d841953104045ec2994646ab04c2 Bug 1430143 - Ensure full attribute value is copied from within Inspector. r=pbro diff --git a/devtools/client/inspector/markup/views/element-editor.js b/devtools/client/inspector/markup/views/element-editor.js --- a/devtools/client/inspector/markup/views/element-editor.js +++ b/devtools/client/inspector/markup/views/element-editor.js @@ -198,18 +198,18 @@ ElementEditor.prototype = { let type = null; let name = null; let value = null; // Attribute let attribute = node.closest(".attreditor"); if (attribute) { type = "attribute"; - name = attribute.querySelector(".attr-name").textContent; - value = attribute.querySelector(".attr-value").textContent; + name = attribute.dataset.attr; + value = attribute.dataset.value; } return {type, name, value, el: node}; }, /** * Update the state of the editor from the node. */ diff --git a/devtools/client/inspector/test/browser_inspector_menu-05-attribute-items.js b/devtools/client/inspector/test/browser_inspector_menu-05-attribute-items.js --- a/devtools/client/inspector/test/browser_inspector_menu-05-attribute-items.js +++ b/devtools/client/inspector/test/browser_inspector_menu-05-attribute-items.js @@ -8,16 +8,17 @@ http://creativecommons.org/publicdomain/ const TEST_URL = URL_ROOT + "doc_inspector_menu.html"; add_task(function* () { let { inspector, testActor } = yield openInspectorForURL(TEST_URL); yield selectNode("#attributes", inspector); yield testAddAttribute(); yield testCopyAttributeValue(); + yield testCopyLongAttributeValue(); yield testEditAttribute(); yield testRemoveAttribute(); function* testAddAttribute() { info("Triggering 'Add Attribute' and waiting for mutation to occur"); let addAttribute = getMenuItem("node-menu-add-attribute"); addAttribute.click(); @@ -39,16 +40,33 @@ add_task(function* () { type: "attribute", name: "data-edit", value: "the" }; yield waitForClipboardPromise(() => copyAttributeValue.click(), "the"); } + function* testCopyLongAttributeValue() { + info("Testing 'Copy Attribute Value' copies very long attribute values"); + let copyAttributeValue = getMenuItem("node-menu-copy-attribute"); + let longAttribute = "#01234567890123456789012345678901234567890123456789" + + "12345678901234567890123456789012345678901234567890123456789012345678901" + + "23456789012345678901234567890123456789012345678901234567890123456789012" + + "34567890123456789012345678901234567890123456789012345678901234567890123"; + + inspector.nodeMenuTriggerInfo = { + type: "attribute", + name: "data-edit", + value: longAttribute + }; + + yield waitForClipboardPromise(() => copyAttributeValue.click(), longAttribute); + } + function* testEditAttribute() { info("Testing 'Edit Attribute' menu item"); let editAttribute = getMenuItem("node-menu-edit-attribute"); info("Triggering 'Edit Attribute' and waiting for mutation to occur"); inspector.nodeMenuTriggerInfo = { type: "attribute", name: "data-edit" diff --git a/devtools/client/inspector/test/doc_inspector_menu.html b/devtools/client/inspector/test/doc_inspector_menu.html --- a/devtools/client/inspector/test/doc_inspector_menu.html +++ b/devtools/client/inspector/test/doc_inspector_menu.html @@ -18,12 +18,15 @@

This will be duplicated

This has to be deleted

Paragraph for testing console variables

Paragraph for testing multiple console variables

-

Attributes are going to be changed here

+ + +

Attributes are going to be changed here

+