Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: pkg/polymer/lib/testing/testing.js

Issue 23461006: Moved test changes to dart-lang (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merged Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 expandShadowRoot(document.querySelector('body')); 48 expandShadowRoot(document.querySelector('body'));
49 49
50 // Clean up all of the junk added to the DOM by js-interop and shadow CSS 50 // Clean up all of the junk added to the DOM by js-interop and shadow CSS
51 // TODO(jmesserly): it seems like we're leaking lots of dart-port attributes 51 // TODO(jmesserly): it seems like we're leaking lots of dart-port attributes
52 // for the document elemenet 52 // for the document elemenet
53 function cleanTree(node) { 53 function cleanTree(node) {
54 for (var n = node.firstChild; n; n = n.nextSibling) { 54 for (var n = node.firstChild; n; n = n.nextSibling) {
55 cleanTree(n); 55 cleanTree(n);
56 } 56 }
57 57
58 // Remove dart-port attributes 58 // TODO(terry): Need to remove attributes in the dart-port: namespace
59 if (node.attributes) { 59 // these are added for JS interop. See bug
60 for (var i = 0; i < node.attributes.length; i++) { 60 // https://code.google.com/p/dart/issues/detail?id=12645
61 if (node.attributes[i].value.indexOf('dart-port') == 0) { 61 // The new dart:js shouldn't need these attrs for dart2js or
62 node.removeAttribute(i); 62 // Dartium (won't need with native support) then remove the
63 // below code.
64 // Remove JS interop dart-port attributes,
65 if (node.tagName == 'HTML' && node.attributes) {
66 for (var i = node.attributes.length; i--; i >= 0) {
67 var attrNode = node.attributes[i];
68 if (attrNode && attrNode.name.indexOf('dart-port:') == 0) {
69 node.removeAttributeNode(attrNode);
63 } 70 }
64 } 71 }
65 } 72 }
66 73
67 if (node.tagName == 'script' && 74 if (node.tagName == 'SCRIPT') {
68 node.textContent.indexOf('_DART_TEMPORARY_ATTACHED') >= 0) { 75 if (node.textContent.indexOf('_DART_TEMPORARY_ATTACHED') >= 0) {
69 node.parentNode.removeChild(node); 76 node.parentNode.removeChild(node);
77 } else {
78 // Remove the JS Interop script.
79 var typeAttr = node.getAttributeNode("type");
80 if (typeAttr && typeAttr.value == "text/javascript") {
81 if (node.textContent.indexOf(
82 "(function() {\n // Proxy support for js.dart.\n\n") == 0) {
83 node.parentNode.removeChild(node);
84 }
85 }
86 }
70 } 87 }
71 } 88 }
72 89
73 // TODO(jmesserly): use querySelector to workaround unwrapped "document". 90 // TODO(jmesserly): use querySelector to workaround unwrapped "document".
74 cleanTree(document.querySelector('html')); 91 cleanTree(document.querySelector('html'));
75 92
76 var out = document.createElement('pre'); 93 var out = document.createElement('pre');
77 out.textContent = document.documentElement.outerHTML; 94 out.textContent = document.documentElement.outerHTML;
78 document.body.innerHTML = ''; 95 document.body.innerHTML = '';
79 document.body.appendChild(out); 96 document.body.appendChild(out);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 parent.replaceChild(script, jsScript); 155 parent.replaceChild(script, jsScript);
139 }); 156 });
140 parent.replaceChild(jsScript, script); 157 parent.replaceChild(jsScript, script);
141 } 158 }
142 } 159 }
143 } 160 }
144 }, false); 161 }, false);
145 } 162 }
146 163
147 })(); 164 })();
OLDNEW
« no previous file with comments | « pkg/polymer/lib/src/emitters.dart ('k') | samples/third_party/todomvc/test/expected/todomvc_listorder_test.html.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698