2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2006-05-17 06:22:16 +04:00
|
|
|
|
2014-05-20 22:17:27 +04:00
|
|
|
#include "nsISupports.idl"
|
2006-05-17 06:22:16 +04:00
|
|
|
|
2018-05-30 05:58:48 +03:00
|
|
|
webidl Node;
|
2006-05-17 06:22:16 +04:00
|
|
|
|
2014-09-24 09:20:43 +04:00
|
|
|
// Note: the iterator does not handle DOM mutations gracefully. So if
|
|
|
|
// the underlying DOM we are iterating over is changed, the behavior
|
|
|
|
// of the walker is undefined. (With the current implementation we
|
|
|
|
// cache the siblings of the current node and this list is not updated
|
|
|
|
// when a mutation occurs).
|
|
|
|
|
|
|
|
[scriptable, uuid(6657e8eb-b646-48e7-993e-cfa6e96415b4)]
|
2014-05-20 22:17:27 +04:00
|
|
|
interface inIDeepTreeWalker : nsISupports
|
2006-05-17 06:22:16 +04:00
|
|
|
{
|
|
|
|
attribute boolean showAnonymousContent;
|
|
|
|
attribute boolean showSubDocuments;
|
2014-09-24 09:20:43 +04:00
|
|
|
|
|
|
|
// By default the walker skips document nodes from the iteration,
|
|
|
|
// by setting this flag to true this behavior can be altered.
|
|
|
|
attribute boolean showDocumentsAsNodes;
|
|
|
|
|
2018-05-30 05:58:48 +03:00
|
|
|
void init(in Node aRoot, in unsigned long aWhatToShow);
|
2014-05-20 22:17:27 +04:00
|
|
|
|
2018-02-01 22:26:12 +03:00
|
|
|
// Methods and attributes that look like TreeWalker.
|
2014-09-24 09:20:43 +04:00
|
|
|
// Note: normally parentNode cannot go further up on the tree once it reached
|
|
|
|
// the root, but setting currentNode does not have this limitation. If currentNode
|
|
|
|
// is set to a node that does not have the root as its ancestor the walk can be
|
|
|
|
// continued from there, and once we reach a node that is 'under' the root, the
|
|
|
|
// limitation for the parentNode will work again.
|
2018-05-30 05:58:48 +03:00
|
|
|
readonly attribute Node root;
|
2014-05-20 22:17:27 +04:00
|
|
|
readonly attribute unsigned long whatToShow;
|
2018-05-30 05:58:48 +03:00
|
|
|
attribute Node currentNode;
|
|
|
|
|
|
|
|
Node parentNode();
|
|
|
|
Node firstChild();
|
|
|
|
Node lastChild();
|
|
|
|
Node previousSibling();
|
|
|
|
Node nextSibling();
|
|
|
|
Node previousNode();
|
|
|
|
Node nextNode();
|
2006-05-17 06:22:16 +04:00
|
|
|
};
|
|
|
|
|