RESOLVED FIXED247661
Web Inspector: Elements Copy HTML with a prettified option
https://bugs.webkit.org/show_bug.cgi?id=247661
Summary Web Inspector: Elements Copy HTML with a prettified option
Karl Dubost
Reported 2022-11-08 22:11:44 PST
Created attachment 463463 [details] copy HTML feature 1. Go to apple.com 2. Open Web Inspector 3. Select a node in Elements Tab 4. Ctrl + Click on the chosen node 5. A contextual menu opens 6. Choose Copy HTML Expected: Have an option to Copy Prettified HTML Actual: The HTML is a big chunk of packed text This for example: ``` <div class="cta-links"> <a class="icon icon-after icon-chevronright" href="/ipad-10.9/" target="_self" rel="follow" data-analytics-region="learn more" data-analytics-title="Learn more about iPad" aria-label="Learn more about iPad">Learn more</a> <a class="icon icon-after icon-chevronright" href="/us/shop/goto/buy_ipad/ipad" target="_self" rel="follow" data-analytics-region="buy" data-analytics-title="Buy iPad" aria-label="Buy iPad">Buy</a> </div> ``` In some cases when sharing code, this form (or any form that the prettifier chooses) can be clearer to explain the code (here prettified through VSCode): ``` <div class="cta-links"> <a class="icon icon-after icon-chevronright" href="/ipad-10.9/" target="_self" rel="follow" data-analytics-region="learn more" data-analytics-title="Learn more about iPad" aria-label="Learn more about iPad" >Learn more</a > <a class="icon icon-after icon-chevronright" href="/us/shop/goto/buy_ipad/ipad" target="_self" rel="follow" data-analytics-region="buy" data-analytics-title="Buy iPad" aria-label="Buy iPad" >Buy</a > </div> ```
Attachments
copy HTML feature (76.09 KB, image/png)
2022-11-08 22:11 PST, Karl Dubost
no flags
where prettified HTML should be added (69.02 KB, image/png)
2025-12-16 15:56 PST, Karl Dubost
no flags
Test case (540 bytes, text/html)
2025-12-17 04:42 PST, Razvan Caliman
no flags
Radar WebKit Bug Importer
Comment 1 2022-11-08 22:12:53 PST
Karl Dubost
Comment 2 2025-12-16 15:56:05 PST
Created attachment 477760 [details] where prettified HTML should be added
Karl Dubost
Comment 3 2025-12-16 15:57:42 PST
Why? Currently what I do is: 1. Copy HTML 2. Go to VSCode 3. Paste the code 4. Select HTML for format 5. Format Code (aka prettify) 6 Go to the radar or bwo or an email and paste the prettified code. This menu would remove 4 steps. And make it a lot easier to share code with others. This should code in addition to copy HTML and not in replacement.
Razvan Caliman
Comment 4 2025-12-17 04:42:07 PST
Created attachment 477764 [details] Test case
Razvan Caliman
Comment 5 2025-12-17 04:45:41 PST
EWS
Comment 6 2025-12-18 11:30:16 PST
Committed 304698@main (b133b2a74c50): <https://commits.webkit.org/304698@main> Reviewed commits have been landed. Closing PR #55552 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.