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

Side by Side Diff: sky/framework/dom-serializer.sky

Issue 831033002: Add a basic SkyBinder test. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « no previous file | sky/tests/framework/binding.sky » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <script> 1 <script>
2 const kEntityMap = new Map([ 2 const kEntityMap = new Map([
3 ['\u00a0', '&nbsp;'], 3 ['\u00a0', '&nbsp;'],
4 ['&', '&amp;'], 4 ['&', '&amp;'],
5 ['<', '&lt;'], 5 ['<', '&lt;'],
6 ['>', '&gt;'], 6 ['>', '&gt;'],
7 ['"', '&quot;'], 7 ['"', '&quot;'],
8 ]); 8 ]);
9 9
10 const kTextEscapePattern = /&|<|>|"|\u00a0/g; 10 const kTextEscapePattern = /&|<|>|"|\u00a0/g;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 buffer += serializeElementChildren(element); 56 buffer += serializeElementChildren(element);
57 buffer += '</' + element.tagName + '>'; 57 buffer += '</' + element.tagName + '>';
58 return buffer; 58 return buffer;
59 } 59 }
60 60
61 function serializeNode(node) { 61 function serializeNode(node) {
62 if (node instanceof Text) 62 if (node instanceof Text)
63 return escapeText(node.data, kTextEscapePattern); 63 return escapeText(node.data, kTextEscapePattern);
64 if (node instanceof Element) 64 if (node instanceof Element)
65 return serializeElement(node); 65 return serializeElement(node);
66 if (node instanceof Document) 66 if (node instanceof Document || node instanceof ShadowRoot)
67 return serializeChildren(node.firstChild); 67 return serializeChildren(node.firstChild);
68 throw new Error("Cannot serialize node"); 68 throw new Error("Cannot serialize node");
69 } 69 }
70 70
71 module.exports = { 71 module.exports = {
72 serializeNode: serializeNode, 72 serializeNode: serializeNode,
73 }; 73 };
74 </script> 74 </script>
OLDNEW
« no previous file with comments | « no previous file | sky/tests/framework/binding.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698