IE designMode 显示显示:无 Divs
我对此做了很多研究,但无法解决这个问题。 我有一个 Div,其中有几个 Div,我想在打开 TinyMCE 实例之前隐藏它们。
我通过 jQuery 执行此操作 -
$(".drop").hide()
这工作正常,除了 Trident (IE) 之外的每个浏览器引擎都隐藏它们。 如果我检查 IE 中的元素,CSS 会指示“display:none”。
我找到了一些关于 IE 的一项功能如何显示这些元素的文章和注释,包括 MSDN 上的这篇文章和注释: http://msdn.microsoft.com/en-us/library/aa770023(VS.85).aspx
问题是我需要隐藏它们。 有任何想法吗?
I've done a lot of research on this,but I'm unable to solve this problem. I've got a Div with several Divs within it that I want to hide before switching on a TinyMCE instance.
I'm doing this via jQuery -
$(".drop").hide()
This works fine, and every browser engine except Trident (IE) hides them. If I inspect the elements in IE, the css indicates "display:none".
I found a few articles and notes about how this is a feature of IE to show those elements, including this one on MSDN: http://msdn.microsoft.com/en-us/library/aa770023(VS.85).aspx
The problem is that I need those to hide. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是因为在可编辑元素内,IE 使所有内容(包括使用 display: none 隐藏的元素)都可编辑。 除了删除您希望从页面 DOM 中隐藏的元素之外,您对此无能为力。
这里引用了 IE 的这种行为: http: //msdn.microsoft.com/en-us/library/aa770023%28VS.85%29.aspx
This is because inside an editable element IE makes everything, including elements hidden with display: none, editable. There's nothing you can do about it except remove the elements you wish to hide from the page's DOM.
There's a reference to this behaviour of IE here: http://msdn.microsoft.com/en-us/library/aa770023%28VS.85%29.aspx
您可以尝试应用一种将显示设置为无以外的样式,例如:
这听起来像是 IE 需要元素“具有布局”以便对其执行某些操作而引起的,隐藏就是其中之一。 给定块显示类型的元素应该具有布局,也就是说,它占据空间并迫使浏览器重新组织其周围的同级元素。
You could try applying a style that sets the display to something other than none, for example:
This sounds like its being caused by IE's need for the element to "have layout" in order to do certain operations on it, hiding being one of them. Elements given a display type of block should have layout, that is, it occupies space and forces the browser to reorganize sibling elements around it.
据我记得tinyMCE使用iframe进行编辑并在iframe中启用编辑模式,因此如果您在加载tinyMCE之前处于编辑模式,您确定必须将外部文档置于编辑模式。
为了澄清,您是否试图影响 iframe 的内部,或者tinyMCE正在加载包含 display: none 的内容
从表面上看,如果您将包含 display: none 的内容加载到tinyMCE中,您可能需要在删除时执行某种混乱的解决方法加载时的节点并尝试在保存时将它们重新插入到相同的位置。
我能看到的唯一好处是,在其他浏览器中,您是否会通过仅选择节点两侧的文本而在不知不觉中删除隐藏节点。
As far as I remember tinyMCE uses an iframe to edit and enables edit mode within the iframe so if you are in edit mode before loading tinyMCE are you sure you have to place the outer document in edit mode.
To clarify, are you trying to affect the inside of the iframe or is tinyMCE loading content containing display: none
At face value if you're loading content with display: none into tinyMCE you might have to do some kind of messy workaround where you remove the nodes at load and attempt to reinsert them in the same position when saving.
The only benefit I can see is if in other browsers you would unknowingly delete the hidden nodes by just selecting text on both sides of the node.