Tip: Getting comments the "xpath" way
|
|
Here's some sample code showing how you can get the html comments using xpath instead of regexp.
var htmlComments = document.evaluate(
'//comment()', document, null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null
);
for (var i = 0; i < htmlComments.snapshotLength; i++)
GM_log('\nFound html comment:\n' + htmlComments.snapshotItem(i).data); // Log to console
|
|
|
Thanks. |