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

html5+svg attributes are camelCase #28

Closed
sglaser opened this issue May 21, 2014 · 7 comments
Closed

html5+svg attributes are camelCase #28

sglaser opened this issue May 21, 2014 · 7 comments

Comments

@sglaser
Copy link

sglaser commented May 21, 2014

In SVG, some attributes are camelCase. I'm using Brackets with the HTMLHint extension and HTMLHint flags them as errors. For example, it complains about viewBox in this snippet.

<div class="svg hasSVG">
   <svg version="1.1" width="100%" height="194" viewBox="0 0 740 194">
      <g>
         <text x="512" y="12" class="regBitNum">0</text>
          <text x="16" y="12" class="regBitNum">31</text>
          <path d="M520,2l0,16M424,2l0,16M376,2l0,16M360,2l0,16M344,2l0,16M328,2l0,16M312,2l0,16M440,2l0,16M392,2l0,16M296,2l0,16M8,5.333333333333333l0,16" class="regBitNumLine" fill="none"></path>
       </g>
   </svg>
</div>

Ideally, HTMLHint would have a list of attributes that are camelCase (that can be extended / controlled by the user). Extra credit if it knows which tags allow which attribute.

@yaniswang
Copy link
Contributor

If not all of your attrs is lowercase, you can try to turn off the rule: attr-lowercase.

@benschwarz
Copy link

@yaniswang Seems like it'd be worth adding some whitelist attributes (like viewBox) to your attr-lowercase test. Happy to help / PR, if we can win you over 🐙 👍

@MetaMemoryT
Copy link

If the doctype is html5 attr-lowercase should automatically be turned off.

@yaniswang
Copy link
Contributor

I suggest to choose our own rules set, if i use in HTML5, then you no need to choose attr-lowercase rule.

molant added a commit to molant/HTMLHint that referenced this issue Apr 15, 2016
When enabling the rule instead of using a boolean, use an array with the attributes (camelCased) that you want to ignore
```json
{
  "attr-lowercase": ["viewBox"]
}
```
Fixes htmlhint#28
@rodrigogoncalves
Copy link

Could it be the case for tagname-lowercase rule as well? In the svg world there are tags which are also camel cased. I've noticed that #121 is a one-liner that solves the problem for attributes, perhaps we could use almost the same code for tagname too?

@hacknug
Copy link

hacknug commented Apr 25, 2017

Any plans on merging #188 in?

@ghost
Copy link

ghost commented Feb 12, 2018

My HTML document's first line is <!DOCTYPE html> (HTML5), but I'm still getting "The attribute name of [ patternUnits ] must be in lowercase" errors.

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

No branches or pull requests

6 participants