diff --git a/package.json b/package.json index bc7731ce2..b4667bd2a 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "flow-parser": "0.174.1", "get-stdin": "8.0.0", "graphql": "15.6.1", - "html-element-attributes": "2.3.0", + "html-element-attributes": "3.1.0", "html-styles": "1.0.0", "html-tag-names": "1.1.5", "html-void-elements": "2.0.1", diff --git a/scripts/vendors/vendor-meta.json b/scripts/vendors/vendor-meta.json index 4cae144b2..8a3901417 100644 --- a/scripts/vendors/vendor-meta.json +++ b/scripts/vendors/vendor-meta.json @@ -1514,6 +1514,29 @@ "url": "https://wooorm.com" } ] + }, + { + "name": "html-element-attributes", + "maintainers": [], + "version": "3.1.0", + "description": "Map of HTML elements to allowed attributes", + "repository": "wooorm/html-element-attributes", + "homepage": null, + "private": false, + "license": "MIT", + "licenseText": "(The MIT License)\n\nCopyright (c) 2016 Titus Wormer \n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n", + "author": { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + }, + "contributors": [ + { + "name": "Titus Wormer", + "email": "tituswormer@gmail.com", + "url": "https://wooorm.com" + } + ] } ] } diff --git a/scripts/vendors/vendors.mjs b/scripts/vendors/vendors.mjs index 26f75ad0f..ebe67db76 100644 --- a/scripts/vendors/vendors.mjs +++ b/scripts/vendors/vendors.mjs @@ -5,6 +5,7 @@ const vendors = [ "tempy", "chalk", "html-void-elements", + "html-element-attributes", ]; export default vendors; diff --git a/src/language-html/utils/html-elements-attributes.js b/src/language-html/utils/html-elements-attributes.js index c62a07632..b104ff3e0 100644 --- a/src/language-html/utils/html-elements-attributes.js +++ b/src/language-html/utils/html-elements-attributes.js @@ -1,6 +1,8 @@ "use strict"; -const htmlElementAttributes = require("html-element-attributes"); +const { + htmlElementAttributes, +} = require("../../../vendors/html-element-attributes.json"); const mapObject = require("./map-object.js"); const arrayToMap = require("./array-to-map.js"); diff --git a/vendors/html-element-attributes.json b/vendors/html-element-attributes.json new file mode 100644 index 000000000..a35506d79 --- /dev/null +++ b/vendors/html-element-attributes.json @@ -0,0 +1,575 @@ +{ + "htmlElementAttributes": { + "*": [ + "accesskey", + "autocapitalize", + "autofocus", + "class", + "contenteditable", + "dir", + "draggable", + "enterkeyhint", + "hidden", + "id", + "inputmode", + "is", + "itemid", + "itemprop", + "itemref", + "itemscope", + "itemtype", + "lang", + "nonce", + "slot", + "spellcheck", + "style", + "tabindex", + "title", + "translate" + ], + "a": [ + "charset", + "coords", + "download", + "href", + "hreflang", + "name", + "ping", + "referrerpolicy", + "rel", + "rev", + "shape", + "target", + "type" + ], + "applet": [ + "align", + "alt", + "archive", + "code", + "codebase", + "height", + "hspace", + "name", + "object", + "vspace", + "width" + ], + "area": [ + "alt", + "coords", + "download", + "href", + "hreflang", + "nohref", + "ping", + "referrerpolicy", + "rel", + "shape", + "target", + "type" + ], + "audio": [ + "autoplay", + "controls", + "crossorigin", + "loop", + "muted", + "preload", + "src" + ], + "base": [ + "href", + "target" + ], + "basefont": [ + "color", + "face", + "size" + ], + "blockquote": [ + "cite" + ], + "body": [ + "alink", + "background", + "bgcolor", + "link", + "text", + "vlink" + ], + "br": [ + "clear" + ], + "button": [ + "disabled", + "form", + "formaction", + "formenctype", + "formmethod", + "formnovalidate", + "formtarget", + "name", + "type", + "value" + ], + "canvas": [ + "height", + "width" + ], + "caption": [ + "align" + ], + "col": [ + "align", + "char", + "charoff", + "span", + "valign", + "width" + ], + "colgroup": [ + "align", + "char", + "charoff", + "span", + "valign", + "width" + ], + "data": [ + "value" + ], + "del": [ + "cite", + "datetime" + ], + "details": [ + "open" + ], + "dialog": [ + "open" + ], + "dir": [ + "compact" + ], + "div": [ + "align" + ], + "dl": [ + "compact" + ], + "embed": [ + "height", + "src", + "type", + "width" + ], + "fieldset": [ + "disabled", + "form", + "name" + ], + "font": [ + "color", + "face", + "size" + ], + "form": [ + "accept", + "accept-charset", + "action", + "autocomplete", + "enctype", + "method", + "name", + "novalidate", + "target" + ], + "frame": [ + "frameborder", + "longdesc", + "marginheight", + "marginwidth", + "name", + "noresize", + "scrolling", + "src" + ], + "frameset": [ + "cols", + "rows" + ], + "h1": [ + "align" + ], + "h2": [ + "align" + ], + "h3": [ + "align" + ], + "h4": [ + "align" + ], + "h5": [ + "align" + ], + "h6": [ + "align" + ], + "head": [ + "profile" + ], + "hr": [ + "align", + "noshade", + "size", + "width" + ], + "html": [ + "manifest", + "version" + ], + "iframe": [ + "align", + "allow", + "allowfullscreen", + "allowpaymentrequest", + "allowusermedia", + "frameborder", + "height", + "loading", + "longdesc", + "marginheight", + "marginwidth", + "name", + "referrerpolicy", + "sandbox", + "scrolling", + "src", + "srcdoc", + "width" + ], + "img": [ + "align", + "alt", + "border", + "crossorigin", + "decoding", + "height", + "hspace", + "ismap", + "loading", + "longdesc", + "name", + "referrerpolicy", + "sizes", + "src", + "srcset", + "usemap", + "vspace", + "width" + ], + "input": [ + "accept", + "align", + "alt", + "autocomplete", + "checked", + "dirname", + "disabled", + "form", + "formaction", + "formenctype", + "formmethod", + "formnovalidate", + "formtarget", + "height", + "ismap", + "list", + "max", + "maxlength", + "min", + "minlength", + "multiple", + "name", + "pattern", + "placeholder", + "readonly", + "required", + "size", + "src", + "step", + "type", + "usemap", + "value", + "width" + ], + "ins": [ + "cite", + "datetime" + ], + "isindex": [ + "prompt" + ], + "label": [ + "for", + "form" + ], + "legend": [ + "align" + ], + "li": [ + "type", + "value" + ], + "link": [ + "as", + "charset", + "color", + "crossorigin", + "disabled", + "href", + "hreflang", + "imagesizes", + "imagesrcset", + "integrity", + "media", + "referrerpolicy", + "rel", + "rev", + "sizes", + "target", + "type" + ], + "map": [ + "name" + ], + "menu": [ + "compact" + ], + "meta": [ + "charset", + "content", + "http-equiv", + "media", + "name", + "scheme" + ], + "meter": [ + "high", + "low", + "max", + "min", + "optimum", + "value" + ], + "object": [ + "align", + "archive", + "border", + "classid", + "codebase", + "codetype", + "data", + "declare", + "form", + "height", + "hspace", + "name", + "standby", + "type", + "typemustmatch", + "usemap", + "vspace", + "width" + ], + "ol": [ + "compact", + "reversed", + "start", + "type" + ], + "optgroup": [ + "disabled", + "label" + ], + "option": [ + "disabled", + "label", + "selected", + "value" + ], + "output": [ + "for", + "form", + "name" + ], + "p": [ + "align" + ], + "param": [ + "name", + "type", + "value", + "valuetype" + ], + "pre": [ + "width" + ], + "progress": [ + "max", + "value" + ], + "q": [ + "cite" + ], + "script": [ + "async", + "charset", + "crossorigin", + "defer", + "integrity", + "language", + "nomodule", + "referrerpolicy", + "src", + "type" + ], + "select": [ + "autocomplete", + "disabled", + "form", + "multiple", + "name", + "required", + "size" + ], + "slot": [ + "name" + ], + "source": [ + "height", + "media", + "sizes", + "src", + "srcset", + "type", + "width" + ], + "style": [ + "media", + "type" + ], + "table": [ + "align", + "bgcolor", + "border", + "cellpadding", + "cellspacing", + "frame", + "rules", + "summary", + "width" + ], + "tbody": [ + "align", + "char", + "charoff", + "valign" + ], + "td": [ + "abbr", + "align", + "axis", + "bgcolor", + "char", + "charoff", + "colspan", + "headers", + "height", + "nowrap", + "rowspan", + "scope", + "valign", + "width" + ], + "textarea": [ + "autocomplete", + "cols", + "dirname", + "disabled", + "form", + "maxlength", + "minlength", + "name", + "placeholder", + "readonly", + "required", + "rows", + "wrap" + ], + "tfoot": [ + "align", + "char", + "charoff", + "valign" + ], + "th": [ + "abbr", + "align", + "axis", + "bgcolor", + "char", + "charoff", + "colspan", + "headers", + "height", + "nowrap", + "rowspan", + "scope", + "valign", + "width" + ], + "thead": [ + "align", + "char", + "charoff", + "valign" + ], + "time": [ + "datetime" + ], + "tr": [ + "align", + "bgcolor", + "char", + "charoff", + "valign" + ], + "track": [ + "default", + "kind", + "label", + "src", + "srclang" + ], + "ul": [ + "compact", + "type" + ], + "video": [ + "autoplay", + "controls", + "crossorigin", + "height", + "loop", + "muted", + "playsinline", + "poster", + "preload", + "src", + "width" + ] + } +} diff --git a/yarn.lock b/yarn.lock index eba705f9a..c9dde1cec 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3591,10 +3591,10 @@ hosted-git-info@^2.1.4: resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9" integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw== -html-element-attributes@2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/html-element-attributes/-/html-element-attributes-2.3.0.tgz#a192ac90a457be9f1e2cc9ab69000ee89be74aa6" - integrity sha512-RJv2v3BBaYSc0ODHwT0sqWI+2lFs6DATBvCRnW20BDmULxoAWvfT6r28uL8LcW1a9/eqUl+1DccUOJzw00qVXQ== +html-element-attributes@3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/html-element-attributes/-/html-element-attributes-3.1.0.tgz#07869037b9020bec3bb1897263e97dd65829d15b" + integrity sha512-cHM9qM06tyWHwvGqDqVEBwoYtGgyq7X/GQt3dor38M1hYMZw1yVadaDQrwwQer6NefiYAoHaqFARI8ETMCAOYA== html-encoding-sniffer@^2.0.1: version "2.0.1"