开发者

What is the g_editable attribute?

I keep seeing things like <div ... g_editable="true" ... >.

I've searched for anything to help me understand its purpose, but all I get back is mo开发者_如何转开发re markup and nothing explaining it.

Can somebody please explain it?


The g_editable="true" attribute is used by Google in their Gmail email composition (and likely other Google products as well). Instead of using a textarea tag they use a source-less iframe and all of the email contents are highlighted, typed in, made bold, adding line breaks etc are all handled by javascript so that it resembles a textarea, but with a lot more functionality.

The g_editable="true" attribute itself is likely to limit the scope that different functions and events have so that you can't just boldify text in your contacts list and that sort of thing. It's probably why they have it in an iframe as well.


It may just be a custom attribute defined by Google. It could be a hook for their JavaScript and/or CSS.

For best practice though, they should have prefixed it with data-.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜