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 14 matching lines...) Expand all Loading... |
25 for (var child = node.firstChild; child; child = child.nextSibling) { | 25 for (var child = node.firstChild; child; child = child.nextSibling) { |
26 var record = this.serializeNode_(child); | 26 var record = this.serializeNode_(child); |
27 if (record) | 27 if (record) |
28 children.push(record); | 28 children.push(record); |
29 } | 29 } |
30 return children; | 30 return children; |
31 }; | 31 }; |
32 | 32 |
33 DOMAgent.prototype.serializeAttributes_ = function(element) { | 33 DOMAgent.prototype.serializeAttributes_ = function(element) { |
34 var attributes = []; | 34 var attributes = []; |
35 var attrs = element.attributes; | 35 var attrs = element.getAttributes(); |
36 for (var i = 0; i < attrs.length; ++i) { | 36 for (var i = 0; i < attrs.length; ++i) { |
37 var attr = attrs[i]; | 37 var attr = attrs[i]; |
38 attributes.push(attr.name); | 38 attributes.push(attr.name); |
39 attributes.push(attr.value); | 39 attributes.push(attr.value); |
40 } | 40 } |
41 return attributes; | 41 return attributes; |
42 }; | 42 }; |
43 | 43 |
44 DOMAgent.prototype.serializeNode_ = function(node) { | 44 DOMAgent.prototype.serializeNode_ = function(node) { |
45 var id = this.getIdForNode_(node); | 45 var id = this.getIdForNode_(node); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 previousNodeId: previousNodeId, | 160 previousNodeId: previousNodeId, |
161 node: this.serializeNode_(node), | 161 node: this.serializeNode_(node), |
162 }); | 162 }); |
163 }.bind(this)); | 163 }.bind(this)); |
164 } | 164 } |
165 } | 165 } |
166 }; | 166 }; |
167 | 167 |
168 module.exports = DOMAgent; | 168 module.exports = DOMAgent; |
169 </script> | 169 </script> |
OLD | NEW |