html5,什么是isContentEditable?

发布于 2024-12-05 19:54:55 字数 171 浏览 3 评论 0原文

chrome 支持 isContentEditable 属性(将其列在“检查元素”中),但对 INPUT、FORM 报告 false - 实际上,所有内容。

例如,对我而言,似乎 INPUT(非只读)应该为 true。

有人知道发生了什么事吗?

chrome supports the isContentEditable property (lists it in the "Inspect Element"), but reports false for INPUT, FORM - actually, everything.

too me, for example, seems that INPUT, non-readonly, should be true.

does anybody know what's going on?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

墨小墨 2024-12-12 19:54:55

isContentEditable 与表单和输入框没有任何关系。
它被设计为一种标记内联可编辑 html 内容的方法。

您可以在此处查看一个工作示例: http://www.navioo.com/javascript/dhtml /isContentEditable_Example_4513.html

您可以在此处阅读相关内容

http://www.w3.org/TR/2009/WD-html5 -20090423/editing.html

或:http://blog.whatwg.org/the-road-to-html-5-contenteditable

isContentEditable doesn't have anything to do with forms and input boxes.
It was designed to be a way to flag inline editable html content.

You can see a working example here: http://www.navioo.com/javascript/dhtml/isContentEditable_Example_4513.html

You can read about it

here: http://www.w3.org/TR/2009/WD-html5-20090423/editing.html

or: http://blog.whatwg.org/the-road-to-html-5-contenteditable

打小就很酷 2024-12-12 19:54:55

在支持该元素的浏览器中,元素的 isContentEditable 属性告诉您该元素的直接子内容是否可编辑。它特别适用于常规非交互式内容(即不是表单控件),可以使用 contenteditable 属性使其可编辑:

<div contenteditable="true">This text is all <i>editable</i></div>

< 的 isContentEditable 属性;div> 和上面的 元素将报告 true。但是,请注意,并非所有支持 contentEditable 的浏览器也支持 isContentEditable:例如,Firefox 3.x 支持 contentEditable,但 不是 isContentEditable

contenteditable 已在 HTML5 中标准化,但已经存在十多年了。它于 2000 年在 IE 5.5 中首次引入,并最终在几年后进入其他浏览器。 Firefox 从 3.0 版本开始就拥有了它(尽管它从 1.0 之前就拥有文档范围的等效 designMode),而 Safari 从(我认为)2.0 开始就拥有了它。

以下是 contentEditable 历史的一个很好的总结: http://blog.whatwg .org/the-road-to-html-5-contenteditable

An element's isContentEditable property, in browsers which support it, tells you whether the immediate child content of the element is editable. It applies specifically to regular non-interactive content (i.e. not form controls), which can be made editable using the contenteditable attribute:

<div contenteditable="true">This text is all <i>editable</i></div>

The isContentEditable property of both the <div> and the <i> elements above will report true. However, be aware that not every browser that supports contentEditable also supports isContentEditable: Firefox 3.x, for example, supports contentEditable but not isContentEditable.

contenteditable is standardized in HTML5 but has been around for over a decade. It was first introduced in IE 5.5 in 2000 and eventually made its way into other browsers several years later. Firefox has had it since version 3.0 (although it had the document-wide equivalent designMode since pre-1.0) and Safari since (I think) 2.0.

Here's a good summary of the history of contentEditable: http://blog.whatwg.org/the-road-to-html-5-contenteditable

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文