Skip to content

Instantly share code, notes, and snippets.

// addSpanToDomTree will find a subsection of the text content in a given dom tree
// apply span tag around it, give it clsName as class attribute and attach all events
// specified in eventMap
// domRoot: the root of the dom tree that needs to be decorated
// node: node object that is obtained from codatlas server
// clsName: class name of the node
// eventMap: a map of events that needs to be attached to the span. e.g. {"click", function(data){console.log(data)}}
SourcePageDecorator.addSpanToDomTree = function(domRoot, node, clsName, eventMap)
// Usage example: