Skip to content

Adding handling for nth-of-type selectors

Boris Budini requested to merge nellie/nthOfType into master

I got some initial handling for nth-of-type selectors working in this branch. I ended up going a route similar to what @julientaq suggested (parsing the CSS and then adding new attributes to selected elements). It actually seems to be working well (though I ought to write a spec for it, and check out why the pipeline is failing), but I have a few questions for @fchasen re: code conventions and architecture:

  1. Am I adding the new CSS rules in the correct location (polisher.styleSheet)?
  2. Should I use a new classname, instead of a custom attribute? (I just want to make it easy to keep the source content separate from stuff added by paged.)
  3. Should I set the attribute name to something more human readable? (Just using a UUID right now...)
  4. Should this go into a new module? It's not really "paged-media"-specific, but I wasn't sure where else in the folder structure that it might belong.

Any other notes or things you'd do differently?

Edited by Boris Budini

Merge request reports