Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

View Matcher #3609

Closed
pjasiun opened this issue Mar 16, 2016 · 5 comments
Closed

View Matcher #3609

pjasiun opened this issue Mar 16, 2016 · 5 comments
Milestone

Comments

@pjasiun
Copy link

pjasiun commented Mar 16, 2016

It should be possible to check if node or list of nodes match given pattern or list of patterns.

The pattern should be build once for every match:

let matcher = Matcher( 'span{font-weight}' );
matcher.match( element );

It should works for the list of elements:

let matcher = Matcher( 'span{font-weight}' );
let match = matcher.match( element.getPath() );
// variable match should contains details about the found element.

It should handle list of rules:

let matcher = Matcher( [ 'strong', 'b', { tag: 'span', styles: { 'font-weight': weightBold } } ] );

It should handle callback, for example to check children of the element:

let matcher = Matcher();
matcher.add( 'strong' );
matcher.add( 'b' );
matcher.add( { tag: 'span', styles: { 'font-weight': weightBold } } );
matcher.add( callback );
@scofalik
Copy link
Contributor

This Matcher will be very similar to what Schema would use / uses but probably a bit more complex. Do you think we could create some kind of more abstract solution that could be extendable to work in different contexts? I am not saying that we have to do this, just a thought, I noticed a similarity.

OTOH, Schema will soon change so I don't know whether we should take it into consideration.

@Reinmar
Copy link
Member

Reinmar commented Mar 17, 2016

Do you think we could create some kind of more abstract solution that could be extendable to work in different contexts?

That's a dangerous question because it will lead to very challenging design process, to find the common, generic and extensible part. And once we find it and implement it, then it may turn out that Schema or Matcher needs features which stretch that generic concept too much :D.

So, as I don't see a close resemblance, I'm all for coding them independently. We'll have more freedom and it will be faster.

@scofalik
Copy link
Contributor

Yeah, that was my second thought too, still I wanted to share that there is something similar between them. I agree to code them independetly.

@pjasiun
Copy link
Author

pjasiun commented Mar 17, 2016

I think that it is aways a good direction to create specific solution, find the common part and export it to the generic solution, if you it find useful. Creating very generic solution at the begging usually lead to the code which is very hard to maintain.

@pjasiun
Copy link
Author

pjasiun commented Mar 17, 2016

Additional matcher feature may be handling wildcards (div[on*]).

@szymonkups szymonkups self-assigned this Apr 1, 2016
@pjasiun pjasiun closed this as completed Apr 6, 2016
@mlewand mlewand transferred this issue from ckeditor/ckeditor5-engine Oct 9, 2019
@mlewand mlewand added this to the v0.1.0 milestone Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants