似乎如果你修改一个元素的 innerhtml,就会出现一个竞争条件,导致 css3-container 文本节点呈现到屏幕上。我在网上能找到的最接近的东西是这样的:
https://groups.google.com/forum/#!msg/knockoutjs/M7sZvSFqD5I/Lg9kpNmvkkgJ http://css3pie.com/forum/viewtopic.php?f=3&t=1531
当我尝试将 html 作为第一个参数传递时,fancybox 也遇到了同样的问题。
我试图用这个补丁到modernizr解决我的问题:
diff --git a/js/libs/modernizr-2.5.3.js b/js/libs/modernizr-2.5.3.js
index c1a6a9a..0bc0d11 100755
--- a/js/libs/modernizr-2.5.3.js
+++ b/js/libs/modernizr-2.5.3.js
@@ -1071,7 +1071,12 @@ window.Modernizr = (function( window, document, undefined ) {
// a 403 response, will cause the tab/window to crash
// * Script elements appended to fragments will execute when their `src`
// or `text` property is set
- var node = (cache[nodeName] || (cache[nodeName] = docCreateElement(nodeName))).cloneNode();
+ var node;
+ if (nodeName == "css3-container") {
+ node = docCreateElement(nodeName);
+ } else {
+ node = (cache[nodeName] || (cache[nodeName] = docCreateElement(nodeName))).cloneNode();
+ }
return html5.shivMethods && node.canHaveChildren && !reSkip.test(nodeName) ? frag.appendChild(node) : node;
};
但这太hackish了,有没有其他合适的方法来解决这个问题?