OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. |
3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 | 305 |
306 _addAttribute: function(name, value) | 306 _addAttribute: function(name, value) |
307 { | 307 { |
308 var attr = { | 308 var attr = { |
309 "name": name, | 309 "name": name, |
310 "value": value, | 310 "value": value, |
311 "_node": this | 311 "_node": this |
312 }; | 312 }; |
313 this._attributesMap[name] = attr; | 313 this._attributesMap[name] = attr; |
314 this._attributes.push(attr); | 314 this._attributes.push(attr); |
| 315 }, |
| 316 |
| 317 ownerDocumentElement: function() |
| 318 { |
| 319 // document element is the child of the document / frame owner node that
has documentURL property. |
| 320 // FIXME: return document nodes as a part of the DOM tree structure. |
| 321 var node = this; |
| 322 while (node.parentNode && !node.parentNode.documentURL) |
| 323 node = node.parentNode; |
| 324 return node; |
315 } | 325 } |
316 } | 326 } |
317 | 327 |
318 WebInspector.DOMDocument = function(domAgent, payload) | 328 WebInspector.DOMDocument = function(domAgent, payload) |
319 { | 329 { |
320 WebInspector.DOMNode.call(this, this, payload); | 330 WebInspector.DOMNode.call(this, this, payload); |
321 this._listeners = {}; | 331 this._listeners = {}; |
322 this._domAgent = domAgent; | 332 this._domAgent = domAgent; |
323 } | 333 } |
324 | 334 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 { | 390 { |
381 this._dispatchWhenDocumentAvailable(DOMAgent.pushNodeByPathToFrontend.bi
nd(DOMAgent), path, callback); | 391 this._dispatchWhenDocumentAvailable(DOMAgent.pushNodeByPathToFrontend.bi
nd(DOMAgent), path, callback); |
382 }, | 392 }, |
383 | 393 |
384 _wrapClientCallback: function(callback) | 394 _wrapClientCallback: function(callback) |
385 { | 395 { |
386 if (!callback) | 396 if (!callback) |
387 return; | 397 return; |
388 return function(error, result) | 398 return function(error, result) |
389 { | 399 { |
| 400 if (error) |
| 401 console.error("Error during DOMAgent operation: " + error); |
390 callback(error ? null : result); | 402 callback(error ? null : result); |
391 } | 403 } |
392 }, | 404 }, |
393 | 405 |
394 _dispatchWhenDocumentAvailable: function(action) | 406 _dispatchWhenDocumentAvailable: function(action) |
395 { | 407 { |
396 var requestArguments = Array.prototype.slice.call(arguments, 1); | 408 var requestArguments = Array.prototype.slice.call(arguments, 1); |
397 var callbackWrapper; | 409 var callbackWrapper; |
398 | 410 |
399 if (typeof requestArguments[requestArguments.length - 1] === "function")
{ | 411 if (typeof requestArguments[requestArguments.length - 1] === "function")
{ |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 { | 588 { |
577 WebInspector.updateFocusedNode(nodeId); | 589 WebInspector.updateFocusedNode(nodeId); |
578 }, | 590 }, |
579 | 591 |
580 searchResults: function(nodeIds) | 592 searchResults: function(nodeIds) |
581 { | 593 { |
582 if (this._domAgent._searchResultCollector) | 594 if (this._domAgent._searchResultCollector) |
583 this._domAgent._searchResultCollector(nodeIds); | 595 this._domAgent._searchResultCollector(nodeIds); |
584 } | 596 } |
585 } | 597 } |
OLD | NEW |