0.17.0 • Published 9 years ago

scoped-property-store v0.17.0

Weekly downloads
309
License
-
Repository
github
Last release
9 years ago

Scoped Property Store Build Status

Stores and retrieves properties associated with CSS selectors.

Currently, this library only supports the combinations of the following elements. More could be added pretty easily.

  • Element names: div
  • Class names: .foo
  • Simple attributes: [foo=bar]
  • Descendant selectors: .foo .bar
  • Child selectors: .foo > .bar

Usage:

ScopedPropertyScore = require 'scoped-property-store'
store = new ScopedPropertyScore

# First associate some properties with selectors
disposable = store.addProperties 'some-description',
  '.foo.bar .baz':
    x:
      y: 1
      z: 2

  '.foo':
    x:
      y: 3

# Then query properties based on a string description of a path in the DOM.
store.get('div.foo.bar p.baz', 'x.y') # ==> 1
store.get('div.foo.bar p.baz', 'x.z') # ==> 2

# Falls back to selectors matching an *ancestor* if necessary
store.get('div.foo p.baz', 'x.y') # ==> 3

# You can also remove properties via the returned Disposable
disposable.dispose()
0.17.0

9 years ago

0.16.2

9 years ago

0.16.1

9 years ago

0.16.0

9 years ago

0.15.5

9 years ago

0.15.4

9 years ago

0.15.3

9 years ago

0.15.2

9 years ago

0.15.1

9 years ago

0.15.0

10 years ago

0.14.0

10 years ago

0.13.2

10 years ago

0.13.1

10 years ago

0.13.0

10 years ago

0.12.0

10 years ago

0.11.0

10 years ago

0.10.0

10 years ago

0.9.0

10 years ago

0.8.0

10 years ago

0.7.0

10 years ago

0.6.0

10 years ago

0.5.0

10 years ago

0.4.0

10 years ago

0.3.0

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago