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

Change RegExp to allow special characters as attribute name #130

Closed

Conversation

felixfbecker
Copy link

@felixfbecker felixfbecker commented Apr 30, 2016

Fixes #100

From the W3C HTML specification:

attribute names must consist of one or more characters other than the space characters, U+0000, NULL, """, "'", ">", "/", "=", the control characters, and any characters that are not defined by Unicode.

The current behavior however only allows alphanumeric characters, hyphens and double colons as attribute names, which for example breaks parsing of attributes in Angular 2 and Polymer, which make use of brackets, asterisks or the dollar sign.

This PR changes the regular expression to conform to the W3C HTML spec by allowing anything but "'>/=, whitespace or the control characters U+0000—U+001F (C0 controls), U+007F (delete), and U+0080—U+009F (C1 controls).

This is a much better solution than PR #114, which only whitelists characters used in Angular 2 (brackets and asterisk).

@coveralls
Copy link

coveralls commented Apr 30, 2016

Coverage Status

Coverage remained the same at 98.701% when pulling c5147d6 on felixfbecker:fix-attr-names-regexp into fa5913f on yaniswang:master.

@Zorgatone
Copy link

+1:+1::shipit:

@coveralls
Copy link

coveralls commented Apr 30, 2016

Coverage Status

Coverage remained the same at 98.701% when pulling f5ecc52 on felixfbecker:fix-attr-names-regexp into fa5913f on yaniswang:master.

@coveralls
Copy link

coveralls commented Apr 30, 2016

Coverage Status

Coverage remained the same at 98.701% when pulling 00d80bb on felixfbecker:fix-attr-names-regexp into fa5913f on yaniswang:master.

@yaniswang
Copy link
Contributor

Your code is bad, miss something, i fixed: b6a4d1a

@yaniswang yaniswang closed this May 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants