From e066730b6835bf1645d9d67302fe590267bd1f1d Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 24 Mar 2016 12:46:35 +0100 Subject: [PATCH] add notes about how hyperjson is to be used --- www/common/hyperjson.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/www/common/hyperjson.js b/www/common/hyperjson.js index 31a2caf08..880a7fe3e 100644 --- a/www/common/hyperjson.js +++ b/www/common/hyperjson.js @@ -47,6 +47,13 @@ define([], function () { return x; }; + /* DOM2HyperJSON accepts a DOM element/node + and converts it into Hyperjson. It optionally accepts a predicate + which is used for filtering out subtrees of the DOM from the result. + + The function, if provided, must return true for elements which + should be preserved, and 'false' for elements which should be removed. + */ var DOM2HyperJSON = function(el, predicate){ if(!el.tagName && el.nodeType === Node.TEXT_NODE){ return el.textContent;