<script style="display: block;"> tag disallow to copy content
Categories
(Core :: DOM: Serializers, defect, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox68 | --- | fixed |
People
(Reporter: stack, Assigned: MatsPalmgren_bugz)
Details
(4 keywords)
Attachments
(2 files)
User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0
Steps to reproduce:
<!doctype html>
<html lang="en">
<head>
<title>Attempt to emulate depricated XMP tag</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
script[type="text/plain"] {
display: block;
width: 100%;
white-space: pre;
box-sizing: border-box;
user-select:text !important;
}
</style>
</head>
<body>
<script type="text/plain" readonly>
Try to select then copy and paste me somewhere else ...
and you will fail...
WITH FireFox ONLY !!!
</script>
</body>
</html>
Actual results:
<xmp> tag is deprecated and as replacement it is advised to use <script type="text/plain"> tag instead to allow to put there content that includes html tags.
If one would attempt to select and copy content inside <script> tag then firefox allows to select and copy content but if you would try to paste copied content to text editor - it will return nothing.
Expected results:
It must work as it is in any major browsers (it even works in IE11) - allows to copy/paste content from <script> tag.
| Reporter | ||
Updated•7 years ago
|
Comment 1•7 years ago
|
||
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0
20190313100914
(In reply to Alexander J from comment #0)
<xmp>tag is deprecated and as replacement it is advised to use<script type="text/plain">tag instead
MDN recommends using <pre> or <code> or some other element and applying a monospace font to it. You still have to escape < as <
https://developer.mozilla.org/docs/Web/HTML/Element/xmp
It must work as it is in any major browsers
I suppose I'll confirm this since it works in other browsers, but I don't know if it's actually valid. Much of the supplied testcase is unnecessary; here's a reduced version.
Updated•7 years ago
|
| Reporter | ||
Comment 2•7 years ago
|
||
Thank you for your time you spent to take a look on this issue !
(In reply to Gingerbread Man from comment #1)
(In reply to Alexander J from comment #0)
<xmp>tag is deprecated and as replacement it is advised to use<script type="text/plain">tag insteadMDN recommends using
<pre>or<code>or some other element and applying a monospace font to it. You still have to escape<as<
https://developer.mozilla.org/docs/Web/HTML/Element/xmp
It is really recommendation, it isn't a rule and there are a lot of cases when one need to display raw content, so users can simply copy and use raw content in perfectly legal tag
<script type="text/plain"> raw content, such as <p>tag</p></script>
There no exact replacement for <xmp> tag yet except the only one I showed, but if one would check search engines, there a lot of requests to use its functionality - display raw content without converting some characters to html entities.
It must work as it is in any major browsers
I suppose I'll confirm this since it works in other browsers, but I don't know if it's actually valid. Much of the supplied testcase is unnecessary; here's a reduced version.
According to HTML5, it perfectly legal to use <script type="media_type">, so I really don't understand why it shouldn't be valid, especially it works in all major nowadays browsers. The only difference in behavior to compare to other browsers is that Firefox allows to select and copy content, but for some strange reason, the only Firefox copy nothing, which looks like a clear bug.
| Assignee | ||
Updated•7 years ago
|
| Assignee | ||
Comment 3•7 years ago
|
||
Updated•7 years ago
|
Comment 5•7 years ago
|
||
| bugherder | ||
Description
•