Fnodes

Fnodes are typically returned from methods on Fathom rulesets.

class Fnode(element, ruleset)

A wrapper around a DOM node, storing types, scores, and notes that apply to it

Arguments
  • element – The DOM element described by the fnode.

  • ruleset – The ruleset which created the fnode.

Fnode.element

The raw DOM element this fnode describes

Fnode.hasNoteFor(type)

Return whether this fnode has a note for the given type.

undefined is not considered a note and may be overwritten with impunity.

Fnode.hasType(type)

Return whether the given type is one of the ones attached to the wrapped HTML node.

Fnode.noteFor(type)

Return the fnode’s note for the given type, undefined if none.

Fnode.scoreFor(type)

Return the confidence, in the range (0, 1), that the fnode belongs to the given type, 0 by default.