- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
在 Internet Explorer 中,一个 PRE
风格为 white-space:nowrap
导致 PRE
中的代码当我使用 prettify ( http://code.google.com/p/google-code-prettify/ ) 时在一行中。
不是 <br/>
应该在 PRE
中产生一个新行?我在页面加载后检查了 prettify 生成的 HTML 源代码,它生成了 <br/>
当它遇到换行符时。
参见 http://blog.mikecouturier.com/2009/12/google-street-view-with-google-maps_27.html举个例子。
这在 FF 和 Chrome 中都不会发生。
谢谢
编辑: 也许这与此有关:Inserting a newline into a pre tag (IE, Javascript)
最佳答案
来自 The Internet Explorer innerHTML Quirk :
The innerHTML property of HTML elements is well-known and widely used. It is capable of setting the complete content of an element in one go, including elements and the like. As the QuirksMode tests have shown, innerHTML is the fastest way to dynamically change the page content.
However, innerHTML has a problem in Internet Explorer.
The HTML standard requires a transformation on display of content. All kinds and amounts of adjacent whitespace are collapsed into a single space. This is a good thing - just as an example, it allows me to add a lot of line breaks into this source file without having to worry about weird line breaks in the displayed text.
Internet Explorer applies these transformations on assignment to the innerHTML property. This seems like a good idea: it saves a little time during display, because if the in-memory representation is already normalized, then the browser doesn't have to normalize whenever it needs to display the text.
There are exceptions to the normalization rule, though. Notably, these are the
<textarea>
element, the<pre>
element and, in CSS-aware browsers, elements with any value but normal for the white-space property.Internet Explorer does not respect these special cases. The third makes their optimization a bad idea, because white-space might change at runtime, for example through the DOM. In any case, Internet Explorer will normalize all assignments to the innerHTML property.
这是另一个 IE 独有的“错误”(即使是他们发明了 innerHTML)。在第一个链接中,您有解决此问题的方法,但正如 Lucas 指出的那样,所有内容似乎都指向您无法控制的 Google 代码。
关于javascript - 使用空白 :nowrap is one line in IE 在 PRE 中美化突出显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1970446/
内的和
看似不可能完成的任务。我有一个服务器输出,其中包含 内的转储。不幸的是,我碰巧转储了一个包含一些 html 标签的文件。我需要转换任何内部 HTML 实体,以便当我将数据附加到 DOM 时结构不会
标签之间的所有内容
我正在读取 .html 文件: const htmlin = String(fs.readFileSync(inputHtml) || ''); const splitted = htmlin.spl
我在 中输入了一些文本, 我输入了一些换行符、空格等。故意。但是,在提交文本并在 内呈现之后, 换行符,空格消失了,它们被类似 \r\n\r\n 的东西所取代, 怎么了?如何保持原始格式? 我
我在里面有很多内容我正在打印的标签。我正在对打印样式使用媒体查询。一切都很好,只是第一页的最后一行被剪切了。其中一半保留在第一页,另一半显示在下一页。我不知道如何将溢出转移到下一页。 最佳答案 我想通
并用括起来是否安全?
一些用户生成的文本(可能包含脚本/代码)将向公众展示。如果我过滤掉所有 和标记并用 将结果文本括起来和 ,用户提交的脚本有机会被执行吗? 请给我一个如何破解这个保护方案的例子。 最佳答案 Is it
标签中移除
我制作了简单的 BBCode 脚本,它运行良好。但后来我使用 javascript 库来美化我在 中的代码. 现在我面临的唯一问题是 中每行代码后的标签标签。 所以问题是我怎样才能删除 在
`中删除 ``?
Markdown 中的三个反引号渲染为 ... 。更具体地说, # in markdown ```java ``` # render as ... # my expecting result
标签内的方括号 (<>) 替换除标签内的换行符
我使用 question 中提供的答案替换了 pre 标签外的所有换行符. \n(?![^) 它工作正常,直到 pre 标签中的内容有 括号。 例如,输入: Test contennt for re
标签中获取选定的文本和文本索引,其中偏移量是 pre 的开始
所以我有一个像这样的前置标签: Some content, more content. Coloured content. Some more content 我想做的是使用绑定(bind) mou
我正在开发一个 android 项目,我们在其中使用 ant 构建我们的版本。在更改代码中的 versionName 和其他一些标志时,我们使用 Android-ant 目标 -pre-compile
"); ..... 回显 (""); ?> 是什么意思?
问题是标签 我看过我正在编写的一个脚本,并使用了它: echo (""); ........ echo (""); 它到底做了什么? 它是 Html 标签还是 PHP? 我在 Google 上进行了
我想知道哪些语言和工具(调试器、IDE、分析器、库等)可供想要为 Palm Pre 开发的人使用。 另外,我想知道存在哪些必须注意的技术限制。 最佳答案 有一个 JavaScript 函数库,用于与基
我目前有一个简单的 pre-commit 钩子(Hook)用于我的项目(在 R 中,虽然这是这个问题的附带),它运行单元测试: #!/bin/sh a=$(Rscript tests/testthat
我目前有一个简单的 pre-commit 钩子(Hook)用于我的项目(在 R 中,虽然这是这个问题的附带),它运行单元测试: #!/bin/sh a=$(Rscript tests/testthat
标签中的文本的空白缩进,不包括文档中标签的当前缩进级别?
我试图在网站上显示我的代码,但在正确保留空格缩进时遇到问题。 例如给定以下片段: Here is my code: def some_funtion ret
"的快捷方式 ;print_r($myarray);echo "";
是否有快捷方式 echo ""; print_r($myarray); echo ""; 为了获得数组的可读格式而键入这些内容真的很烦人。 最佳答案 这是最短的: echo '',print_r
我有一个简单的 python 项目,目前只有一个文件。它存在于我的项目的 static/cgi-bin 文件夹中。目前,在我的目录的底部,我有一个 .pre-commit-config.yaml 文件
Moses Tokenizer是广泛应用于机器翻译和自然语言处理实验的分词器。 有一行正则表达式检查: if (($pre =~ /\./ && $pre =~ /\p{IsAlpha}/) ||
在我的一个 PHP 网站上,我需要为我的用户提供选择某些行以从网站上的所有搜索结果(查询)中排除的功能。 我应该采取哪种方式来处理排除,我应该: 1) 每当用户登录(或通过查询更新它)时,预编译排除行
考虑以下代码段。 <p class="text-centre"> </bHello World></b> </p> 然后我有另一个div如下 正如您在第一个 div 中
我是一名优秀的程序员,十分优秀!