absolutify icon indicating copy to clipboard operation
absolutify copied to clipboard

html attributes in uppercase

Open thesandlord opened this issue 5 years ago • 1 comments

It seems like attributes in uppercase, for example:

<img SRC="/logo.png">

are not detected.

Is this as intended? Happy to submit a PR to fix this!

thesandlord avatar Feb 10 '20 06:02 thesandlord

The workaround is to overwrite the regex with ones that accept uppercase as well:

  var absolutify = require('absolutify')
  absolutify.rx = /((href|src|codebase|cite|background|cite|action|profile|formaction|icon|manifest|archive|HREF|SRC|CODEBASE|CITE|BACKGROUND|CITE|ACTION|PROFILE|FORMACTION|ICON|MANIFEST|ARCHIVE)=["'])(([.]+\/)|(?:\/)|(?=#))(?!\/)/g
  absolutify.captureRx = /((href|src|codebase|cite|background|cite|action|profile|formaction|icon|manifest|archive|HREF|SRC|CODEBASE|CITE|BACKGROUND|CITE|ACTION|PROFILE|FORMACTION|ICON|MANIFEST|ARCHIVE)=["'])((([.]+\/)|(?:\/)|(?:#))(?!\/)[a-zA-Z0-9._-]+)/g

thesandlord avatar Feb 10 '20 06:02 thesandlord