Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hocr-dom

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hocr-dom

Extend HTMLDocument and Element with hOCR query and property helpers

  • 0.1.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

hocr-dom

API

HocrDOM

HocrDOM.isHocrElement(context, options, cache)

true if this has an ocr_* class, false otherwise

  • @param {Document|Element} context Context element
  • @param {Object} options See Options
  • @param {Object} cache If provided, will cache the properties in this object with key _hocr
HocrDOM.getHocrProperties(context, options, cache)

List the properties of this hOCR element as an object

  • @param {Document|Element} context Context element
  • @param {Object} options See Options
  • @param {Object} cache If provided, will cache the properties in this object with key _hocr
HocrDOM.queryHocr(context, query, options)

Find the first hOCR element matching query

See queryHocrAll for options

HocrDOM.queryHocrAll(context, query, options)
  • @param {Document|Element} context Context element
  • @param {String|Object} query Object of query parameters. If a string -> query.class
    • @param {String} query.tag tag names to look for. Default '*'
    • @param {String} query.title title attribute must contain this string
    • @param {String} query.clauses String of clauses for querySelector
    • @param {String|Array} class Elements with this class (if string) or any of these classes (if array)
    • @param {String} query.context context element to query below. Otherwise root element of DOM.
    • @param {String} query.terminal Return only hocr-elements containing no hocr-elements themselves
    • @param {String} query.nonTerminal Opposite of terminal
    • @param {String} query.filter Arbitrary filter to prune resulting element set
HocrDOM.extendPrototypes({Element, Document}, options)

Extend the prototypes of Element and Document with hOCR-specific methods and properties.

el.queryHocr(query, options)

Same as HocrDOM.queryHocr but with context set to el

el.queryHocrAll(query, options)

Same as HocrDOM.queryHocrAll but with context set to el

el.isHocrElement

Property containing whether this is an hOCR element

el.hocr

Property containing the hOCR properties

PropertyParser

new HocrPropertyParser(opts)
  • @param {Object} opts All options are false by default
    • @param {Object} opts.debug Whether to log debug output
    • @param {Object} opts.allowUnknown Whether to silently ignore properties not in the spec
    • @param {Object} opts.allowInvalidNumbers Whether to silently ignore invalid number (wrong type e.g.)
    • @param {Object} opts.disableCardinalityChecks Whether to silently ignore invalid argument cardinality
parse(str)

Tokenize and Parse the hOCR properties in a title string

Keywords

FAQs

Package last updated on 27 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc