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

attr-lowercase should ignore camelCase SVG attributes by default #542

Closed
ricealexander opened this issue Sep 14, 2020 · 4 comments · Fixed by #828
Closed

attr-lowercase should ignore camelCase SVG attributes by default #542

ricealexander opened this issue Sep 14, 2020 · 4 comments · Fixed by #828
Labels
bug Functionality that does not work as intended/expected keep-unstale The issue will not be marked as stale by the stale-bot PR needed

Comments

@ricealexander
Copy link

Is your feature request related to a problem? Please describe.
attr-lowercase enforces that all attributes of elements should be lowercase.

SVG elements have attributes that are camelCase, such as the viewBox attribute in the following example. Because the camelCase form is correct, displaying the error "The attribute name of [ viewBox ] must be in lowercase" is erroneous.

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
  <path d="M256 8c137 0 248 111 248 248S393 504 256 504 8 393 8 256 119 8 256 8zM140 300h116v70.9c0 10.7 13 16.1 20.5 8.5l114.3-114.9c4.7-4.7 4.7-12.2 0-16.9l-114.3-115c-7.6-7.6-20.5-2.2-20.5 8.5V212H140c-6.6 0-12 5.4-12 12v64c0 6.6 5.4 12 12 12z"></path>
</svg>

Describe the solution you'd like
attr-lowercase should understand which SVG attributes are camelCase and should not report errors for these attributes.

A list of camelCase SVG attributes is below:

  • allowReorder
  • attributeName
  • attributeType
  • autoReverse
  • baseFrequency
  • baseProfile
  • calcMode
  • clipPathUnits
  • contentScriptType
  • contentStyleType
  • diffuseConstant
  • edgeMode
  • externalResourcesRequired
  • filterRes
  • filterUnits
  • glyphRef
  • gradientTransform
  • gradientUnits
  • kernelMatrix
  • kernelUnitLength
  • keyPoints
  • keySplines
  • keyTimes
  • lengthAdjust
  • limitingConeAngle
  • markerHeight
  • markerUnits
  • markerWidth
  • maskContentUnits
  • maskUnits
  • numOctaves
  • pathLength
  • patternContentUnits
  • patternTransform
  • patternUnits
  • pointsAtX
  • pointsAtY
  • pointsAtZ
  • preserveAlpha
  • preserveAspectRatio
  • primitiveUnits
  • referrerPolicy
  • repeatCount
  • repeatDur
  • requiredExtensions
  • requiredFeatures
  • specularConstant
  • specularExponent
  • spreadMethod
  • startOffset
  • stdDeviation
  • stitchTiles
  • surfaceScale
  • systemLanguage
  • tableValues
  • targetX
  • targetY
  • textLength
  • viewBox
  • viewTarget
  • xChannelSelector
  • yChannelSelector
  • zoomAndPan

Describe alternatives you've considered
When this was brought up (#28), the advice was to add each SVG attribute to the allowList, like so:

{
  "tagname-lowercase": ["viewBox"]
}

This is also the described solution in the attr-lowercase documentation and in pulls #121 and #188.

As you can see with the list of camelCase attributes above, in order to allow camelCase SVG attributes, I'd need to allow over 60 attributes in my configuration. This is not an ideal situation because I don't want to create a large configuration just to prevent correctly-formed attributes from throwing errors.

@stale
Copy link

stale bot commented Nov 13, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the bot:stale Issue marked as stale because there was no activity label Nov 13, 2020
@ricealexander
Copy link
Author

The issue is still relevant.
The default behavior of attr-lowercase treats SVG elements erroneously.

@stale stale bot removed the bot:stale Issue marked as stale because there was no activity label Nov 14, 2020
@stale
Copy link

stale bot commented Jan 13, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the bot:stale Issue marked as stale because there was no activity label Jan 13, 2021
@stale stale bot closed this as completed Jan 27, 2021
@coliff
Copy link
Member

coliff commented Jun 10, 2021

@thedaviddias this issue should be re-opened.

For anyone who is looking for a quick fix... add this to your .htmlhintrc

  "attr-lowercase": [
    "allowReorder",
    "attributeName",
    "attributeType",
    "autoReverse",
    "baseFrequency",
    "baseProfile",
    "calcMode",
    "clipPath",
    "clipPathUnits",
    "contentScriptType",
    "contentStyleType",
    "diffuseConstant",
    "edgeMode",
    "externalResourcesRequired",
    "filterRes",
    "filterUnits",
    "glyphRef",
    "gradientTransform",
    "gradientUnits",
    "kernelMatrix",
    "kernelUnitLength",
    "keyPoints",
    "keySplines",
    "keyTimes",
    "lengthAdjust",
    "limitingConeAngle",
    "markerHeight",
    "markerUnits",
    "markerWidth",
    "maskContentUnits",
    "maskUnits",
    "numOctaves",
    "onBlur",
    "onChange",
    "onClick",
    "onFocus",
    "onKeyUp",
    "onLoad",
    "pathLength",
    "patternContentUnits",
    "patternTransform",
    "patternUnits",
    "pointsAtX",
    "pointsAtY",
    "pointsAtZ",
    "preserveAlpha",
    "preserveAspectRatio",
    "primitiveUnits",
    "refX",
    "refY",
    "repeatCount",
    "repeatDur",
    "requiredExtensions",
    "requiredFeatures",
    "specularConstant",
    "specularExponent",
    "spreadMethod",
    "startOffset",
    "stdDeviation",
    "stitchTiles",
    "surfaceScale",
    "systemLanguage",
    "tableValues",
    "targetX",
    "targetY",
    "textLength",
    "viewBox",
    "viewTarget",
    "xChannelSelector",
    "yChannelSelector",
    "zoomAndPan"
  ],

@thedaviddias thedaviddias added keep-unstale The issue will not be marked as stale by the stale-bot and removed bot:stale Issue marked as stale because there was no activity labels Jun 10, 2021
@thedaviddias thedaviddias reopened this Jun 10, 2021
@thedaviddias thedaviddias added bug Functionality that does not work as intended/expected PR needed labels Jun 10, 2021
nschonni added a commit to nschonni/HTMLHint that referenced this issue Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality that does not work as intended/expected keep-unstale The issue will not be marked as stale by the stale-bot PR needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants