OLD | NEW |
1 <script> | 1 <script> |
2 function DOMAgent(delegate) { | 2 function DOMAgent(delegate) { |
3 this.enabled = false; | 3 this.enabled = false; |
4 this.delegate_ = delegate; | 4 this.delegate_ = delegate; |
5 this.nextNodeId_ = 1; | 5 this.nextNodeId_ = 1; |
6 this.nodeToId_ = new Map(); | 6 this.nodeToId_ = new Map(); |
7 this.idToNode_ = new Map(); | 7 this.idToNode_ = new Map(); |
8 } | 8 } |
9 | 9 |
10 DOMAgent.prototype.getIdForNode_ = function(node) { | 10 DOMAgent.prototype.getIdForNode_ = function(node) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 record.localName = node.tagName; | 53 record.localName = node.tagName; |
54 record.nodeValue = ""; | 54 record.nodeValue = ""; |
55 record.attributes = this.serializeAttributes_(node); | 55 record.attributes = this.serializeAttributes_(node); |
56 } else if (node instanceof Text) { | 56 } else if (node instanceof Text) { |
57 record.nodeType = 3; | 57 record.nodeType = 3; |
58 record.nodeName = "#text"; | 58 record.nodeName = "#text"; |
59 var nodeValue = node.data; | 59 var nodeValue = node.data; |
60 if (!nodeValue.trim()) | 60 if (!nodeValue.trim()) |
61 return null; | 61 return null; |
62 record.nodeValue = nodeValue; | 62 record.nodeValue = nodeValue; |
63 } else if (node instanceof Comment) { | |
64 record.nodeType = 8; | |
65 record.nodeName = "#comment"; | |
66 record.nodeValue = node.data; | |
67 } else if (node instanceof Document) { | 63 } else if (node instanceof Document) { |
68 isContainer = true; | 64 isContainer = true; |
69 record.nodeType = 9; | 65 record.nodeType = 9; |
70 record.nodeName = "#document"; | 66 record.nodeName = "#document"; |
71 record.localName = ""; | 67 record.localName = ""; |
72 record.nodeValue = ""; | 68 record.nodeValue = ""; |
73 record.documentURL = node.URL; | 69 record.documentURL = node.URL; |
74 record.baseURL = node.baseURI; | 70 record.baseURL = node.baseURI; |
75 } else if (node instanceof DocumentFragment) { | 71 } else if (node instanceof DocumentFragment) { |
76 isContainer = true; | 72 isContainer = true; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 previousNodeId: previousNodeId, | 156 previousNodeId: previousNodeId, |
161 node: this.serializeNode_(node), | 157 node: this.serializeNode_(node), |
162 }); | 158 }); |
163 }.bind(this)); | 159 }.bind(this)); |
164 } | 160 } |
165 } | 161 } |
166 }; | 162 }; |
167 | 163 |
168 this.exports = DOMAgent; | 164 this.exports = DOMAgent; |
169 </script> | 165 </script> |
OLD | NEW |