| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 (function() { | 5 (function() { |
| 6 var undoReplaceScripts = []; | 6 var undoReplaceScripts = []; |
| 7 | 7 |
| 8 var flags = {}; | 8 var flags = {}; |
| 9 // populate flags from location | 9 // populate flags from location |
| 10 location.search.slice(1).split('&').forEach(function(o) { | 10 location.search.slice(1).split('&').forEach(function(o) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // Remove JS interop dart-port attributes, | 64 // Remove JS interop dart-port attributes, |
| 65 if (node.tagName == 'HTML' && node.attributes) { | 65 if (node.tagName == 'HTML' && node.attributes) { |
| 66 for (var i = node.attributes.length; i--; i >= 0) { | 66 for (var i = node.attributes.length; i--; i >= 0) { |
| 67 var attrNode = node.attributes[i]; | 67 var attrNode = node.attributes[i]; |
| 68 if (attrNode && attrNode.name.indexOf('dart-port:') == 0) { | 68 if (attrNode && attrNode.name.indexOf('dart-port:') == 0) { |
| 69 node.removeAttributeNode(attrNode); | 69 node.removeAttributeNode(attrNode); |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 | 73 |
| 74 // We remove the contents of style tags so that we can compare both runs |
| 75 // with and without the runtmie css shim. We keep the STYLE right under |
| 76 // HEAD, because it is not affected by the shim. |
| 77 if (node.tagName == 'STYLE') { |
| 78 if (node.attributes['shadowcssshim'] != null) { |
| 79 node.parentNode.removeChild(node); |
| 80 } else if (node.parentNode.tagName != "HEAD") { |
| 81 node.textContent = '/* style hidden by testing.js */' |
| 82 } |
| 83 } |
| 84 |
| 74 if (node.tagName == 'SCRIPT') { | 85 if (node.tagName == 'SCRIPT') { |
| 75 if (node.textContent.indexOf('_DART_TEMPORARY_ATTACHED') >= 0) { | 86 if (node.textContent.indexOf('_DART_TEMPORARY_ATTACHED') >= 0) { |
| 76 node.parentNode.removeChild(node); | 87 node.parentNode.removeChild(node); |
| 77 } else { | 88 } else { |
| 78 // Remove the JS Interop script. | 89 // Remove the JS Interop script. |
| 79 var typeAttr = node.getAttributeNode("type"); | 90 var typeAttr = node.getAttributeNode("type"); |
| 80 if (typeAttr && typeAttr.value == "text/javascript") { | 91 if (typeAttr && typeAttr.value == "text/javascript") { |
| 81 if (node.textContent.indexOf( | 92 if (node.textContent.indexOf( |
| 82 "(function() {\n // Proxy support for js.dart.\n\n") == 0) { | 93 "(function() {\n // Proxy support for js.dart.\n\n") == 0) { |
| 83 node.parentNode.removeChild(node); | 94 node.parentNode.removeChild(node); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 parent.replaceChild(script, jsScript); | 166 parent.replaceChild(script, jsScript); |
| 156 }); | 167 }); |
| 157 parent.replaceChild(jsScript, script); | 168 parent.replaceChild(jsScript, script); |
| 158 } | 169 } |
| 159 } | 170 } |
| 160 } | 171 } |
| 161 }, false); | 172 }, false); |
| 162 } | 173 } |
| 163 | 174 |
| 164 })(); | 175 })(); |
| OLD | NEW |