为什么OS X上的Chrome 37没有正确显示此HTML?

时间:2014-08-30 03:34:21

标签: html css google-chrome

在OS X上的Chrome 37中,此HTML页面的内容在滚动时无法正确刷新 - 它只是空白。如果您尝试选择文本,也可以触发问题 - 它将会消隐。

可是:

  • 如果您从CSS中删除-webkit-font-feature-settings行, 它会正常工作。

  • 如果从第一行删除­(软连字符),它将正常工作。

此显示错误不会影响Windows上的Chrome 37,也不会影响其他OS X浏览器,也不会影响OS X(AFAIK)上以前版本的Chrome。

因此我的问题:

  1. 这里发生了什么?

  2. 是否有解决方法不涉及删除软连字符或OpenType功能?

  3. 谢谢。


    这是the fiddle

    这是HTML,重复相同的段落5次(每段的末尾有一个数字供参考):

    <!DOCTYPE html>
    <html>
      <head>
      <meta charset="UTF-8">
    <title>here</title>
    
    <style type="text/css">
    
    body {
    -webkit-font-feature-settings: 'kern' 1;
    }
    
    </style>
    
    </head>
    <body>hyphen&shy;ated
    
    But, in a larger sense, we can not dedicate, we can not consecrate, we can not hallow this ground. The brave men, living and dead, who struggled here, have consecrated it, far above our poor power to add or detract. The world will little note, nor long remember what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great task remaining before us—that from these honored dead we take increased devotion to that cause for which they gave the last full measure of devotion—that we here highly resolve that these dead shall not have died in vain—that this nation, under God, shall have a new birth of freedom—and that government of the people, by the people, for the people, shall not perish from the earth.
    
    But, in a larger sense, we can not dedicate, we can not consecrate, we can not hallow this ground. The brave men, living and dead, who struggled here, have consecrated it, far above our poor power to add or detract. The world will little note, nor long remember what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great task remaining before us—that from these honored dead we take increased devotion to that cause for which they gave the last full measure of devotion—that we here highly resolve that these dead shall not have died in vain—that this nation, under God, shall have a new birth of freedom—and that government of the people, by the people, for the people, shall not perish from the earth2.
    
    But, in a larger sense, we can not dedicate, we can not consecrate, we can not hallow this ground. The brave men, living and dead, who struggled here, have consecrated it, far above our poor power to add or detract. The world will little note, nor long remember what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great task remaining before us—that from these honored dead we take increased devotion to that cause for which they gave the last full measure of devotion—that we here highly resolve that these dead shall not have died in vain—that this nation, under God, shall have a new birth of freedom—and that government of the people, by the people, for the people, shall not perish from the earth3.
    
    But, in a larger sense, we can not dedicate, we can not consecrate, we can not hallow this ground. The brave men, living and dead, who struggled here, have consecrated it, far above our poor power to add or detract. The world will little note, nor long remember what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great task remaining before us—that from these honored dead we take increased devotion to that cause for which they gave the last full measure of devotion—that we here highly resolve that these dead shall not have died in vain—that this nation, under God, shall have a new birth of freedom—and that government of the people, by the people, for the people, shall not perish from the earth4.
    
    But, in a larger sense, we can not dedicate, we can not consecrate, we can not hallow this ground. The brave men, living and dead, who struggled here, have consecrated it, far above our poor power to add or detract. The world will little note, nor long remember what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great task remaining before us—that from these honored dead we take increased devotion to that cause for which they gave the last full measure of devotion—that we here highly resolve that these dead shall not have died in vain—that this nation, under God, shall have a new birth of freedom—and that government of the people, by the people, for the people, shall not perish from the earth5.
    
    </body>
    </html>
    

    PS。这里的a codepen以稍微不同的方式显示了同样的问题。

3 个答案:

答案 0 :(得分:1)

这是一个错误。该错误还会影响OS X上的Opera 24(因为它基于有缺陷的Chrome 37代码)。

解决方法是删除文本中的软连字符,或删除webkit的字体功能(即所有出现的CSS属性-webkit-font-feature-settings)。请注意,此属性必须已删除 - 您无法链接到仅反转设置的第二个CSS文件,例如* {-webkit-font-feature-settings: inherit}。无论出于何种原因,只要有错误的浏览器读取此属性,就会出现错误。

当然,这种解决方法的问题在于它过于包含:它在所有版本的Chrome和Opera中禁用-webkit-font-feature-settings,而不仅仅是错误的版本。为了避免这种后果,我将我的基本styles.css分成了第二个版本,其中-webkit-font-feature-settings被剥离了。然后我使用JavaScript来检测错误的浏览器并加载剥离的CSS。我知道,这是一种令人讨厌的技术,但最简单的是最有效的解决方法(不会惩罚使用其他浏览器的人)。

答案 1 :(得分:1)

我偶然发现了一个解决方案,因为它仍然在chrome 38 mac中出错。

article h1, article h2, article p, article li, article blockquote {
    white-space: pre-line;
}

其中p是&amp; shy;

的容器

答案 2 :(得分:0)

  

这里发生了什么?

这是Chrome 37中的一个错误。

  

是否有解决方法不涉及删除软连字符或OpenType功能?

避免滚动内容。

相关问题