Skip to content
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.

Fix attribute parser to support edge-cases #26

Closed
saurabhdaware opened this issue Sep 3, 2020 · 5 comments
Closed

Fix attribute parser to support edge-cases #26

saurabhdaware opened this issue Sep 3, 2020 · 5 comments

Comments

@saurabhdaware
Copy link
Member

Current parseAttribute function in src/component-parser.js file fails for cases like onload="this.rel= 'stylesheet'; this.onload=null"

In current method, we split string on spaces and consider it as separate attribute value combination and then we separate on = to find key and value.

@saurabhdaware
Copy link
Member Author

@pantharshit00 Do you have any idea on how we can solve this? in #25 how are you adding attributes to node? can we use similar thing to get attributes from node?

@saurabhdaware
Copy link
Member Author

So we can use @babel/parser to get attributes:
https://astexplorer.net/#/gist/bce6cfbb702ee968a9f8ba96beaf15a1/707f5de6866e24ad1397591b6a0997b5a4e92120

Apart from this we can also use @babel/parser for #24

@pantharshit00
Copy link
Member

@saurabhdaware In #25, I am just appending my attribute before > of a html opening tag.

I don't really parse anything because I don't need to parse anything.

Here is the code for that: https://github.com/pantharshit00/abell-renderer/blob/21d4a451f5e3455bf25e6518e10c6fba38afff43/src/post-compilation.js#L4

@saurabhdaware
Copy link
Member Author

This will be fixed in https://github.com/abelljs/abell-renderer/tree/next

@saurabhdaware
Copy link
Member Author

Hopefully fixed in #27

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants