Skip to content

Add more selector combinators#100

Merged
garyb merged 1 commit into
purescript-contrib:masterfrom
vyorkin-forks:feature/selector-combinators
Jul 9, 2018
Merged

Add more selector combinators#100
garyb merged 1 commit into
purescript-contrib:masterfrom
vyorkin-forks:feature/selector-combinators

Conversation

@vyorkin

@vyorkin vyorkin commented Jul 9, 2018

Copy link
Copy Markdown
Collaborator

This PR is a 100% port from Clay, no other additions from my side.

Resolves #98

@vyorkin

vyorkin commented Jul 9, 2018

Copy link
Copy Markdown
Collaborator Author

Please, don't merge yet, I'm going to add a couple of tests.
I'll add more tests after migrating to purescript-test-unit as we've discussed in #30

@garyb garyb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of bikesheddy thoughts:

Comment thread src/CSS/Selector.purs Outdated
-- | Maps to `sel1 sel2` in CSS.
deep :: Selector -> Selector -> Selector
deep a b = Selector (Refinement []) (Deep a b)
infix 6 deep as **

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could change this to |* for a kind of consistency with >, +?

@vyorkin vyorkin Jul 9, 2018

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I also think this is going to look nicer :)

Comment thread src/CSS/Selector.purs Outdated
-- | depending on the filter.
with :: Selector -> Refinement -> Selector
with (Selector (Refinement fs) e) (Refinement ps) = Selector (Refinement (fs <> ps)) e
infix 6 with as ##

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use & here perhaps, since it expresses combination nicely? I guess it's not done in Haskell since & is an operator there (that operator is actually # in PS 😄)

@vyorkin vyorkin Jul 9, 2018

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, good point, thanks! (btw this might be a breaking change though as this operator was there before)

@vyorkin vyorkin force-pushed the feature/selector-combinators branch from f07c1cb to bd0debd Compare July 9, 2018 12:19
@vyorkin vyorkin force-pushed the feature/selector-combinators branch from bd0debd to bd25238 Compare July 9, 2018 13:05
@vyorkin

vyorkin commented Jul 9, 2018

Copy link
Copy Markdown
Collaborator Author

Ok, I've added some tests & rebased, should be ready for review.
I think now it supports everything from here https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors (except [attr operator value i])

@garyb garyb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great 👍

Did you still want to hold off merging until things are updated for -test-unit?

@vyorkin

vyorkin commented Jul 9, 2018

Copy link
Copy Markdown
Collaborator Author

Actually I wanted to migrate tests after merging PR's :) is it ok?

@garyb

garyb commented Jul 9, 2018

Copy link
Copy Markdown
Member

Sure thing!

@garyb garyb merged commit f86824b into purescript-contrib:master Jul 9, 2018
@vyorkin vyorkin deleted the feature/selector-combinators branch July 9, 2018 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants