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

suggestion: exclude some attribute via attrNameProcessors and pass Node Info to Processors #228

Open
finscn opened this issue Aug 25, 2015 · 4 comments

Comments

@finscn
Copy link

finscn commented Aug 25, 2015

if attrNameProcessors return false, the parser could ignore the attribute.

And I hope parser could pass 'node' object to Processors Function.

Because we process attributes not only according to its name usually, we also need to know the attribute's owner , owner's parent and parent's parent ...

My english is very weak , sorry

@Leonidas-from-XIV
Copy link
Owner

That does sound useful, yes. The first part is easy enough, the second part trickier since it involves compiling information about that attribute.

PRs welcome!

@finscn
Copy link
Author

finscn commented Aug 26, 2015

@Leonidas-from-XIV , I don't know any thing about CoffeeScript ... So ... I don't know how to give you PRs . Sorry

@Leonidas-from-XIV
Copy link
Owner

It is basically just JavaScript with a slightly nicer syntax, reading http://coffeescript.org/#overview is usually enough to get started.

@sant123
Copy link

sant123 commented Sep 20, 2016

@Leonidas-from-XIV I'm interested to make a PR for this, I saw these methods:

  • tagNameProcessors
  • attrNameProcessors
  • attrValueProcessors

They do not have problems in order to pass the node object through the processor function. However this method:

  • valueProcessors

The only way to find the node object is using the current this in the function. I mean...

tag = @tag # will not work.
tag = this.tag # will work!.

The issue comes using fat arrows, because the @ or the this is equal to your current object "that is right in this case". But in order to get the tag information like attributes, name, isSelfClosing, etc. I need to access to the current this in the function. The only thing I found to solve this is:

tag = `this.tag`

What do you think about it? 💭

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants