From f7e588bf258134af5529d3179ba29fdb31ce6074 Mon Sep 17 00:00:00 2001 From: alexcjohnson Date: Fri, 29 Jan 2021 23:26:19 -0500 Subject: [PATCH 1/7] fix ObjectEl data prop --- scripts/extract-attributes.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/extract-attributes.js b/scripts/extract-attributes.js index ec4e1a85..997a34b8 100644 --- a/scripts/extract-attributes.js +++ b/scripts/extract-attributes.js @@ -10,14 +10,13 @@ const dataPath = './data/attributes.json'; const htmlPath = './data/attributes.html'; // From https://facebook.github.io/react/docs/tags-and-attributes.html#supported-attributes -// less the `data` attribute, -// the special `className` and `htmlFor` props, +// less the special `className` and `htmlFor` props, // and `httpEquiv` + `acceptCharset` which are already correctly camelCased. const supportedAttributes = ['accept', 'accessKey', 'action', 'allowFullScreen', 'allowTransparency', 'alt', 'async', 'autoComplete', 'autoFocus', 'autoPlay', 'capture', 'cellPadding', 'cellSpacing', 'challenge', 'charSet', 'checked', 'cite', 'classID', 'colSpan', 'cols', 'content', -'contentEditable', 'contextMenu', 'controls', 'coords', 'crossOrigin', +'contentEditable', 'contextMenu', 'controls', 'coords', 'crossOrigin', 'data', 'dateTime', 'default', 'defer', 'dir', 'disabled', 'download', 'draggable', 'encType', 'form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'frameBorder', 'headers', 'height', 'hidden', 'high', 'href', @@ -82,7 +81,7 @@ function extractAttributes($) { .toString(); // Skip `data-*` attributes - if (htmlAttribute.indexOf('data') === 0) { + if (htmlAttribute.indexOf('data-') === 0) { return; } From fcb414e6c9ce2aa234e2ba5819b1454298d97a04 Mon Sep 17 00:00:00 2001 From: alexcjohnson Date: Fri, 29 Jan 2021 23:27:03 -0500 Subject: [PATCH 2/7] add deprecation notes on some elements, and fix for a few more changes to MDN --- scripts/extract-elements.js | 10 ++++++- scripts/generate-components.js | 54 +++++++++++++++++++++++++++++++++- 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/scripts/extract-elements.js b/scripts/extract-elements.js index d7a5f4f8..9292f5a9 100644 --- a/scripts/extract-elements.js +++ b/scripts/extract-elements.js @@ -20,11 +20,18 @@ function extractElements($) { 'svg', 'math', // obsolete, non-standard, or deprecated tags 'image', 'dir', 'tt', 'applet', 'noembed', 'bgsound', 'menu', 'menuitem', - 'noframes' + 'noframes', + // experimental, don't add yet + 'portal' ]; // `
` is for some reason missing from the reference tables. + // `` and `element` are obsolete and has been removed from the + // reference table, but we had them in the past so we should wait for a + // major to remove const addElements = [ 'base', + 'command', + 'element', 'section', 'h1', 'h2', @@ -64,6 +71,7 @@ request(refUrl, (error, response, html) => { if (elements.length !== expectedElCount) { throw new Error( 'Unexpected number of elements extracted from ' + refUrl + + ' - Found ' + elements.length + ' but expected ' + expectedElCount + ' Check the output and edit expectedElCount if this is intended.' ); } diff --git a/scripts/generate-components.js b/scripts/generate-components.js index d2e1a0da..e2f1a77e 100644 --- a/scripts/generate-components.js +++ b/scripts/generate-components.js @@ -198,16 +198,68 @@ function generatePropTypes(element, attributes) { 'setProps': PropTypes.func` } +const obsoleteDoc = element => ` + * OBSOLETE: <${element}> is included for completeness, but should be avoided + * as it is not supported by any modern browsers.`; + +const customDocs = { + basefont: ` + * OBSOLETE: is included for completeness, but should be avoided + * as it is only supported by Internet Explorer.`, + blink: obsoleteDoc('blink'), + command: obsoleteDoc('command'), + element: obsoleteDoc('element'), + isindex: obsoleteDoc('isindex'), + keygen: ` + * DEPRECATED: is included for completeness, but should be avoided + * as it is not supported by all browsers and may be removed at any time from + * those that do support it.`, + listing: obsoleteDoc('listing') + ' Use
 or  instead.',
+    marquee: `
+ * DEPRECATED:  is included for completeness, but should be avoided
+ * as browsers may remove it at any time.`,
+    meta: `
+ * CAUTION:  is included for completeness, but generally will not behave
+ * as expected since  tags should be static HTML content in the  of
+ * the document. Dash components are dynamic  content.`,
+    multicol: obsoleteDoc('multicol'),
+    nextid: obsoleteDoc('nextid'),
+    output: `
+ * CAUTION:  is included for completeness, but its typical usage
+ * requires the oninput attribute of the enclosing 
element, which + * is not accessible to Dash.`, + script: ` + * CAUTION: