diff --git a/fixtures/attribute-behavior/src/App.js b/fixtures/attribute-behavior/src/App.js index cbbc9d995e..06cfe832cf 100644 --- a/fixtures/attribute-behavior/src/App.js +++ b/fixtures/attribute-behavior/src/App.js @@ -122,7 +122,21 @@ function getProperty(propertyName) { } function getAttribute(attributeName) { - return el => el.getAttribute(attributeName); + return el => { + if (el.namespaceURI === '') { + throw new Error('Not an HTML element.'); + } + return el.getAttribute(attributeName); + }; +} + +function getSVGAttribute(attributeName) { + return el => { + if (el.namespaceURI !== 'http://www.w3.org/2000/svg') { + throw new Error('Not an SVG element.'); + } + return el.getAttribute(attributeName); + }; } const attributes = [ @@ -132,19 +146,19 @@ const attributes = [ name: 'accent-Height', containerTagName: 'svg', tagName: 'font-face', - read: getAttribute('accent-height'), + read: getSVGAttribute('accent-height'), }, { name: 'accent-height', containerTagName: 'svg', tagName: 'font-face', - read: getAttribute('accent-height'), + read: getSVGAttribute('accent-height'), }, { name: 'accentHeight', containerTagName: 'svg', tagName: 'font-face', - read: getAttribute('accent-height'), + read: getSVGAttribute('accent-height'), }, {name: 'accept', tagName: 'input'}, {name: 'accept-charset', tagName: 'form', read: getProperty('acceptCharset')}, @@ -155,26 +169,26 @@ const attributes = [ name: 'accumulate', containerTagName: 'svg', tagName: 'animate', - read: getAttribute('accumulate'), + read: getSVGAttribute('accumulate'), }, {name: 'action', tagName: 'form', overrideStringValue: 'https://reactjs.com'}, { name: 'additive', containerTagName: 'svg', tagName: 'animate', - read: getAttribute('additive'), + read: getSVGAttribute('additive'), }, { name: 'alignment-baseline', containerTagName: 'svg', tagName: 'textPath', - read: getAttribute('alignment-baseline'), + read: getSVGAttribute('alignment-baseline'), }, { name: 'alignmentBaseline', containerTagName: 'svg', tagName: 'textPath', - read: getAttribute('alignment-baseline'), + read: getSVGAttribute('alignment-baseline'), }, { name: 'allowFullScreen', @@ -186,69 +200,66 @@ const attributes = [ tagName: 'iframe', read: getProperty('allowFullscreen'), }, - { - name: 'allowFullscreen', - tagName: 'iframe', - }, + {name: 'allowFullscreen', tagName: 'iframe'}, { name: 'allowReorder', containerTagName: 'svg', tagName: 'switch', - read: getAttribute('allowreorder'), + read: getSVGAttribute('allowReorder'), }, { name: 'allowTransparency', containerTagName: 'svg', tagName: 'path', - read: getAttribute('allowtransparency'), + read: getSVGAttribute('allowtransparency'), }, { name: 'alphabetic', containerTagName: 'svg', - tagName: 'path', - read: getAttribute('alphabetic'), + tagName: 'font-face', + read: getSVGAttribute('alphabetic'), }, {name: 'alt', tagName: 'img'}, { name: 'amplitude', containerTagName: 'svg', - tagName: 'path', - read: getAttribute('amplitude'), + tagName: 'feFuncA', + read: getSVGAttribute('amplitude'), }, { name: 'arabic-form', containerTagName: 'svg', - tagName: 'path', - read: getAttribute('arabic-form'), + tagName: 'glyph', + read: getSVGAttribute('arabic-form'), }, { name: 'arabicForm', containerTagName: 'svg', - tagName: 'path', - read: getAttribute('arabic-form'), + tagName: 'glyph', + read: getSVGAttribute('arabic-form'), }, {name: 'aria', read: getAttribute('aria')}, {name: 'aria-', read: getAttribute('aria-')}, {name: 'aria-invalidattribute', read: getAttribute('aria-invalidattribute')}, - {name: 'as', read: getAttribute('aria-invalidattribute')}, + {name: 'as', tagName: 'link'}, { name: 'ascent', containerTagName: 'svg', tagName: 'font-face', - read: getAttribute('ascent'), + read: getSVGAttribute('ascent'), }, {name: 'async', tagName: 'script'}, { name: 'attributeName', containerTagName: 'svg', tagName: 'animate', - read: getAttribute('attributeName'), + read: getSVGAttribute('attributeName'), }, { name: 'attributeType', containerTagName: 'svg', tagName: 'animate', - read: getAttribute('attributeType'), + read: getSVGAttribute('attributeType'), }, { name: 'autoCapitalize', @@ -266,93 +277,89 @@ const attributes = [ name: 'autoCorrect', tagName: 'input', overrideStringValue: 'off', - read: getAttribute('autocorrect'), // Chrome doesn't support the property. + read: getAttribute('autocorrect'), }, {name: 'autoPlay', tagName: 'video', read: getProperty('autoplay')}, { name: 'autoReverse', containerTagName: 'svg', tagName: 'animate', - read: getAttribute('autoreverse'), + read: getSVGAttribute('autoreverse'), }, {name: 'autoSave', tagName: 'input', read: getAttribute('autosave')}, { name: 'azimuth', containerTagName: 'svg', - tagName: 'fedistantlight', - read: getAttribute('azimuth'), + tagName: 'feDistantLight', + read: getSVGAttribute('azimuth'), }, { name: 'baseFrequency', containerTagName: 'svg', - tagName: 'feturbulance', - read: getAttribute('baseFrequency'), + tagName: 'feTurbulence', + read: getSVGAttribute('baseFrequency'), }, { name: 'baseline-shift', containerTagName: 'svg', tagName: 'textPath', - read: getAttribute('baseline-shift'), + read: getSVGAttribute('baseline-shift'), }, { name: 'baselineShift', containerTagName: 'svg', tagName: 'textPath', - read: getAttribute('baseline-shift'), - }, - { - name: 'baseProfile', - tagName: 'svg', - read: getAttribute('baseProfile'), + read: getSVGAttribute('baseline-shift'), }, + {name: 'baseProfile', tagName: 'svg', read: getSVGAttribute('baseProfile')}, { name: 'bbox', containerTagName: 'svg', tagName: 'font-face', - read: getAttribute('bbox'), + read: getSVGAttribute('bbox'), }, { name: 'begin', containerTagName: 'svg', tagName: 'animate', - read: getAttribute('begin'), + read: getSVGAttribute('begin'), }, { name: 'bias', containerTagName: 'svg', - tagName: 'feconvolvematrix', - read: getAttribute('bias'), + tagName: 'feConvolveMatrix', + read: getSVGAttribute('bias'), }, { name: 'by', containerTagName: 'svg', tagName: 'animate', - read: getAttribute('by'), + read: getSVGAttribute('by'), }, { name: 'calcMode', containerTagName: 'svg', tagName: 'animate', overrideStringValue: 'discrete', - read: getAttribute('calcMode'), + read: getSVGAttribute('calcMode'), }, { name: 'cap-height', containerTagName: 'svg', tagName: 'font-face', - read: getAttribute('cap-height'), + read: getSVGAttribute('cap-height'), }, { name: 'capHeight', containerTagName: 'svg', tagName: 'font-face', - read: getAttribute('cap-height'), + read: getSVGAttribute('cap-height'), }, { name: 'capture', tagName: 'input', overrideStringValue: 'environment', - read: getAttribute('capture'), // The property is not supported in Chrome. + read: getAttribute('capture'), }, {name: 'cellPadding', tagName: 'table'}, {name: 'cellSpacing', tagName: 'table'}, @@ -379,93 +386,93 @@ const attributes = [ name: 'clip-path', containerTagName: 'svg', tagName: 'path', - read: getAttribute('clip-path'), + read: getSVGAttribute('clip-path'), }, { name: 'clipPath', containerTagName: 'svg', tagName: 'path', - read: getAttribute('clip-path'), + read: getSVGAttribute('clip-path'), }, { name: 'clipPathUnits', containerTagName: 'svg', tagName: 'clipPath', - read: getAttribute('clipPathUnits'), + read: getSVGAttribute('clipPathUnits'), }, { name: 'clip-rule', containerTagName: 'svg', tagName: 'path', - read: getAttribute('clip-rule'), + read: getSVGAttribute('clip-rule'), }, { name: 'clipRule', containerTagName: 'svg', tagName: 'path', - read: getAttribute('clip-rule'), + read: getSVGAttribute('clip-rule'), }, { name: 'color', containerTagName: 'svg', tagName: 'text', - read: getAttribute('color'), + read: getSVGAttribute('color'), }, { name: 'color-interpolation', containerTagName: 'svg', tagName: 'animate', overrideStringValue: 'sRGB', - read: getAttribute('color-interpolation'), + read: getSVGAttribute('color-interpolation'), }, { name: 'colorInterpolation', containerTagName: 'svg', tagName: 'animate', overrideStringValue: 'sRGB', - read: getAttribute('color-interpolation'), + read: getSVGAttribute('color-interpolation'), }, { name: 'color-interpolation-filters', containerTagName: 'svg', tagName: 'feComposite', overrideStringValue: 'sRGB', - read: getAttribute('color-interpolation-filters'), + read: getSVGAttribute('color-interpolation-filters'), }, { name: 'colorInterpolationFilters', containerTagName: 'svg', tagName: 'feComposite', overrideStringValue: 'sRGB', - read: getAttribute('color-interpolation-filters'), + read: getSVGAttribute('color-interpolation-filters'), }, { name: 'color-profile', containerTagName: 'svg', tagName: 'image', overrideStringValue: 'sRGB', - read: getAttribute('color-profile'), + read: getSVGAttribute('color-profile'), }, { name: 'colorProfile', containerTagName: 'svg', tagName: 'image', overrideStringValue: 'sRGB', - read: getAttribute('color-profile'), + read: getSVGAttribute('color-profile'), }, { name: 'color-rendering', containerTagName: 'svg', tagName: 'animate', overrideStringValue: 'optimizeSpeed', - read: getAttribute('color-rendering'), + read: getSVGAttribute('color-rendering'), }, { name: 'colorRendering', containerTagName: 'svg', tagName: 'animate', overrideStringValue: 'optimizeSpeed', - read: getAttribute('color-rendering'), + read: getSVGAttribute('color-rendering'), }, {name: 'cols', tagName: 'textarea'}, {name: 'colSpan', tagName: 'td'}, @@ -474,12 +481,12 @@ const attributes = [ { name: 'contentScriptType', tagName: 'svg', - read: getAttribute('contentScriptType'), + read: getSVGAttribute('contentScriptType'), }, { name: 'contentStyleType', tagName: 'svg', - read: getAttribute('contentStyleType'), + read: getSVGAttribute('contentStyleType'), }, {name: 'contextMenu', read: getAttribute('contextmenu')}, // TODO: Read the property by rendering a menu with the ID. {name: 'controls', tagName: 'video'}, @@ -490,19 +497,19 @@ const attributes = [ name: 'cx', containerTagName: 'svg', tagName: 'circle', - read: getAttribute('cx'), + read: getSVGAttribute('cx'), }, { name: 'cy', containerTagName: 'svg', tagName: 'circle', - read: getAttribute('cy'), + read: getSVGAttribute('cy'), }, { name: 'd', containerTagName: 'svg', tagName: 'path', - read: getAttribute('d'), + read: getSVGAttribute('d'), }, { name: 'dangerouslySetInnerHTML', @@ -526,7 +533,7 @@ const attributes = [ name: 'decelerate', containerTagName: 'svg', tagName: 'animate', - read: getAttribute('decelerate'), + read: getSVGAttribute('decelerate'), }, {name: 'default', tagName: 'track'}, { @@ -536,23 +543,19 @@ const attributes = [ }, {name: 'defaultChecked', tagName: 'input'}, {name: 'defaultValue', tagName: 'input'}, - { - name: 'defaultValuE', - tagName: 'input', - read: getAttribute('defaultValuE'), - }, + {name: 'defaultValuE', tagName: 'input', read: getAttribute('defaultValuE')}, {name: 'defer', tagName: 'script'}, { name: 'descent', containerTagName: 'svg', tagName: 'font-face', - read: getAttribute('descent'), + read: getSVGAttribute('descent'), }, { name: 'diffuseConstant', containerTagName: 'svg', - tagName: 'fediffuselighting', - read: getAttribute('diffuseConstant'), + tagName: 'feDiffuseLighting', + read: getSVGAttribute('diffuseConstant'), }, {name: 'dir', overrideStringValue: 'rtl'}, { @@ -560,7 +563,7 @@ const attributes = [ containerTagName: 'svg', tagName: 'text', overrideStringValue: 'rtl', - read: getAttribute('direction'), + read: getSVGAttribute('direction'), }, {name: 'disabled', tagName: 'input'}, { @@ -572,20 +575,20 @@ const attributes = [ { name: 'divisor', containerTagName: 'svg', - tagName: 'feconvolvematrix', - read: getAttribute('divisor'), + tagName: 'feConvolveMatrix', + read: getSVGAttribute('divisor'), }, { name: 'dominant-baseline', containerTagName: 'svg', tagName: 'text', - read: getAttribute('dominant-baseline'), + read: getSVGAttribute('dominant-baseline'), }, { name: 'dominantBaseline', containerTagName: 'svg', tagName: 'text', - read: getAttribute('dominant-baseline'), + read: getSVGAttribute('dominant-baseline'), }, {name: 'download', tagName: 'a'}, {name: 'dOwNlOaD', tagName: 'a', read: getAttribute('dOwNlOaD')}, @@ -594,56 +597,56 @@ const attributes = [ name: 'dur', containerTagName: 'svg', tagName: 'animate', - read: getAttribute('dur'), + read: getSVGAttribute('dur'), }, { name: 'dx', containerTagName: 'svg', - tagName: 'dx', - read: getAttribute('dx'), + tagName: 'text', + read: getSVGAttribute('dx'), }, { name: 'dX', containerTagName: 'svg', - tagName: 'dX', - read: getAttribute('dX'), + tagName: 'text', + read: getSVGAttribute('dX'), }, { name: 'dy', containerTagName: 'svg', - tagName: 'dy', - read: getAttribute('dy'), + tagName: 'text', + read: getSVGAttribute('dy'), }, { name: 'dY', containerTagName: 'svg', - tagName: 'dY', - read: getAttribute('dY'), + tagName: 'text', + read: getSVGAttribute('dY'), }, { name: 'edgeMode', containerTagName: 'svg', tagName: 'feConvolveMatrix', overrideStringValue: 'wrap', - read: getAttribute('edgeMode'), + read: getSVGAttribute('edgeMode'), }, { name: 'elevation', containerTagName: 'svg', - tagName: 'fedistantlight', - read: getAttribute('elevation'), + tagName: 'feDistantLight', + read: getSVGAttribute('elevation'), }, { name: 'enable-background', containerTagName: 'svg', tagName: 'path', - read: getAttribute('enable-background'), + read: getSVGAttribute('enable-background'), }, { name: 'enableBackground', containerTagName: 'svg', tagName: 'path', - read: getAttribute('enable-background'), + read: getSVGAttribute('enable-background'), }, { name: 'encType', @@ -655,161 +658,350 @@ const attributes = [ name: 'end', containerTagName: 'svg', tagName: 'animate', - read: getAttribute('end'), + read: getSVGAttribute('end'), + }, + { + name: 'exponent', + read: getSVGAttribute('exponent'), + containerTagName: 'svg', + tagName: 'feFuncA', }, - {name: 'exponent', read: getAttribute('exponent')}, { name: 'externalResourcesRequired', containerTagName: 'svg', tagName: 'path', - read: getAttribute('externalResourcesRequired'), + read: getSVGAttribute('externalResourcesRequired'), }, { name: 'fill', containerTagName: 'svg', tagName: 'path', - read: getAttribute('fill'), + read: getSVGAttribute('fill'), }, { name: 'fillOpacity', containerTagName: 'svg', tagName: 'circle', - read: getAttribute('fill-opacity'), + read: getSVGAttribute('fill-opacity'), }, { name: 'fill-opacity', containerTagName: 'svg', tagName: 'circle', - read: getAttribute('fill-opacity'), + read: getSVGAttribute('fill-opacity'), }, { name: 'fillRule', containerTagName: 'svg', tagName: 'circle', - read: getAttribute('fill-rule'), + read: getSVGAttribute('fill-rule'), }, { name: 'fill-rule', containerTagName: 'svg', tagName: 'circle', - read: getAttribute('fill-rule'), + read: getSVGAttribute('fill-rule'), }, { name: 'filter', containerTagName: 'svg', tagName: 'g', - read: getAttribute('filter'), + read: getSVGAttribute('filter'), }, { name: 'filterRes', containerTagName: 'svg', tagName: 'filter', - read: getAttribute('filterRes'), + read: getSVGAttribute('filterRes'), }, { name: 'filterUnits', containerTagName: 'svg', tagName: 'filter', overrideStringValue: 'userSpaceOnUse', - read: getAttribute('filterUnits'), + read: getSVGAttribute('filterUnits'), }, { name: 'flood-color', containerTagName: 'svg', tagName: 'feflood', overrideStringValue: 'currentColor', - read: getAttribute('flood-color'), + read: getSVGAttribute('flood-color'), }, { name: 'floodColor', containerTagName: 'svg', tagName: 'feflood', overrideStringValue: 'currentColor', - read: getAttribute('flood-color'), + read: getSVGAttribute('flood-color'), }, { name: 'flood-opacity', containerTagName: 'svg', tagName: 'feflood', overrideStringValue: 'inherit', - read: getAttribute('flood-opacity'), + read: getSVGAttribute('flood-opacity'), }, { name: 'floodOpacity', containerTagName: 'svg', tagName: 'feflood', overrideStringValue: 'inherit', - read: getAttribute('flood-opacity'), + read: getSVGAttribute('flood-opacity'), }, {name: 'focusable', tagName: 'p', read: getAttribute('focusable')}, - {name: 'font-family', read: getAttribute('font-family')}, - {name: 'font-size', read: getAttribute('font-size')}, - {name: 'font-size-adjust', read: getAttribute('font-size-adjust')}, - {name: 'font-stretch', read: getAttribute('font-stretch')}, - {name: 'font-style', read: getAttribute('font-style')}, - {name: 'font-variant', read: getAttribute('font-variant')}, - {name: 'font-weight', read: getAttribute('font-weight')}, - {name: 'fontFamily', read: getAttribute('font-family')}, - {name: 'fontSize', read: getAttribute('font-size')}, - {name: 'fontSizeAdjust', read: getAttribute('font-size-adjust')}, - {name: 'fontStretch', read: getAttribute('font-stretch')}, - {name: 'fontStyle', read: getAttribute('font-style')}, - {name: 'fontVariant', read: getAttribute('font-variant')}, - {name: 'fontWeight', read: getAttribute('font-weight')}, + { + name: 'font-family', + read: getSVGAttribute('font-family'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'font-size', + read: getSVGAttribute('font-size'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'font-size-adjust', + containerTagName: 'svg', + tagName: 'text', + read: getSVGAttribute('font-size-adjust'), + }, + { + name: 'font-stretch', + read: getSVGAttribute('font-stretch'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'font-style', + read: getSVGAttribute('font-style'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'font-variant', + read: getSVGAttribute('font-variant'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'font-weight', + read: getSVGAttribute('font-weight'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'fontFamily', + read: getSVGAttribute('font-family'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'fontSize', + read: getSVGAttribute('font-size'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'fontSizeAdjust', + containerTagName: 'svg', + tagName: 'text', + read: getSVGAttribute('font-size-adjust'), + }, + { + name: 'fontStretch', + read: getSVGAttribute('font-stretch'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'fontStyle', + read: getSVGAttribute('font-style'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'fontVariant', + read: getSVGAttribute('font-variant'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'fontWeight', + read: getSVGAttribute('font-weight'), + containerTagName: 'svg', + tagName: 'font-face', + }, {name: 'for', tagName: 'label', read: getProperty('htmlFor')}, {name: 'fOr', tagName: 'label', read: getProperty('htmlFor')}, - {name: 'form', read: getAttribute('form')}, // TODO: Read the property by rendering into a form with id + {name: 'form', read: getAttribute('form')}, // TODO: Read the property by rendering into a form with i { name: 'formAction', tagName: 'input', overrideStringValue: 'https://reactjs.com', }, - {name: 'format', read: getAttribute('format')}, + { + name: 'format', + read: getSVGAttribute('format'), + containerTagName: 'svg', + tagName: 'altGlyph', + }, {name: 'formEncType', tagName: 'input', read: getProperty('formEnctype')}, {name: 'formMethod', tagName: 'input', overrideStringValue: 'POST'}, {name: 'formNoValidate', tagName: 'input'}, {name: 'formTarget', tagName: 'input'}, {name: 'frameBorder', tagName: 'frame'}, - {name: 'from', read: getAttribute('from')}, - {name: 'fx', read: getAttribute('fx')}, - {name: 'fX', read: getAttribute('fx')}, - {name: 'fY', read: getAttribute('fy')}, - {name: 'fy', read: getAttribute('fy')}, - {name: 'G1', read: getAttribute('g1')}, - {name: 'g1', read: getAttribute('g1')}, - {name: 'G2', read: getAttribute('g2')}, - {name: 'g2', read: getAttribute('g2')}, - {name: 'glyph-name', read: getAttribute('glyph-name')}, + { + name: 'from', + read: getSVGAttribute('from'), + containerTagName: 'svg', + tagName: 'animate', + }, + { + name: 'fx', + read: getSVGAttribute('fx'), + containerTagName: 'svg', + tagName: 'radialGradient', + }, + { + name: 'fX', + containerTagName: 'svg', + tagName: 'radialGradient', + read: getSVGAttribute('fx'), + }, + { + name: 'fY', + containerTagName: 'svg', + tagName: 'radialGradient', + read: getSVGAttribute('fy'), + }, + { + name: 'fy', + read: getSVGAttribute('fy'), + containerTagName: 'svg', + tagName: 'radialGradient', + }, + { + name: 'G1', + containerTagName: 'svg', + tagName: 'hkern', + read: getSVGAttribute('g1'), + }, + { + name: 'g1', + read: getSVGAttribute('g1'), + containerTagName: 'svg', + tagName: 'hkern', + }, + { + name: 'G2', + containerTagName: 'svg', + tagName: 'hkern', + read: getSVGAttribute('g2'), + }, + { + name: 'g2', + read: getSVGAttribute('g2'), + containerTagName: 'svg', + tagName: 'hkern', + }, + { + name: 'glyph-name', + read: getSVGAttribute('glyph-name'), + containerTagName: 'svg', + tagName: 'glyph', + }, { name: 'glyph-orientation-horizontal', - read: getAttribute('glyph-orientation-horizontal'), + containerTagName: 'svg', + tagName: 'text', + read: getSVGAttribute('glyph-orientation-horizontal'), }, { name: 'glyph-orientation-vertical', - read: getAttribute('glyph-orientation-vertical'), + containerTagName: 'svg', + tagName: 'text', + read: getSVGAttribute('glyph-orientation-vertical'), + }, + { + name: 'glyphName', + read: getSVGAttribute('glyph-name'), + containerTagName: 'svg', + tagName: 'glyph', }, - {name: 'glyphName', read: getAttribute('glyph-name')}, { name: 'glyphOrientationHorizontal', - read: getAttribute('glyph-orientation-horizontal'), + containerTagName: 'svg', + tagName: 'text', + read: getSVGAttribute('glyph-orientation-horizontal'), }, { name: 'glyphOrientationVertical', - read: getAttribute('glyph-orientation-vertical'), + containerTagName: 'svg', + tagName: 'text', + read: getSVGAttribute('glyph-orientation-vertical'), + }, + { + name: 'glyphRef', + read: getSVGAttribute('glyph-ref'), + containerTagName: 'svg', + tagName: 'altGlyph', + }, + { + name: 'gradientTransform', + read: getSVGAttribute('gradientTransform'), + containerTagName: 'svg', + tagName: 'linearGradient', + }, + { + name: 'gradientUnits', + read: getSVGAttribute('gradientUnits'), + containerTagName: 'svg', + tagName: 'linearGradient', + }, + { + name: 'hanging', + read: getSVGAttribute('hanging'), + containerTagName: 'svg', + tagName: 'font-face', }, - {name: 'glyphRef', read: getAttribute('glyph-ref')}, - {name: 'gradientTransform', read: getAttribute('gradient-transform')}, - {name: 'gradientUnits', read: getAttribute('gradient-units')}, - {name: 'hanging', read: getAttribute('hanging')}, {name: 'hasOwnProperty', read: getAttribute('hasOwnProperty')}, {name: 'headers', tagName: 'td'}, {name: 'height', tagName: 'img'}, + { + name: 'height', + containerTagName: 'svg', + tagName: 'rect', + read: getSVGAttribute('height'), + }, {name: 'hidden'}, {name: 'high', tagName: 'meter'}, - {name: 'horiz-adv-x', read: getAttribute('horiz-adv-x')}, - {name: 'horiz-origin-x', read: getAttribute('horiz-origin-x')}, - {name: 'horizAdvX', read: getAttribute('horiz-adv-x')}, - {name: 'horizOriginX', read: getAttribute('horiz-origin-x')}, + { + name: 'horiz-adv-x', + read: getSVGAttribute('horiz-adv-x'), + containerTagName: 'svg', + tagName: 'font', + }, + { + name: 'horiz-origin-x', + read: getSVGAttribute('horiz-origin-x'), + containerTagName: 'svg', + tagName: 'font', + }, + { + name: 'horizAdvX', + read: getSVGAttribute('horiz-adv-x'), + containerTagName: 'svg', + tagName: 'font', + }, + { + name: 'horizOriginX', + read: getSVGAttribute('horiz-origin-x'), + containerTagName: 'svg', + tagName: 'font', + }, {name: 'href', tagName: 'a', overrideStringValue: 'https://reactjs.com'}, {name: 'hrefLang', read: getAttribute('hreflang')}, {name: 'htmlFor', tagName: 'label'}, @@ -818,128 +1010,491 @@ const attributes = [ {name: 'icon', tagName: 'command', read: getAttribute('icon')}, {name: 'id'}, {name: 'ID', read: getProperty('id')}, - {name: 'ideographic', read: getAttribute('ideographic')}, - {name: 'image-rendering', read: getAttribute('image-rendering')}, - {name: 'imageRendering', read: getAttribute('image-rendering')}, - {name: 'in', read: getAttribute('in')}, - {name: 'in2', read: getAttribute('in2')}, + { + name: 'ideographic', + read: getSVGAttribute('ideographic'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'image-rendering', + tagName: 'svg', + read: getSVGAttribute('image-rendering'), + }, + { + name: 'imageRendering', + tagName: 'svg', + read: getSVGAttribute('image-rendering'), + }, + { + name: 'in', + read: getSVGAttribute('in'), + containerTagName: 'svg', + tagName: 'feBlend', + }, + { + name: 'in2', + read: getSVGAttribute('in2'), + containerTagName: 'svg', + tagName: 'feBlend', + }, {name: 'initialChecked', read: getAttribute('initialchecked')}, {name: 'initialValue', read: getAttribute('initialvalue')}, {name: 'inlist', read: getAttribute('inlist')}, {name: 'inputMode', tagName: 'input', read: getAttribute('inputmode')}, // TODO: Should use property but it's not implemented in Chrome {name: 'integrity', tagName: 'script'}, - {name: 'intercept', read: getAttribute('intercept')}, + { + name: 'intercept', + read: getSVGAttribute('intercept'), + containerTagName: 'svg', + tagName: 'feFuncA', + }, { name: 'is', tagName: 'button', overrideStringValue: 'x-test-element', - read: getAttribute('is'), - }, // TODO: This could check if this is an extended custom element but this is a controversial spec. + read: getAttribute('is'), // TODO: This could check if this is an extended custom element but this is a controversial spec. + }, {name: 'itemID', read: getAttribute('itemid')}, {name: 'itemProp', read: getAttribute('itemprop')}, {name: 'itemRef', read: getAttribute('itemref')}, {name: 'itemScope', read: getAttribute('itemscope')}, {name: 'itemType', read: getAttribute('itemtype')}, - {name: 'k', read: getAttribute('k')}, - {name: 'K', read: getAttribute('k')}, - {name: 'K1', read: getAttribute('k1')}, - {name: 'k1', read: getAttribute('k1')}, - {name: 'k2', read: getAttribute('k2')}, - {name: 'k3', read: getAttribute('k3')}, - {name: 'k4', read: getAttribute('k4')}, - {name: 'kernelMatrix', read: getAttribute('kernelMatrix')}, - {name: 'kernelUnitLength', read: getAttribute('kernelUnitLength')}, - {name: 'kerning', read: getAttribute('kerning')}, + { + name: 'k', + read: getSVGAttribute('k'), + containerTagName: 'svg', + tagName: 'hkern', + }, + { + name: 'K', + containerTagName: 'svg', + tagName: 'hkern', + read: getSVGAttribute('k'), + }, + { + name: 'K1', + containerTagName: 'svg', + tagName: 'feComposite', + read: getSVGAttribute('k1'), + }, + { + name: 'k1', + read: getSVGAttribute('k1'), + containerTagName: 'svg', + tagName: 'feComposite', + }, + { + name: 'k2', + read: getSVGAttribute('k2'), + containerTagName: 'svg', + tagName: 'feComposite', + }, + { + name: 'k3', + read: getSVGAttribute('k3'), + containerTagName: 'svg', + tagName: 'feComposite', + }, + { + name: 'k4', + read: getSVGAttribute('k4'), + containerTagName: 'svg', + tagName: 'feComposite', + }, + { + name: 'kernelMatrix', + read: getSVGAttribute('kernelMatrix'), + containerTagName: 'svg', + tagName: 'feConvolveMatrix', + }, + { + name: 'kernelUnitLength', + read: getSVGAttribute('kernelUnitLength'), + containerTagName: 'svg', + tagName: 'feConvolveMatrix', + }, + { + name: 'kerning', + containerTagName: 'svg', + tagName: 'text', + read: getSVGAttribute('kerning'), + }, {name: 'keyParams', read: getAttribute('keyParams')}, - {name: 'keyPoints', read: getAttribute('keyPoints')}, - {name: 'keySplines', read: getAttribute('keySplines')}, - {name: 'keyTimes', read: getAttribute('keyTimes')}, + { + name: 'keyPoints', + read: getSVGAttribute('keyPoints'), + containerTagName: 'svg', + tagName: 'animateMotion', + }, + { + name: 'keySplines', + read: getSVGAttribute('keySplines'), + containerTagName: 'svg', + tagName: 'animate', + }, + { + name: 'keyTimes', + read: getSVGAttribute('keyTimes'), + containerTagName: 'svg', + tagName: 'animate', + }, {name: 'keyType', read: getAttribute('keyType')}, {name: 'kind', tagName: 'track', overrideStringValue: 'captions'}, {name: 'label', tagName: 'track'}, {name: 'LANG', read: getProperty('lang')}, {name: 'lang'}, {name: 'length', read: getAttribute('length')}, - {name: 'lengthAdjust', read: getAttribute('lengthAdjust')}, - {name: 'letter-spacing', read: getAttribute('letter-spacing')}, - {name: 'letterSpacing', read: getAttribute('letter-spacing')}, - {name: 'lighting-color', read: getAttribute('lighting-color')}, - {name: 'lightingColor', read: getAttribute('lighting-color')}, - {name: 'limitingConeAngle', read: getAttribute('limitingConeAngle')}, + { + name: 'lengthAdjust', + read: getSVGAttribute('lengthAdjust'), + containerTagName: 'svg', + tagName: 'text', + }, + { + name: 'letter-spacing', + containerTagName: 'svg', + tagName: 'text', + read: getSVGAttribute('letter-spacing'), + }, + { + name: 'letterSpacing', + containerTagName: 'svg', + tagName: 'text', + read: getSVGAttribute('letter-spacing'), + }, + { + name: 'lighting-color', + containerTagName: 'svg', + tagName: 'feDiffuseLighting', + read: getSVGAttribute('lighting-color'), + }, + { + name: 'lightingColor', + containerTagName: 'svg', + tagName: 'feDiffuseLighting', + read: getSVGAttribute('lighting-color'), + }, + { + name: 'limitingConeAngle', + read: getSVGAttribute('limitingConeAngle'), + containerTagName: 'svg', + tagName: 'feSpotLight', + }, {name: 'list', read: getAttribute('list')}, // TODO: This should match the ID of a datalist element and then read property. - {name: 'local', read: getAttribute('local')}, + { + name: 'local', + read: getSVGAttribute('local'), + containerTagName: 'svg', + tagName: 'color-profile', + }, {name: 'loop', tagName: 'audio'}, {name: 'low', tagName: 'meter'}, {name: 'manifest', read: getAttribute('manifest')}, {name: 'marginHeight', tagName: 'frame'}, {name: 'marginWidth', tagName: 'frame'}, - {name: 'marker-end', read: getAttribute('marker-end')}, - {name: 'marker-mid', read: getAttribute('marker-mid')}, - {name: 'marker-start', read: getAttribute('marker-start')}, - {name: 'markerEnd', read: getAttribute('marker-end')}, - {name: 'markerHeight', read: getAttribute('markerHeight')}, - {name: 'markerMid', read: getAttribute('marker-mid')}, - {name: 'markerStart', read: getAttribute('marker-start')}, - {name: 'markerUnits', read: getAttribute('markerUnits')}, - {name: 'markerWidth', read: getAttribute('markerWidth')}, - {name: 'mask', read: getAttribute('mask')}, - {name: 'maskContentUnits', read: getAttribute('maskContentUnits')}, - {name: 'maskUnits', read: getAttribute('maskUnits')}, - {name: 'mathematical', read: getAttribute('mathematical')}, + { + name: 'marker-end', + containerTagName: 'svg', + tagName: 'line', + read: getSVGAttribute('marker-end'), + }, + { + name: 'marker-mid', + containerTagName: 'svg', + tagName: 'line', + read: getSVGAttribute('marker-mid'), + }, + { + name: 'marker-start', + containerTagName: 'svg', + tagName: 'line', + read: getSVGAttribute('marker-start'), + }, + { + name: 'markerEnd', + containerTagName: 'svg', + tagName: 'line', + read: getSVGAttribute('marker-end'), + }, + { + name: 'markerHeight', + read: getSVGAttribute('markerHeight'), + containerTagName: 'svg', + tagName: 'marker', + }, + { + name: 'markerMid', + containerTagName: 'svg', + tagName: 'line', + read: getSVGAttribute('marker-mid'), + }, + { + name: 'markerStart', + containerTagName: 'svg', + tagName: 'line', + read: getSVGAttribute('marker-start'), + }, + { + name: 'markerUnits', + read: getSVGAttribute('markerUnits'), + containerTagName: 'svg', + tagName: 'marker', + }, + { + name: 'markerWidth', + read: getSVGAttribute('markerWidth'), + containerTagName: 'svg', + tagName: 'marker', + }, + { + name: 'mask', + containerTagName: 'svg', + tagName: 'path', + read: getSVGAttribute('mask'), + }, + { + name: 'maskContentUnits', + read: getSVGAttribute('maskContentUnits'), + containerTagName: 'svg', + tagName: 'mask', + }, + { + name: 'maskUnits', + read: getSVGAttribute('maskUnits'), + containerTagName: 'svg', + tagName: 'mask', + }, + { + name: 'mathematical', + read: getSVGAttribute('mathematical'), + containerTagName: 'svg', + tagName: 'font-face', + }, {name: 'max', tagName: 'input'}, {name: 'max', tagName: 'meter'}, {name: 'max', tagName: 'progress'}, + { + name: 'max', + containerTagName: 'svg', + tagName: 'animate', + read: getSVGAttribute('max'), + }, {name: 'maxLength', tagName: 'textarea'}, {name: 'media', tagName: 'link'}, + { + name: 'media', + containerTagName: 'svg', + tagName: 'style', + read: getSVGAttribute('media'), + }, {name: 'mediaGroup', tagName: 'video', read: getAttribute('mediagroup')}, // TODO: Not yet implemented in Chrome. {name: 'method', tagName: 'form', overrideStringValue: 'POST'}, + { + name: 'method', + containerTagName: 'svg', + tagName: 'textPath', + read: getSVGAttribute('method'), + }, {name: 'min', tagName: 'input'}, {name: 'min', tagName: 'meter'}, + { + name: 'min', + containerTagName: 'svg', + tagName: 'animate', + read: getSVGAttribute('min'), + }, {name: 'minLength', tagName: 'input'}, - {name: 'mode', read: getAttribute('mode')}, + { + name: 'mode', + read: getSVGAttribute('mode'), + containerTagName: 'svg', + tagName: 'feBlend', + }, {name: 'multiple', tagName: 'select'}, {name: 'muted', tagName: 'video'}, {name: 'name', tagName: 'input'}, + { + name: 'name', + containerTagName: 'svg', + tagName: 'color-profile', + read: getSVGAttribute('color-profile'), + }, {name: 'nonce', read: getAttribute('nonce')}, {name: 'noValidate', tagName: 'form'}, - {name: 'numOctaves', read: getAttribute('numOctaves')}, - {name: 'offset', read: getAttribute('offset')}, + { + name: 'numOctaves', + read: getSVGAttribute('numOctaves'), + containerTagName: 'svg', + tagName: 'feTurbulence', + }, + { + name: 'offset', + read: getSVGAttribute('offset'), + containerTagName: 'svg', + tagName: 'stop', + }, {name: 'on-click'}, // TODO: Check for event subscriptions {name: 'on-unknownevent'}, // TODO: Check for event subscriptions {name: 'onclick'}, // TODO: Check for event subscriptions {name: 'onClick'}, // TODO: Check for event subscriptions {name: 'onunknownevent'}, // TODO: Check for event subscriptions {name: 'onUnknownEvent'}, // TODO: Check for event subscriptions - {name: 'opacity', read: getAttribute('opacity')}, + { + name: 'opacity', + containerTagName: 'svg', + tagName: 'path', + read: getSVGAttribute('opacity'), + }, {name: 'open', tagName: 'details'}, - {name: 'operator', read: getAttribute('operator')}, + { + name: 'operator', + read: getSVGAttribute('operator'), + containerTagName: 'svg', + tagName: 'feComposite', + }, {name: 'optimum', tagName: 'meter'}, - {name: 'order', read: getAttribute('order')}, - {name: 'orient', read: getAttribute('orient')}, - {name: 'orientation', read: getAttribute('orientation')}, - {name: 'origin', read: getAttribute('origin')}, - {name: 'overflow', read: getAttribute('overflow')}, - {name: 'overline-position', read: getAttribute('overline-position')}, - {name: 'overline-thickness', read: getAttribute('overline-thickness')}, - {name: 'overlinePosition', read: getAttribute('overline-position')}, - {name: 'overlineThickness', read: getAttribute('overline-thickness')}, - {name: 'paint-order', read: getAttribute('paint-order')}, - {name: 'paintOrder', read: getAttribute('paint-order')}, - {name: 'panose-1', read: getAttribute('panose-1')}, - {name: 'panose1', read: getAttribute('panose-1')}, - {name: 'pathLength', read: getAttribute('pathLength')}, + { + name: 'order', + read: getSVGAttribute('order'), + containerTagName: 'svg', + tagName: 'feConvolveMatrix', + }, + { + name: 'orient', + read: getSVGAttribute('orient'), + containerTagName: 'svg', + tagName: 'marker', + }, + { + name: 'orientation', + read: getSVGAttribute('orientation'), + containerTagName: 'svg', + tagName: 'glyph', + }, + { + name: 'origin', + read: getSVGAttribute('origin'), + containerTagName: 'svg', + tagName: 'animateMotion', + }, + { + name: 'overflow', + containerTagName: 'svg', + tagName: 'path', + read: getSVGAttribute('overflow'), + }, + { + name: 'overline-position', + read: getSVGAttribute('overline-position'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'overline-thickness', + read: getSVGAttribute('overline-thickness'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'overlinePosition', + read: getSVGAttribute('overline-position'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'overlineThickness', + read: getSVGAttribute('overline-thickness'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'paint-order', + containerTagName: 'svg', + tagName: 'path', + read: getSVGAttribute('paint-order'), + }, + { + name: 'paintOrder', + containerTagName: 'svg', + tagName: 'path', + read: getSVGAttribute('paint-order'), + }, + { + name: 'panose-1', + read: getSVGAttribute('panose-1'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'panose1', + containerTagName: 'svg', + tagName: 'font-face', + read: getSVGAttribute('panose-1'), + }, + { + name: 'pathLength', + read: getSVGAttribute('pathLength'), + containerTagName: 'svg', + tagName: 'path', + }, {name: 'pattern', tagName: 'input'}, - {name: 'patternContentUnits', read: getAttribute('patternContentUnits')}, - {name: 'patternTransform', read: getAttribute('patternTransform')}, - {name: 'patternUnits', read: getAttribute('patternUnits')}, + { + name: 'patternContentUnits', + read: getSVGAttribute('patternContentUnits'), + containerTagName: 'svg', + tagName: 'pattern', + }, + { + name: 'patternTransform', + read: getSVGAttribute('patternTransform'), + containerTagName: 'svg', + tagName: 'pattern', + }, + { + name: 'patternUnits', + read: getSVGAttribute('patternUnits'), + containerTagName: 'svg', + tagName: 'pattern', + }, {name: 'placeholder', tagName: 'input'}, {name: 'playsInline', read: getAttribute('playsinline')}, - {name: 'pointer-events', read: getAttribute('pointer-events')}, - {name: 'pointerEvents', read: getAttribute('pointer-events')}, - {name: 'points', read: getAttribute('points')}, - {name: 'pointsAtX', read: getAttribute('pointsAtX')}, - {name: 'pointsAtY', read: getAttribute('pointsAtY')}, - {name: 'pointsAtZ', read: getAttribute('pointsAtZ')}, + { + name: 'pointer-events', + containerTagName: 'svg', + tagName: 'path', + read: getSVGAttribute('pointer-events'), + }, + { + name: 'pointerEvents', + containerTagName: 'svg', + tagName: 'path', + read: getSVGAttribute('pointer-events'), + }, + { + name: 'points', + read: getSVGAttribute('points'), + containerTagName: 'svg', + tagName: 'polygon', + }, + { + name: 'pointsAtX', + read: getSVGAttribute('pointsAtX'), + containerTagName: 'svg', + tagName: 'feSpotLight', + }, + { + name: 'pointsAtY', + read: getSVGAttribute('pointsAtY'), + containerTagName: 'svg', + tagName: 'feSpotLight', + }, + { + name: 'pointsAtZ', + read: getSVGAttribute('pointsAtZ'), + containerTagName: 'svg', + tagName: 'feSpotLight', + }, { name: 'poster', tagName: 'video', @@ -947,71 +1502,190 @@ const attributes = [ }, {name: 'prefix', read: getAttribute('prefix')}, {name: 'preload', tagName: 'video', overrideStringValue: 'none'}, - {name: 'preserveAlpha', read: getAttribute('preserveAlpha')}, - {name: 'preserveAspectRatio', read: getAttribute('preserveAspectRatio')}, - {name: 'primitiveUnits', read: getAttribute('primitiveUnits')}, + { + name: 'preserveAlpha', + read: getSVGAttribute('preserveAlpha'), + containerTagName: 'svg', + tagName: 'feConvolveMatrix', + }, + { + name: 'preserveAspectRatio', + read: getSVGAttribute('preserveAspectRatio'), + containerTagName: 'svg', + tagName: 'feImage', + }, + { + name: 'primitiveUnits', + read: getSVGAttribute('primitiveUnits'), + containerTagName: 'svg', + tagName: 'filter', + }, {name: 'profile', read: getAttribute('profile')}, {name: 'property', read: getAttribute('property')}, {name: 'props', read: getAttribute('props')}, - {name: 'r', read: getAttribute('r')}, + { + name: 'r', + read: getSVGAttribute('r'), + containerTagName: 'svg', + tagName: 'circle', + }, {name: 'radioGroup', tagName: 'command', read: getAttribute('radiogroup')}, - {name: 'radius', read: getAttribute('radius')}, + { + name: 'radius', + read: getSVGAttribute('radius'), + containerTagName: 'svg', + tagName: 'feMorphology', + }, {name: 'readOnly', tagName: 'input'}, {name: 'referrerPolicy', tagName: 'iframe'}, - {name: 'refX', read: getAttribute('refX')}, - {name: 'refY', read: getAttribute('refY')}, + { + name: 'refX', + read: getSVGAttribute('refX'), + containerTagName: 'svg', + tagName: 'marker', + }, + { + name: 'refY', + read: getSVGAttribute('refY'), + containerTagName: 'svg', + tagName: 'marker', + }, {name: 'rel', tagName: 'a'}, - {name: 'rendering-intent', read: getAttribute('rendering-intent')}, - {name: 'renderingIntent', read: getAttribute('rendering-intent')}, - {name: 'repeatCount', read: getAttribute('repeatcount')}, - {name: 'repeatDur', read: getAttribute('repeatdur')}, + { + name: 'rendering-intent', + read: getSVGAttribute('rendering-intent'), + containerTagName: 'svg', + tagName: 'color-profile', + }, + { + name: 'renderingIntent', + read: getSVGAttribute('rendering-intent'), + containerTagName: 'svg', + tagName: 'color-profile', + }, + { + name: 'repeatCount', + read: getSVGAttribute('repeatcount'), + containerTagName: 'svg', + tagName: 'animate', + }, + { + name: 'repeatDur', + read: getSVGAttribute('repeatdur'), + containerTagName: 'svg', + tagName: 'animate', + }, {name: 'required', tagName: 'input'}, - {name: 'requiredExtensions', read: getAttribute('requiredExtensions')}, - {name: 'requiredFeatures', read: getAttribute('requiredFeatures')}, + { + name: 'requiredExtensions', + read: getSVGAttribute('requiredExtensions'), + containerTagName: 'svg', + tagName: 'a', + }, + { + name: 'requiredFeatures', + read: getSVGAttribute('requiredFeatures'), + containerTagName: 'svg', + tagName: 'a', + }, {name: 'resource', read: getAttribute('resource')}, - {name: 'restart', read: getAttribute('resource')}, - {name: 'result', read: getAttribute('result')}, + { + name: 'restart', + read: getSVGAttribute('resource'), + containerTagName: 'svg', + tagName: 'animate', + }, + { + name: 'result', + read: getSVGAttribute('result'), + containerTagName: 'svg', + tagName: 'feBlend', + }, {name: 'results', tagName: 'input', read: getAttribute('results')}, // TODO: Should use property but it's not supported in Chrome. {name: 'reversed', tagName: 'ol'}, {name: 'role', read: getAttribute('role')}, - {name: 'rotate', read: getAttribute('role')}, + { + name: 'rotate', + read: getSVGAttribute('role'), + containerTagName: 'svg', + tagName: 'altGlyph', + }, {name: 'rows', tagName: 'textarea'}, {name: 'rowSpan', tagName: 'td'}, - {name: 'rx', read: getAttribute('rx')}, - {name: 'ry', read: getAttribute('ry')}, + { + name: 'rx', + read: getSVGAttribute('rx'), + containerTagName: 'svg', + tagName: 'ellipse', + }, + { + name: 'ry', + read: getSVGAttribute('ry'), + containerTagName: 'svg', + tagName: 'ellipse', + }, { name: 'sandbox', tagName: 'iframe', overrideStringValue: 'allow-forms allow-scripts', - read(element) { - return element.sandbox.value; - }, }, - {name: 'scale', read: getAttribute('scale')}, + { + name: 'scale', + read: getSVGAttribute('scale'), + containerTagName: 'svg', + tagName: 'feDisplacementMap', + }, {name: 'scope', tagName: 'th', overrideStringValue: 'row'}, {name: 'scoped', tagName: 'style', read: getAttribute('scoped')}, {name: 'scrolling', tagName: 'iframe', overrideStringValue: 'no'}, {name: 'seamless', tagName: 'iframe', read: getAttribute('seamless')}, {name: 'security', tagName: 'iframe', read: getAttribute('security')}, - {name: 'seed', read: getAttribute('seed')}, + { + name: 'seed', + read: getSVGAttribute('seed'), + containerTagName: 'svg', + tagName: 'feTurbulence', + }, {name: 'selected', tagName: 'option', containerTagName: 'select'}, {name: 'selectedIndex', tagName: 'select'}, {name: 'shape', tagName: 'a'}, - {name: 'shape-rendering', read: getAttribute('shape-rendering')}, - {name: 'shapeRendering', read: getAttribute('shape-rendering')}, - {name: 'size', tagName: 'input'}, { - name: 'sizes', - tagName: 'link', - read(element) { - return element.sizes.value; - }, + name: 'shape-rendering', + tagName: 'svg', + read: getSVGAttribute('shape-rendering'), + }, + { + name: 'shapeRendering', + tagName: 'svg', + read: getSVGAttribute('shape-rendering'), + }, + {name: 'size', tagName: 'input'}, + {name: 'sizes', tagName: 'link'}, + { + name: 'slope', + read: getSVGAttribute('slope'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'spacing', + read: getSVGAttribute('spacing'), + containerTagName: 'svg', + tagName: 'textPath', }, - {name: 'slope', read: getAttribute('slope')}, - {name: 'spacing', read: getAttribute('spacing')}, {name: 'span', tagName: 'col'}, - {name: 'specularConstant', read: getAttribute('specularConstant')}, - {name: 'specularExponent', read: getAttribute('specularConstant')}, + { + name: 'specularConstant', + read: getSVGAttribute('specularConstant'), + containerTagName: 'svg', + tagName: 'feSpecularLighting', + }, + { + name: 'specularExponent', + read: getSVGAttribute('specularConstant'), + containerTagName: 'svg', + tagName: 'feSpecularLighting', + }, {name: 'speed', read: getAttribute('speed')}, { name: 'spellCheck', @@ -1025,7 +1699,12 @@ const attributes = [ tagName: 'input', read: getProperty('spellcheck'), }, - {name: 'spreadMethod', read: getAttribute('spreadMethod')}, + { + name: 'spreadMethod', + read: getSVGAttribute('spreadMethod'), + containerTagName: 'svg', + tagName: 'linearGradient', + }, {name: 'src', tagName: 'img', overrideStringValue: 'https://reactjs.com'}, { name: 'srcDoc', @@ -1056,112 +1735,412 @@ const attributes = [ {name: 'srcSet', tagName: 'img'}, {name: 'srcset', tagName: 'img'}, {name: 'start', tagName: 'ol'}, - {name: 'startOffset', read: getAttribute('startOffset')}, + { + name: 'startOffset', + read: getSVGAttribute('startOffset'), + containerTagName: 'svg', + tagName: 'textPath', + }, {name: 'state', read: getAttribute('state')}, - {name: 'stdDeviation', read: getAttribute('stdDeviation')}, - {name: 'stemh', read: getAttribute('stemh')}, - {name: 'stemv', read: getAttribute('stemv')}, + { + name: 'stdDeviation', + read: getSVGAttribute('stdDeviation'), + containerTagName: 'svg', + tagName: 'feGaussianBlur', + }, + { + name: 'stemh', + read: getSVGAttribute('stemh'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'stemv', + read: getSVGAttribute('stemv'), + containerTagName: 'svg', + tagName: 'font-face', + }, {name: 'step', read: getAttribute('step')}, - {name: 'stitchTiles', read: getAttribute('stitchTiles')}, - {name: 'stop-color', read: getAttribute('stop-color')}, - {name: 'stop-opacity', read: getAttribute('stop-opacity')}, - {name: 'stopColor', read: getAttribute('stop-color')}, - {name: 'stopOpacity', read: getAttribute('stop-opacity')}, + { + name: 'stitchTiles', + read: getSVGAttribute('stitchTiles'), + containerTagName: 'svg', + tagName: 'feTurbulence', + }, + { + name: 'stop-color', + containerTagName: 'svg', + tagName: 'stop', + read: getSVGAttribute('stop-color'), + }, + { + name: 'stop-opacity', + containerTagName: 'svg', + tagName: 'stop', + read: getSVGAttribute('stop-opacity'), + }, + { + name: 'stopColor', + containerTagName: 'svg', + tagName: 'stop', + read: getSVGAttribute('stop-color'), + }, + { + name: 'stopOpacity', + containerTagName: 'svg', + tagName: 'stop', + read: getSVGAttribute('stop-opacity'), + }, { name: 'strikethrough-position', - read: getAttribute('strikethrough-thickness'), + read: getSVGAttribute('strikethrough-position'), + containerTagName: 'svg', + tagName: 'font-face', }, { name: 'strikethrough-thickness', - read: getAttribute('strikethrough-thickness'), + read: getSVGAttribute('strikethrough-thickness'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'strikethroughPosition', + read: getSVGAttribute('strikethrough-position'), + containerTagName: 'svg', + tagName: 'font-face', }, - {name: 'strikethroughPosition', read: getAttribute('strikethrough-position')}, { name: 'strikethroughThickness', - read: getAttribute('strikethrough-thickness'), + read: getSVGAttribute('strikethrough-thickness'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'string', + read: getSVGAttribute('string'), + containerTagName: 'svg', + tagName: 'font-face-format', + }, + { + name: 'stroke', + containerTagName: 'svg', + tagName: 'path', + read: getSVGAttribute('stroke'), + }, + { + name: 'stroke-dasharray', + containerTagName: 'svg', + tagName: 'path', + read: getSVGAttribute('stroke-dasharray'), + }, + { + name: 'stroke-Dasharray', + containerTagName: 'svg', + tagName: 'path', + read: getSVGAttribute('stroke-dasharray'), + }, + { + name: 'stroke-dashoffset', + containerTagName: 'svg', + tagName: 'path', + read: getSVGAttribute('stroke-dashoffset'), + }, + { + name: 'stroke-linecap', + containerTagName: 'svg', + tagName: 'path', + read: getSVGAttribute('stroke-linecap'), + }, + { + name: 'stroke-linejoin', + containerTagName: 'svg', + tagName: 'path', + read: getSVGAttribute('stroke-linejoin'), + }, + { + name: 'stroke-miterlimit', + containerTagName: 'svg', + tagName: 'path', + read: getSVGAttribute('stroke-miterlimit'), + }, + { + name: 'stroke-opacity', + containerTagName: 'svg', + tagName: 'path', + read: getSVGAttribute('stroke-opacity'), + }, + { + name: 'stroke-width', + containerTagName: 'svg', + tagName: 'path', + read: getSVGAttribute('stroke-width'), + }, + { + name: 'strokeDasharray', + containerTagName: 'svg', + tagName: 'path', + read: getSVGAttribute('stroke-dasharray'), + }, + { + name: 'strokeDashoffset', + containerTagName: 'svg', + tagName: 'path', + read: getSVGAttribute('stroke-dashoffset'), + }, + { + name: 'strokeLinecap', + containerTagName: 'svg', + tagName: 'path', + read: getSVGAttribute('stroke-linecap'), + }, + { + name: 'strokeLinejoin', + containerTagName: 'svg', + tagName: 'path', + read: getSVGAttribute('stroke-linejoin'), + }, + { + name: 'strokeMiterlimit', + containerTagName: 'svg', + tagName: 'path', + read: getSVGAttribute('stroke-miterlimit'), + }, + { + name: 'strokeOpacity', + containerTagName: 'svg', + tagName: 'path', + read: getSVGAttribute('stroke-opacity'), + }, + { + name: 'strokeWidth', + containerTagName: 'svg', + tagName: 'path', + read: getSVGAttribute('stroke-width'), }, - {name: 'string', read: getAttribute('string')}, - {name: 'stroke', read: getAttribute('stroke')}, - {name: 'stroke-dasharray', read: getAttribute('stroke-dasharray')}, - {name: 'stroke-Dasharray', read: getAttribute('stroke-dasharray')}, - {name: 'stroke-dashoffset', read: getAttribute('stroke-dashoffset')}, - {name: 'stroke-linecap', read: getAttribute('stroke-linecap')}, - {name: 'stroke-linejoin', read: getAttribute('stroke-linejoin')}, - {name: 'stroke-miterlimit', read: getAttribute('stroke-miterlimit')}, - {name: 'stroke-opacity', read: getAttribute('stroke-opacity')}, - {name: 'stroke-width', read: getAttribute('stroke-width')}, - {name: 'strokeDasharray', read: getAttribute('stroke-dasharray')}, - {name: 'strokeDashoffset', read: getAttribute('stroke-dashoffset')}, - {name: 'strokeLinecap', read: getAttribute('stroke-linecap')}, - {name: 'strokeLinejoin', read: getAttribute('stroke-linejoin')}, - {name: 'strokeMiterlimit', read: getAttribute('stroke-miterlimit')}, - {name: 'strokeOpacity', read: getAttribute('stroke-opacity')}, - {name: 'strokeWidth', read: getAttribute('stroke-width')}, {name: 'style'}, {name: 'summary', tagName: 'table'}, { name: 'suppressContentEditableWarning', read: getAttribute('suppresscontenteditablewarning'), }, - {name: 'surfaceScale', read: getAttribute('surfaceScale')}, + { + name: 'surfaceScale', + read: getSVGAttribute('surfaceScale'), + containerTagName: 'svg', + tagName: 'feDiffuseLighting', + }, { name: 'systemLanguage', overrideStringValue: 'en', - read: getAttribute('systemLanguage'), - }, // obsolete as of IE9 + read: getSVGAttribute('systemLanguage'), + containerTagName: 'svg', + tagName: 'a', + }, {name: 'tabIndex'}, - {name: 'tableValues', read: getAttribute('tableValues')}, - {name: 'target', read: getAttribute('target')}, - {name: 'targetX', read: getAttribute('targetX')}, - {name: 'targetY', read: getAttribute('targetY')}, - {name: 'text-anchor', read: getAttribute('text-anchor')}, - {name: 'text-decoration', read: getAttribute('text-decoration')}, - {name: 'text-rendering', read: getAttribute('text-rendering')}, - {name: 'textAnchor', read: getAttribute('text-anchor')}, - {name: 'textDecoration', read: getAttribute('text-decoration')}, - {name: 'textLength', read: getAttribute('textLength')}, - {name: 'textRendering', read: getAttribute('text-rendering')}, + { + name: 'tableValues', + read: getSVGAttribute('tableValues'), + containerTagName: 'svg', + tagName: 'feFuncA', + }, + { + name: 'target', + read: getSVGAttribute('target'), + containerTagName: 'svg', + tagName: 'a', + }, + { + name: 'targetX', + read: getSVGAttribute('targetX'), + containerTagName: 'svg', + tagName: 'feConvolveMatrix', + }, + { + name: 'targetY', + read: getSVGAttribute('targetY'), + containerTagName: 'svg', + tagName: 'feConvolveMatrix', + }, + { + name: 'text-anchor', + containerTagName: 'svg', + tagName: 'text', + read: getSVGAttribute('text-anchor'), + }, + { + name: 'text-decoration', + containerTagName: 'svg', + tagName: 'text', + read: getSVGAttribute('text-decoration'), + }, + { + name: 'text-rendering', + tagName: 'svg', + read: getSVGAttribute('text-rendering'), + }, + { + name: 'textAnchor', + containerTagName: 'svg', + tagName: 'text', + read: getSVGAttribute('text-anchor'), + }, + { + name: 'textDecoration', + containerTagName: 'svg', + tagName: 'text', + read: getSVGAttribute('text-decoration'), + }, + { + name: 'textLength', + read: getSVGAttribute('textLength'), + containerTagName: 'svg', + tagName: 'text', + }, + { + name: 'textRendering', + tagName: 'svg', + read: getSVGAttribute('text-rendering'), + }, {name: 'title'}, - {name: 'to', read: getAttribute('to')}, - {name: 'transform', read: getAttribute('transform')}, + { + name: 'to', + read: getSVGAttribute('to'), + containerTagName: 'svg', + tagName: 'set', + }, + { + name: 'transform', + read: getSVGAttribute('transform'), + containerTagName: 'svg', + tagName: 'a', + }, {name: 'type', tagName: 'button', overrideStringValue: 'reset'}, + { + name: 'type', + containerTagName: 'svg', + tagName: 'feFuncA', + read: getSVGAttribute('type'), + }, {name: 'typeof', read: getAttribute('typeof')}, - {name: 'u1', read: getAttribute('u1')}, - {name: 'u2', read: getAttribute('u2')}, - {name: 'underline-position', read: getAttribute('underline-position')}, - {name: 'underline-thickness', read: getAttribute('underline-thickness')}, - {name: 'underlinePosition', read: getAttribute('underline-position')}, - {name: 'underlineThickness', read: getAttribute('underline-thickness')}, - {name: 'unicode', read: getAttribute('unicode')}, - {name: 'unicode-bidi', read: getAttribute('unicode-bidi')}, - {name: 'unicode-range', read: getAttribute('unicode-range')}, - {name: 'unicodeBidi', read: getAttribute('unicode-bidi')}, - {name: 'unicodeRange', read: getAttribute('unicode-range')}, - {name: 'units-per-em', read: getAttribute('units-per-em')}, - {name: 'unitsPerEm', read: getAttribute('unites-per-em')}, + { + name: 'u1', + read: getSVGAttribute('u1'), + containerTagName: 'svg', + tagName: 'hkern', + }, + { + name: 'u2', + read: getSVGAttribute('u2'), + containerTagName: 'svg', + tagName: 'hkern', + }, + { + name: 'underline-position', + read: getSVGAttribute('underline-position'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'underline-thickness', + read: getSVGAttribute('underline-thickness'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'underlinePosition', + read: getSVGAttribute('underline-position'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'underlineThickness', + read: getSVGAttribute('underline-thickness'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'unicode', + read: getSVGAttribute('unicode'), + containerTagName: 'svg', + tagName: 'glyph', + }, + { + name: 'unicode-bidi', + containerTagName: 'svg', + tagName: 'text', + read: getSVGAttribute('unicode-bidi'), + }, + { + name: 'unicode-range', + read: getSVGAttribute('unicode-range'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'unicodeBidi', + containerTagName: 'svg', + tagName: 'text', + read: getSVGAttribute('unicode-bidi'), + }, + { + name: 'unicodeRange', + read: getSVGAttribute('unicode-range'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'units-per-em', + read: getSVGAttribute('units-per-em'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'unitsPerEm', + read: getSVGAttribute('unites-per-em'), + containerTagName: 'svg', + tagName: 'font-face', + }, {name: 'unknown', read: getAttribute('unknown')}, { name: 'unselectable', read: getAttribute('unselectable'), tagName: 'span', overrideStringValue: 'on', - }, // seems to be IE only + }, {name: 'useMap', tagName: 'img'}, - {name: 'v-alphabetic', read: getAttribute('v-alphabetic')}, - {name: 'v-hanging', read: getAttribute('v-hanging')}, - {name: 'v-ideographic', read: getAttribute('v-ideographic')}, - {name: 'v-mathematical', read: getAttribute('v-mathematical')}, - {name: 'vAlphabetic', read: getAttribute('v-alphabetic')}, + { + name: 'v-alphabetic', + read: getSVGAttribute('v-alphabetic'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'v-hanging', + read: getSVGAttribute('v-hanging'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'v-ideographic', + read: getSVGAttribute('v-ideographic'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'v-mathematical', + read: getSVGAttribute('v-mathematical'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'vAlphabetic', + read: getSVGAttribute('v-alphabetic'), + containerTagName: 'svg', + tagName: 'font-face', + }, {name: 'value', tagName: 'input'}, {name: 'value', tagName: 'input', type: 'email'}, - { - name: 'value', - tagName: 'input', - type: 'number', - read(element) { - return element.valueAsNumber; - }, - }, + {name: 'value', tagName: 'input', type: 'number'}, {name: 'value', tagName: 'textarea'}, {name: 'value', containerTagName: 'select', tagName: 'option'}, { @@ -1170,37 +2149,175 @@ const attributes = [ tagName: 'option', read: getProperty('value'), }, - {name: 'values', read: getAttribute('values')}, - {name: 'vector-effect', read: getAttribute('vector-effect')}, - {name: 'vectorEffect', read: getAttribute('vector-effect')}, + { + name: 'values', + read: getSVGAttribute('values'), + containerTagName: 'svg', + tagName: 'feColorMatrix', + }, + { + name: 'vector-effect', + containerTagName: 'svg', + tagName: 'line', + read: getSVGAttribute('vector-effect'), + }, + { + name: 'vectorEffect', + containerTagName: 'svg', + tagName: 'line', + read: getSVGAttribute('vector-effect'), + }, {name: 'version', tagName: 'html'}, - {name: 'vert-adv-y', read: getAttribute('vert-origin-y')}, - {name: 'vert-origin-x', read: getAttribute('vert-origin-y')}, - {name: 'vert-origin-y', read: getAttribute('vert-origin-y')}, - {name: 'vertAdvY', read: getAttribute('vert-adv-y')}, - {name: 'vertOriginX', read: getAttribute('vert-origin-x')}, - {name: 'vertOriginY', read: getAttribute('vert-origin-y')}, - {name: 'vHanging', read: getAttribute('v-hanging')}, - {name: 'vIdeographic', read: getAttribute('v-ideographic')}, - {name: 'viewBox', read: getAttribute('viewBox')}, - {name: 'viewTarget', read: getAttribute('viewTarget')}, + {name: 'version', tagName: 'svg', read: getSVGAttribute('version')}, + { + name: 'vert-adv-y', + read: getSVGAttribute('vert-origin-y'), + containerTagName: 'svg', + tagName: 'font', + }, + { + name: 'vert-origin-x', + read: getSVGAttribute('vert-origin-y'), + containerTagName: 'svg', + tagName: 'font', + }, + { + name: 'vert-origin-y', + read: getSVGAttribute('vert-origin-y'), + containerTagName: 'svg', + tagName: 'font', + }, + { + name: 'vertAdvY', + read: getSVGAttribute('vert-adv-y'), + containerTagName: 'svg', + tagName: 'font', + }, + { + name: 'vertOriginX', + read: getSVGAttribute('vert-origin-x'), + containerTagName: 'svg', + tagName: 'font', + }, + { + name: 'vertOriginY', + read: getSVGAttribute('vert-origin-y'), + containerTagName: 'svg', + tagName: 'font', + }, + { + name: 'vHanging', + read: getSVGAttribute('v-hanging'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'vIdeographic', + read: getSVGAttribute('v-ideographic'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'viewBox', + read: getSVGAttribute('viewBox'), + containerTagName: 'svg', + tagName: 'marker', + }, + { + name: 'viewTarget', + read: getSVGAttribute('viewTarget'), + containerTagName: 'svg', + tagName: 'view', + }, {name: 'visibility', read: getAttribute('visibility')}, - {name: 'vMathematical', read: getAttribute('v-mathematical')}, + { + name: 'visibility', + containerTagName: 'svg', + tagName: 'path', + read: getSVGAttribute('visibility'), + }, + { + name: 'vMathematical', + read: getSVGAttribute('v-mathematical'), + containerTagName: 'svg', + tagName: 'font-face', + }, {name: 'vocab', read: getAttribute('vocab')}, {name: 'width', tagName: 'img'}, - {name: 'widths', read: getAttribute('widths')}, + { + name: 'width', + containerTagName: 'svg', + tagName: 'rect', + read: getSVGAttribute('width'), + }, + { + name: 'widths', + read: getSVGAttribute('widths'), + containerTagName: 'svg', + tagName: 'font-face', + }, {name: 'wmode', read: getAttribute('wmode'), tagName: 'embed'}, - {name: 'word-spacing', read: getAttribute('word-spacing')}, - {name: 'wordSpacing', read: getAttribute('word-spacing')}, + { + name: 'word-spacing', + containerTagName: 'svg', + tagName: 'text', + read: getSVGAttribute('word-spacing'), + }, + { + name: 'wordSpacing', + containerTagName: 'svg', + tagName: 'text', + read: getSVGAttribute('word-spacing'), + }, {name: 'wrap', tagName: 'textarea'}, - {name: 'writing-mode', read: getAttribute('writing-mode')}, - {name: 'writingMode', read: getAttribute('writing-mode')}, - {name: 'x', read: getAttribute('x')}, - {name: 'x-height', read: getAttribute('x-height')}, - {name: 'x1', read: getAttribute('x1')}, - {name: 'x2', read: getAttribute('x2')}, - {name: 'xChannelSelector', read: getAttribute('xChannelSelector')}, - {name: 'xHeight', read: getAttribute('x-height')}, + { + name: 'writing-mode', + containerTagName: 'svg', + tagName: 'text', + read: getSVGAttribute('writing-mode'), + }, + { + name: 'writingMode', + containerTagName: 'svg', + tagName: 'text', + read: getSVGAttribute('writing-mode'), + }, + { + name: 'x', + read: getSVGAttribute('x'), + containerTagName: 'svg', + tagName: 'altGlyph', + }, + { + name: 'x-height', + read: getSVGAttribute('x-height'), + containerTagName: 'svg', + tagName: 'font-face', + }, + { + name: 'x1', + read: getSVGAttribute('x1'), + containerTagName: 'svg', + tagName: 'line', + }, + { + name: 'x2', + read: getSVGAttribute('x2'), + containerTagName: 'svg', + tagName: 'line', + }, + { + name: 'xChannelSelector', + read: getSVGAttribute('xChannelSelector'), + containerTagName: 'svg', + tagName: 'feDisplacementMap', + }, + { + name: 'xHeight', + read: getSVGAttribute('x-height'), + containerTagName: 'svg', + tagName: 'font-face', + }, {name: 'XLink:Actuate', read: getAttribute('XLink:Actuate')}, {name: 'xlink:actuate', read: getAttribute('xlink:actuate')}, {name: 'xlink:arcrole', read: getAttribute('xlink:arcrole')}, @@ -1222,20 +2339,41 @@ const attributes = [ {name: 'xml:space', read: getAttribute('xml:space')}, {name: 'xmlBase', read: getAttribute('xml:base')}, {name: 'xmlLang', read: getAttribute('xml:lang')}, - { - name: 'xmlns', - read: getProperty('namespaceURI'), - tagName: 'svg', - }, + {name: 'xmlns', read: getProperty('namespaceURI'), tagName: 'svg'}, {name: 'xmlns:xlink', read: getAttribute('xmlns:xlink')}, {name: 'xmlnsXlink', read: getAttribute('xmlns:xlink')}, {name: 'xmlSpace', read: getAttribute('xml:space')}, - {name: 'y', read: getAttribute('y')}, - {name: 'y1', read: getAttribute('y1')}, - {name: 'y2', read: getAttribute('y2')}, - {name: 'yChannelSelector', read: getAttribute('yChannelSelector')}, - {name: 'z', read: getAttribute('z')}, - {name: 'zoomAndPan', read: getAttribute('zoomAndPan')}, + { + name: 'y', + read: getSVGAttribute('y'), + containerTagName: 'svg', + tagName: 'altGlyph', + }, + { + name: 'y1', + read: getSVGAttribute('y1'), + containerTagName: 'svg', + tagName: 'line', + }, + { + name: 'y2', + read: getSVGAttribute('y2'), + containerTagName: 'svg', + tagName: 'line', + }, + { + name: 'yChannelSelector', + read: getSVGAttribute('yChannelSelector'), + containerTagName: 'svg', + tagName: 'feDisplacementMap', + }, + { + name: 'z', + read: getSVGAttribute('z'), + containerTagName: 'svg', + tagName: 'fePointLight', + }, + {name: 'zoomAndPan', read: getSVGAttribute('zoomAndPan'), tagName: 'svg'}, ]; let _didWarn = false;