Skip to content

Commit

Permalink
更好地处理IE6-9私自添加caption元素的BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
RubyLouvre committed Nov 19, 2014
1 parent d1d01ee commit 3912a8b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 34 deletions.
13 changes: 3 additions & 10 deletions avalon.js
Original file line number Diff line number Diff line change
Expand Up @@ -1640,7 +1640,8 @@
legend: [1, "<fieldset>"],
option: [1, "<select multiple='multiple'>"],
thead: [1, "<table>", "</table>"],
tr: [2, "<table><tbody>"],
//如果这里不写</tbody></table>,在IE6-9会在多出一个奇怪的caption标签
tr: [2, "<table><tbody>","</tbody></table>"],
td: [3, "<table><tbody><tr>"],
g: [1, '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">', '</svg>'],
//IE6-8在用innerHTML生成节点时,不能直接创建no-scope元素与HTML5的新标签
Expand Down Expand Up @@ -1707,15 +1708,7 @@
}
}
}
if (DOC.createStyleSheet && tag === "tr") {
for (els = wrapper.children, i = 0; el = els[i++]; ) {
// IE6-9,如果动态生成tr元素,必须会在后面添加早已废弃caption的标签,其nodeName,innerHTML都为""
if (el.nodeName === "") {
el.parentNode.removeChild(el)
i--
}
}
}

while (firstChild = wrapper.firstChild) { // 将wrapper上的节点转移到文档碎片上!
fragment.appendChild(firstChild)
}
Expand Down
27 changes: 13 additions & 14 deletions avalon.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 2 additions & 10 deletions examples/avalon.shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -1640,7 +1640,8 @@
legend: [1, "<fieldset>"],
option: [1, "<select multiple='multiple'>"],
thead: [1, "<table>", "</table>"],
tr: [2, "<table><tbody>"],
//如果这里不写</tbody></table>,在IE6-9会在多出一个奇怪的caption标签
tr: [2, "<table><tbody>", "</tbody></table>"],
td: [3, "<table><tbody><tr>"],
g: [1, '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">', '</svg>'],
//IE6-8在用innerHTML生成节点时,不能直接创建no-scope元素与HTML5的新标签
Expand Down Expand Up @@ -1707,15 +1708,6 @@
}
}
}
if (DOC.createStyleSheet && tag === "tr") {
for (els = wrapper.children, i = 0; el = els[i++]; ) {
// IE6-9,如果动态生成tr元素,必须会在后面添加早已废弃caption的标签,其nodeName,innerHTML都为""
if (el.nodeName === "") {
el.parentNode.removeChild(el)
i--
}
}
}
while (firstChild = wrapper.firstChild) { // 将wrapper上的节点转移到文档碎片上!
fragment.appendChild(firstChild)
}
Expand Down

0 comments on commit 3912a8b

Please sign in to comment.