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

Crash with --bem and data-bem="{}" #106

Closed
scf2k opened this issue Sep 23, 2014 · 8 comments · Fixed by #107
Closed

Crash with --bem and data-bem="{}" #106

scf2k opened this issue Sep 23, 2014 · 8 comments · Fixed by #107
Labels

Comments

@scf2k
Copy link

scf2k commented Sep 23, 2014

Content of the first file

<button class="button button_theme_normal i-bem" onclick="{&quot;button&quot;:{}};" role="button" type="button"><span class="button__text">Yandex</span></button>

Second file

<button class="button button_theme_normal i-bem" data-bem="{&quot;button&quot;:{}}" role="button" type="button"><span class="button__text">Yandex</span></button>

htmldiffer file1 file2 --bem
gives a error

SyntaxError: Unexpected token :
    at Function (unknown source)
    at _parseAttr (/usr/local/lib/node_modules/html-differ/lib/utils/utils.js:106:22)
    at /usr/local/lib/node_modules/html-differ/lib/utils/utils.js:127:25
    at Function.forEach (/usr/local/lib/node_modules/html-differ/node_modules/lodash/dist/lodash.js:3297:15)
    at /usr/local/lib/node_modules/html-differ/lib/utils/utils.js:126:11
    at Function.forEach (/usr/local/lib/node_modules/html-differ/node_modules/lodash/dist/lodash.js:3297:15)
    at Object.sortAttrsValues (/usr/local/lib/node_modules/html-differ/lib/utils/utils.js:114:7)
    at Object.module.exports.SimpleApiParser.startTag (/usr/local/lib/node_modules/html-differ/lib/utils/modify.js:42:35)
    at SimpleApiParser._handleToken (/usr/local/lib/node_modules/html-differ/node_modules/parse5/lib/simple_api/simple_api_parser.js:45:23)
    at SimpleApiParser.parse (/usr/local/lib/node_modules/html-differ/node_modules/parse5/lib/simple_api/simple_api_parser.js:37:18)
@scf2k scf2k added the bug label Sep 23, 2014
@eGavr
Copy link
Member

eGavr commented Sep 24, 2014

I've found the illegal declaration of onclick attribute ->

onclick="{&quot;button&quot;:{}};"

It has to be

onclick="return {&quot;button&quot;:{}};"

Hasn't it?

@scf2k
Copy link
Author

scf2k commented Sep 24, 2014

It crashes while parsing data-bem attribute, not onclick. Anyway, whatever value is, the app shouldn't crash.

@eGavr
Copy link
Member

eGavr commented Sep 24, 2014

No! it crashes on 'onclick' attr, cause I've added return to the value and everything was alright.`

@eGavr
Copy link
Member

eGavr commented Sep 24, 2014

All in all... it will be fixed soon.

@scf2k
Copy link
Author

scf2k commented Sep 29, 2014

Any news on this?

@eGavr
Copy link
Member

eGavr commented Sep 29, 2014

few days and will be fixed!
No any problems with the solving this issue.

@eGavr
Copy link
Member

eGavr commented Sep 29, 2014

NOTE!

onclick="{&quot;button&quot;:{}};"

Such kind of declaration of onclick attr is invalid, so in the fixed version, during the comparison this piece of code will turn into

onclick="return undefined"

@eGavr eGavr mentioned this issue Oct 1, 2014
@eGavr eGavr closed this as completed in #107 Oct 1, 2014
@eGavr
Copy link
Member

eGavr commented Oct 1, 2014

fixed in v1.0.1

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

Successfully merging a pull request may close this issue.

2 participants