Skip to content
Browse files

Fixed DOM incompatibilities that were breaking IE.

  • Loading branch information...
1 parent 6542fb0 commit aab00b46e0a59e7977af8533e48e444389d40eee @jbeard4 committed Dec 19, 2012
Showing with 16 additions and 3 deletions.
  1. +15 −2 lib/base-platform/dom.js
  2. +1 −1 lib/browser/platform.js
View
17 lib/base-platform/dom.js
@@ -56,7 +56,13 @@ module.exports = {
if(txt === undefined){
if(node.nodeType === 1){
//element
- return node.textContent;
+ if(node.textContent !== undefined){
+ return node.textContent;
+ }else{
+ //IE
+ return this.getChildren(node).
+ map(function(textNode){return this.textContent(textNode);},this).join("");
+ }
}else if(node.nodeType === 3 || node.nodeType === 4){
//textnode
return node.data;
@@ -65,7 +71,14 @@ module.exports = {
}else{
if(node.nodeType === 1){
//element node
- return node.textContent = txt;
+ if(node.textContent !== undefined){
+ return node.textContent = txt;
+ }else{
+ //IE
+ var textNode = node.ownerDocument.createTextNode(txt);
+ node.appendChild(textNode);
+ return txt;
+ }
}else if(node.nodeType === 3){
//textnode
return node.data = txt;
View
2 lib/browser/platform.js
@@ -74,7 +74,7 @@ exports.platform = {
window.clearTimeout(timeoutId);
},
- log : window.console.log.bind(console),
+ log : window.console && window.console.log && (window.console.log.bind ? window.console.log.bind(window.console) : window.console.log),
path : require('../base-platform/path'),

0 comments on commit aab00b4

Please sign in to comment.
Something went wrong with that request. Please try again.