ドキュメントに表示されるのと同じ順序で、すべての要素、テキストノード、およびコメントノードを選択するためのXPath式は何ですか?
以下は、テキストノードとコメントノードではなく、すべての要素を効果的に選択します。
var result = document.evaluate('//*', document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null),
index = -1;
while (++index < result.snapshotLength) {
console.log(result.snapshotItem(index));
}
次のようなことはできますか?(注:これは機能しない擬似コードです。)
document.evaluate('//* and text() and comment()');