为什么可编辑文档的 Opera 中换行符会变成空格或消失?
为什么对于内容可编辑的文档,换行符在 Opera 中显示为空格或在 Enter/Return 键上消失?
试试这个演示:
<!DOCTYPE html>
<html>
<head>
<title>contentEditable demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<body contenteditable="true" spellcheck="true" dir="ltr">
<h1>Welcome to the contentEditable demo!</h1><p><span style="font-size: xx-large">
Try<span style="font-size: small">to type some text before the word "Try". You will see that random spaces are inserted before the word. Press Enter; you will see that the newline on the top disappears.</span></span></p></body>
</html>
Windows Vista 上的 Opera 11.50 Build 1074
这是 Opera 错误吗?我在 Windows Internet Explorer 8、Safari、Google Chrome 或 Firefox 5 中没有遇到此错误。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想我可能已经从这些链接中发现了原因:
[whatwg]处理内容编辑中折叠的空白:
http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2011-June/032187.html
Bug 13011 - [编辑] 鼓励作者对 contenteditable="" 和 .designMode=true 使用“white-space: pre-wrap”:
https://www.w3.org/Bugs/Public/show_bug.cgi?id=13011
页内编辑器的最佳实践:
http://developers .whatwg.org/editing.html#best-practices-for-in-page-editors
I think that I may have discovered why from these links:
[whatwg] Handling of collapsed whitespace in contenteditable:
http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2011-June/032187.html
Bug 13011 - [editing] Encourage authors to use "white-space: pre-wrap" for contenteditable="" and .designMode=true:
https://www.w3.org/Bugs/Public/show_bug.cgi?id=13011
Best practices for in-page editors:
http://developers.whatwg.org/editing.html#best-practices-for-in-page-editors